Skip to main content

grag

Fast grep-based document search for LLM agents. No embeddings, just speed.

PyPI version Python versions License: MIT

Why grag?

  • 10x faster than embeddings-based search for exact matches
  • Zero cost - no API calls, no vector databases
  • Precise - finds exact terms, not "similar" content
  • Lightweight - minimal dependencies
  • LLM-ready - returns context windows perfect for prompts

Quick Start

pip install grag
from grag import Grag

# Index your documents
store = Grag("./contracts")

# Search with context
results = store.search("late payment penalty", context_chars=500)

# Use in LLM prompt
for result in results:
    print(result.format_for_llm())

Supported Formats

  • PDF
  • DOCX (Word)
  • XLSX (Excel)
  • CSV
  • TXT
  • Markdown (.md, .markdown)

When to use grag vs RAG

Use grag for:

  • Exact term matching (IDs, dates, specific clauses)
  • Legal/medical documents with precise terminology
  • Cost-sensitive applications
  • Low-latency requirements

Use RAG for:

  • Semantic similarity
  • Multi-lingual fuzzy matching
  • Conceptual queries

Or use both: grag first for exact matches, RAG as fallback.

Development Status

v0.1.0 — Alpha release. The API is functional and tested. Feedback welcome.

Contributing

Contributions welcome. Open an issue or PR on GitHub.

License

MIT License - see LICENSE file for details.

Author

Built by Alan Sepulveda for Teral and the open source community.

Metadata

Release files for grag-search 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grag-search 0.1.0
File Size Uploaded Provenance
grag_search-0.1.0.tar.gz 25.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for grag-search 0.1.0
File Interpreter ABI Platform
grag_search-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 50.6 kB

Release files / grag_search-0.1.0.tar.gz

Download URL grag_search-0.1.0.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
331661b7cd2ff8b20808aa009b86e347199991ee656e739a50527141c16db82f
BLAKE2b-256 checksum
How to use checksums
7eeb660a27eee3cb65b80a6b5f37f0b84b520fa09adda2ae05461c7c04354099
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 29, 2026.

Transparency log

Release files / grag_search-0.1.0-py3-none-any.whl

Download URL grag_search-0.1.0-py3-none-any.whl
Size 25.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b277112f6c30895f5a23633c765f35d1eda777da4d95e98245a339ee83cd82d
BLAKE2b-256 checksum
How to use checksums
6242a7765af47356b65b96196015012d29ba711625d5a2b915d52b9e11045d24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 29, 2026.

Transparency log

Security for grag-search 0.1.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for grag_search-0.1.0.tar.gz

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 Apr 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page