Skip to main content

agent-coderag

agent-coderag Logo

The API Knowledge Bridge for AI Coding Agents.
Local, fast, and token-efficient semantic search that eliminates LLM hallucinations by providing real-time local context.

Build Status PyPI Version License Test Coverage

FeaturesQuick StartArchitectureAI Agent GuideContributing


Why agent-coderag?

In 2026, AI coding agents are limited by stale training data. They hallucinate library calls because they don't know your specific environment.

  • The Pain: Your agent writes code for Pydantic v1 while you have v2 installed. You waste 5000+ tokens in a "Fail-Fix-Fail" loop.
  • The Cure: agent-coderag extracts live API signatures and technical intent from your local environment. It feeds the LLM exactly what it needs to see—no more, no less.

Key Features

  • Instant Startup: Built on onnxruntime and Rust-based tokenizers. Zero PyTorch overhead.
  • Context Compression: Replace 10,000 lines of raw code with a 200-token semantic summary.
  • Universal Tree-Sitter Parser: Supports 25+ languages (Python, JS/TS, Rust, Java, C++, Go, Ruby, etc.) with high precision.
  • API Discovery: On-the-fly extraction of public signatures for 6 core ecosystems (Python, Java, Go, TypeScript, Rust, C#) with build-system awareness.
  • Local First: All embeddings and data stay on your machine in a high-performance DuckDB VSS index.

Quick Start

Installation

pip install agent-coderag
# Install tree-sitter grammars for your languages on-demand
pip install tree-sitter-python tree-sitter-javascript

Initial Setup

# Download pre-trained multilingual embedding models (~130MB)
agent-coderag setup

# (Optional) Connect your preferred LLM for semantic distillation
# Using Ollama (Local)
agent-coderag config --url "http://localhost:11434" --provider "ollama" --model "qwen2.5-coder"

# Using OpenAI-compatible API (e.g. Groq, OpenRouter, DeepSeek)
agent-coderag config --url "https://api.deepseek.com" --key "your-api-key" --model "deepseek-chat"

Offline Mode (No Provider)

If you don't configure an LLM provider, agent-coderag works in 100% Offline Mode:

  • Parsing & API Discovery: Still works perfectly using local Tree-Sitter grammars and javap.
  • Search: Remains fast and accurate.
  • Distillation: Instead of AI-generated summaries, the system uses code signatures and entity names as fallback metadata. No data ever leaves your machine.

First Sync & Search

# Index your entire project (respects .gitignore automatically)
agent-coderag sync --all

# Trusted Maven/Gradle projects only: allow dependency resolution
agent-coderag sync --all --allow-build-execution

# Perform a semantic search
agent-coderag search "how does the authentication middleware work?"

Dependency build execution is disabled by default. Maven and Gradle build files can execute repository-controlled code, so use --allow-build-execution only after you have reviewed and trust the project.

API Discovery

Verify external library signatures without leaving the CLI:

# Explicit language selection (Recommended for multi-language repos)
agent-coderag api requests --lang python
agent-coderag api lodash --lang typescript
agent-coderag api serde --lang rust

# Built-in auto-detection for common project types (Cargo.toml, package.json, etc.)
agent-coderag api fmt

Supported Ecosystems (Discovery)

Language Method Discovery Source
Python 3-Stage Probe .pyi stubs, static source, or runtime inspect
Java Bytecode Reflection JARs resolved via Maven or Gradle with explicit --allow-build-execution opt-in
Go Standard Tooling Native go doc -all integration
TypeScript/JS Declaration Maps .d.ts files from node_modules or @types
Rust Registry Analysis Source code from Cargo registry via cargo metadata
C# Assembly Metadata DLL metadata via dnfile and XML documentation

How It Works

agent-coderag creates a semantic map of your codebase using a multi-stage pipeline:

graph LR
    Code[Local Codebase] --> Parser[Multi-Language Parser]
    Parser --> Delta[Delta-Sync SHA-256]
    Delta -- New/Changed --> Distill[LLM Distiller]
    Delta -- Unchanged --> Cache[Local Cache]
    Distill --> Embed[ONNX Embedder]
    Cache --> Embed
    Embed --> DuckDB[(DuckDB VSS)]
    DuckDB --> Agent[AI Agent Response]
  1. Structural Parsing: Identifies classes, methods, and relations (imports).
  2. Technical Distillation: Generates a concise "intent summary" of each code unit.
  3. Vectorization: Local ONNX model creates 384-dimensional embeddings.
  4. VSS Storage: DuckDB enables sub-millisecond similarity search.

Agent-Native Usage

agent-coderag is designed to be the primary tool for your AI agents.

The Protocol:

  1. Search First: Instead of reading files, the agent runs agent-coderag --json search.
  2. Verify Signatures: The agent runs agent-coderag api to get real signatures.
  3. Read Summaries: The agent uses the summary field to decide which files are actually relevant.

Programmatic Output:

agent-coderag --json search "database init" --limit 1

Development & Testing

We maintain a strict quality bar.

# Install development dependencies
make install

# Run full test suite with coverage
make test

# Run linters (Prospector, MyPy, Bandit)
make lint

Contributing

Contributions make the open source community an amazing place to learn, inspire, and create.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'feat: add AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

🔝 Back to top

Built for agents. Driven by humans.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_coderag-1.3.2.tar.gz (48.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_coderag-1.3.2-py3-none-any.whl (43.7 kB view details)

Uploaded Python 3

File details

Details for the file agent_coderag-1.3.2.tar.gz.

File metadata

  • Download URL: agent_coderag-1.3.2.tar.gz
  • Upload date:
  • Size: 48.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agent_coderag-1.3.2.tar.gz
Algorithm Hash digest
SHA256 039e876b772b0048e67b8a777c7d8346bc24f4b76275c6b459687e7f65d511af
MD5 2aa9dee11cddf1a4b8cc984c45c9f3c3
BLAKE2b-256 2583c5618f1491388152f10cc64b77ff6b31b5a746820ef04bdbb67ce3e2fc7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_coderag-1.3.2.tar.gz:

Publisher: release.yml on naranor/agent-coderag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_coderag-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: agent_coderag-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 43.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agent_coderag-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb5229ca9a52e3cd405920719c7e2dc3ded848394ae102084da797034110d736
MD5 4f1b504f742060bd82962d4c4bbab2b5
BLAKE2b-256 97a0673be2a84c902aeb0066140851bde91ea83295038bedd4c6f9760670a871

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_coderag-1.3.2-py3-none-any.whl:

Publisher: release.yml on naranor/agent-coderag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.3.2 This release

2 files

1.3.1

2 files

1.3.0

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page