Skip to main content
Parallel code search for agents — up to 8 concurrent lookups with caching, typically 10–20× faster than sequential grep.
The user asks about the codebase; parallel search tools populate agent context in fewer turns than sequential grep.

How It Works

Key Features

Quick Start

1

Simple Usage

2

With Configuration

Configuration Options

FastContext Direct Usage

Environment Variables

You can also configure Fast Context via environment variables:

Performance Optimizations

FastContext includes optional performance optimizations that enable faster search with no impact on default behavior:
FastContext automatically selects the optimal backend based on codebase size:
Use search_backend="auto" (default) for optimal performance. FastContext counts files and automatically chooses Python for small projects and Ripgrep for large codebases.

Optional Dependencies

Install optional dependencies for enhanced performance:
Or install individually:
All optimizations are optional with graceful fallback. If dependencies are not installed, FastContext uses built-in Python implementations.

Standalone Usage

You can also use Fast Context independently without an Agent:

Search Tools

Fast Context provides four core search tools: Pattern-based search with regex support:
Find files by pattern:

read_file

Read file contents with line ranges:

list_directory

List directory contents:

File and Symbol Indexing

For even faster searches, use the indexers:

Caching

Fast Context automatically caches search results:

Performance

Fast Context provides significant performance improvements:

Best Practices

Enable caching for workflows that search the same patterns multiple times:
Use include/exclude patterns to focus searches:
Pre-index files and symbols for instant lookups:

API Reference

FastContext Class

FastContextResult Class

Context Management

Agent context management and compaction

Code Agent

Code generation and analysis agents