grepsearch
Index-free, grep-based retrieval primitives for AI agent tool loops. The engine is the ripgrep search core, compiled into a native Python extension, so every query runs at Rust speed with no subprocess overhead and no index to build or sync.
Grep-based retrieval works by running search tools in a reasoning loop instead of pre-embedding a corpus into a vector index. Every query reads the live filesystem, so results are never stale. This package provides the search side of that loop; your agent framework provides the reasoning.
Installation
pip install grepsearch
Prebuilt wheels cover Linux (x86_64, aarch64), macOS (Apple silicon, Intel), and Windows (x64) for Python 3.9 and newer.
Usage
from grepsearch import SearchEngine
engine = SearchEngine("path/to/repo")
# Content search with budgets sized for a context window
result = engine.grep(
"fn authenticate",
literal=True,
context_after=5,
max_results=40,
max_bytes=32_000,
)
for file in result.files:
for match in file.matches:
print(f"{file.path}:{match.line_number}: {match.line}")
# The result serializes straight into a tool output for a model
tool_output = result.to_json()
# Follow up around a promising hit
piece = engine.read_lines("src/auth.rs", 40, 80)
# Orient in the repository
for entry in engine.list_dir(".", max_depth=2):
print(entry.path)
# Find files by name
hits = engine.find_files("**/*.toml")
Every grep result carries a truncated flag. When a budget cap stops the search early, the flag tells the caller that more matches may exist, which prevents an agent from mistaking a capped result for a complete one.
Behavior
- Gitignore, ignore, and hidden file rules are honored by default; disable per engine with
respect_gitignore=Falseorinclude_hidden=True - Binary files are detected and skipped
- Searches run in parallel across files and release the interpreter lock while running
- Result ordering is deterministic: files with more matches first, then shallower paths, then lexicographic
- Errors map to familiar Python exceptions:
ValueErrorfor bad patterns, globs, and line ranges;FileNotFoundErrorfor missing paths
Rust
The same engine ships as a Rust crate for agents and CLIs built in Rust: https://crates.io/crates/grepsearch
License
MIT
Release files for grepsearch 0.1.54
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| grepsearch-0.1.54.tar.gz | 27.9 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| grepsearch-0.1.54-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| grepsearch-0.1.54-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| grepsearch-0.1.54-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| grepsearch-0.1.54-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
| grepsearch-0.1.54-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 7.3 MB
Release files / grepsearch-0.1.54.tar.gz
| Download URL | grepsearch-0.1.54.tar.gz |
|---|---|
| Size | 27.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a7eb4760b023fbb0029975fab16903df645f7a062bfb7847e63c147d512c349
|
|
BLAKE2b-256 checksum How to use checksums |
368e3192bc080e4bd12b764c25057dcf433268d48390681dcb9fc91ef82922fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.
Transparency logRelease files / grepsearch-0.1.54-cp39-abi3-win_amd64.whl
| Download URL | grepsearch-0.1.54-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b72c840452f0aee97c3467d057638e3db09b6386fbbe2563bf3ef197020eeab6
|
|
BLAKE2b-256 checksum How to use checksums |
2e0feafeeeec4486476396931ad283fe0492da17f09e4ba2434de5228948c3e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.
Transparency logRelease files / grepsearch-0.1.54-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | grepsearch-0.1.54-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
35cff4694abc8cdc87e6d82e006f7a310b376dd85606d654f1af96b53900b11a
|
|
BLAKE2b-256 checksum How to use checksums |
51eb79a22a8cb60246de0bd2c8dd68282931cba7c885d7bbf7ee2846d5025c85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.
Transparency logRelease files / grepsearch-0.1.54-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | grepsearch-0.1.54-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
70cf7bc37067a9cc545e43538972d04047a444042c8f11f19aa22f00639f5f89
|
|
BLAKE2b-256 checksum How to use checksums |
180510853d03b34e079471254f6d46e76324a66909dce2abdfff627f97e0e1f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.
Transparency logRelease files / grepsearch-0.1.54-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | grepsearch-0.1.54-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4cc145b056389237315019129609903b58e8c8a52418faa014407b9aed17b9aa
|
|
BLAKE2b-256 checksum How to use checksums |
7a0a471c8094c7aa5c1a4a992f953741b8601208e26fcb0eaa0dc6fde07cd6a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.
Transparency logRelease files / grepsearch-0.1.54-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | grepsearch-0.1.54-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
29e0a72b93f22a69d26dce377814c7a60fdc24bc85c5e8036acc1ea47933948b
|
|
BLAKE2b-256 checksum How to use checksums |
35c3f611444648726a28096d4ac0570be3de1933eeac2986699bc08c513c1ff9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.
Transparency log