Skip to main content

Lightweight semantic code search and distillation utility for AI coding agents. It solves the API knowledge gap via real-time local signature extraction and intent analysis without PyTorch. Optimized for token efficiency, it compresses codebase context into compact semantic summaries stored in a local DuckDB vector similarity index.

Project description

Agent-CodeRAG

Agent-CodeRAG Banner

Fast. Local. Agent-First. Token-Efficient. Bridge the gap between AI coding agents and your local environment.

Python 3.10+ License: MIT PyPI Version Downloads Tests Coverage


Table of Contents


Why Agent-CodeRAG?

AI coding agents often hallucinate when calling library APIs because their training data is static. This leads to a "Fail-Fix-Fail" cycle — broken code, token waste, and frustration.

The Problem: Your agent knows Pydantic v1 (model.dict()), but your environment uses v2 (model.model_dump()). Result: 5000+ wasted tokens trying to "fix" something it doesn't understand.

The Solution: Agent-CodeRAG extracts actual API signatures from your installed libraries and provides the LLM with real-time, environment-specific context — saving up to 80% of context window tokens.

🔝 Back to top


Quick Start

# 1. Install
pip install agent-coderag

# 2. Setup (download ONNX model)
agent-coderag setup

# 3. Configure LLM (optional, for AI distillation)
agent-coderag config --url "http://localhost:11434" --provider "ollama" --model "qwen2.5-coder:7b"

# 4. Index your project
agent-coderag sync --all

# 5. Search
agent-coderag search "how to handle errors"

Docker:

docker build -t agent-coderag .
docker run -v ~/.cache/agent-coderag:/root/.cache/agent-coderag agent-coderag setup

🔝 Back to top


✨ Features

  • ⚡ No PyTorch — Uses onnxruntime and tokenizers (Rust) for instant startup
  • 💾 DuckDB VSS — High-performance vector search in a single local file
  • 🏗️ Multi-Language — Native indexing for Python (AST) and Java (javalang)
  • 🔄 Delta-Sync — SHA-256 hashing re-distills only changed code
  • 🔌 Hybrid Intelligence — Works offline; adds AI-distilled reasoning when LLM is connected
  • 📡 API Discovery — Extract live API signatures from Python modules or Java JARs

🔝 Back to top


🛠 How It Works

graph TD
    A[Local Python Code] --> B[AST Parser]
    B --> C{Delta-Sync}
    C -- Changed/New --> D[LLM Distiller]
    C -- Unchanged --> E[Local Cache]
    D --> F[Semantic Summary]
    E --> F
    F --> G[ONNX Embedder]
    G --> H[(DuckDB VSS)]
    H --> I[Semantic Search / JSON API]
  1. AST Parser — Parses your Python code
  2. Delta-Sync — Uses SHA-256 to detect changes
  3. LLM Distiller — Generates semantic summaries (optional)
  4. ONNX Embedder — Creates embeddings locally
  5. DuckDB VSS — Stores vectors for fast similarity search

🔝 Back to top


📡 API Discovery

agent-coderag api pydantic

Returns the live public API, methods, and signatures for any installed library.

🔝 Back to top


🤖 For AI Agents

Agent-CodeRAG is built for programmatic consumption:

  1. Search First: agent-coderag --json search "topic" --limit 1
  2. Use Intent: The summary field provides technical intent — skip reading unnecessary files

🔝 Back to top


🔧 Development

# Run tests
pytest tests/
pytest e2e_tests/

# Setup pre-commit hooks
pip install pre-commit
pre-commit install

🔝 Back to top


🤝 Contributing

Contributions are welcome! Here's how to get started:

  1. Fork the repository
  2. Clone your fork: git clone https://github.com/YOUR_USERNAME/agent-coderag.git
  3. Create a branch: git checkout -b feature/your-feature
  4. Make changes and commit with Conventional Commits
  5. Run tests: pytest tests/
  6. Push to your fork and create a Pull Request

See CONTRIBUTING.md for detailed guidelines.

🔝 Back to top


📄 License

MIT © 2026 Igor Boloban

🔝 Back to top

Project details


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.2.1.tar.gz (24.8 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.2.1-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_coderag-1.2.1.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agent_coderag-1.2.1.tar.gz
Algorithm Hash digest
SHA256 c8b042908dfba28965dfce9064596143aa95d8316f9ca96c3d187a46a7969226
MD5 3bb9e03cf9afa7a570515e5bd454183a
BLAKE2b-256 f3e379dcb715b08c84e0aa325ef051ac935fb63b291daf947904747bb17d95b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_coderag-1.2.1.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.2.1-py3-none-any.whl.

File metadata

  • Download URL: agent_coderag-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agent_coderag-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b9a86c2ac85ed4da74fabc27f220cd941bb08013f56ed9915ae530ec571eee5
MD5 0efc18149ff6dcdee9a40dc4670789d8
BLAKE2b-256 4fdb81decc6c4777191fa69869f974a54f0070c588791acd2ab45fef990905af

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_coderag-1.2.1-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.

Supported by

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