Modular LangGraph-powered agentic brain for multi-source knowledge orchestration and RAG
Project description
ContextRouter
⚠️ Early Version: This is an early version of ContextRouter. Documentation is actively being developed, and the API may change.
What is ContextRouter?
ContextRouter is a modular framework for building intelligent AI agents based on LangGraph. It acts as a "shared brain" that can handle complex tasks by combining information retrieval, text generation, and tool execution.
Unlike simple chatbots, ContextRouter can perform multi-step tasks: analyze queries, search for relevant information, apply logic, and provide structured responses.
What is it for?
ContextRouter is designed for developers and companies who want to:
- Build complex AI agents — from simple Q&A systems to sophisticated workflows
- Integrate RAG (Retrieval-Augmented Generation) — search and generate responses based on your data
- Create platform-independent solutions — works with web, Telegram, API, or any other platform
- Ensure security and traceability — every piece of data has a provenance history
Typical use cases:
- Corporate chatbots with knowledge bases
- AI assistants for document analysis
- Search-based recommendation systems
- Intelligent agents for business process automation
Key Features
- 🧩 Fully Modular — swap any component: LLM models, data stores, connectors, agents, and even entire processing graphs
- 🧠 Intelligent Orchestration — sophisticated state management and conditional routing based on LangGraph
- 🛡️ Security and Tracing — built-in Bisquit protocol for tracking data provenance
- 📡 Streaming-Oriented — optimized for real-time and event-driven interfaces
- 🌍 Flexible Data Sources — support for various storage solutions: Vertex AI Search, upcoming Postgres and local models support
- 🔧 Extensible by Design — build custom agents, processing graphs, and integrations without touching core code
Modules Overview
ContextRouter's architecture is built around specialized modules:
modules/providers/— Data storage implementations (Vertex AI Search, Postgres, GCS)modules/connectors/— Raw data fetchers (Web search, RSS feeds, APIs, local files)modules/ingestion/— Data ingestion pipelines (ETL, indexing, RAG processing, deployment)modules/retrieval/— Search and RAG orchestration (pipelines, reranking, formatting)modules/models/— LLM and embedding model abstractions (Gemini, GPT, local models)modules/protocols/— Platform adapters (AG-UI events, A2A/A2UI protocols)
RAG Capabilities
ContextRouter provides a complete RAG (Retrieval-Augmented Generation) pipeline powered by Vertex AI and Gemini:
Ingestion Pipeline
- Supported Content Types: Books, articles, videos, Q&A pairs, web content, and custom structured data
- Taxonomy & Ontology: Automatic categorization and relationship mapping using AI-powered taxonomy builders
- Knowledge Graph: Semantic relationships and entity connections between ingested content
- Citation System: Precise source attribution with page numbers, timestamps, and context preservation
Retrieval & Generation
- Multi-stage Retrieval: Initial search → reranking → context assembly
- Citation Formatting: Rich citations with source verification and confidence scores
- Streaming Responses: Real-time generation with source citations and reasoning traces
Vertex AI + Gemini Integration
The RAG system runs on Google Cloud's Vertex AI Search for scalable vector storage and Gemini models for intelligent processing, ensuring enterprise-grade performance and security.
Quick RAG Implementation
Build a production-ready RAG system in hours, not months. For custom integrations, enterprise deployments, or specialized RAG solutions, visit contextrouter.dev to discuss your requirements.
Roadmap
We're actively developing ContextRouter with focus on expanding data source support and improving developer experience:
Near-term priorities:
- PostgreSQL Integration — native support for Postgres with pgvector for knowledge storage
- Cognee Memory Integration — advanced memory and knowledge graph capabilities
- Local Model Support — run AI models locally without cloud dependencies
- Plugin System & Library — comprehensive plugin architecture for extending functionality
Quick Start
from contextrouter.cortex import stream_agent
# Initialize the shared brain
async for event in stream_agent(
messages=[{"role": "user", "content": "How does RAG work?"}],
session_id="session_123",
platform="web",
style_prompt="Be concise and technical."
):
print(event)
For more examples, see the examples/ directory.
Getting Started
-
Install ContextRouter:
pip install contextrouter # For full functionality (recommended): pip install contextrouter[vertex,storage,ingestion] # Observability (optional): pip install contextrouter[observability]
-
Configure your data sources and LLM models
-
Build your first agent using the examples above
-
Deploy to your preferred platform (web, API, Telegram, etc.)
Notes (Vertex / Gemini)
- Vertex AI mode: ContextRouter sets
GOOGLE_GENAI_USE_VERTEXAI=trueby default to avoid the Google GenAI SDK accidentally trying API-key auth. You can override it by exportingGOOGLE_GENAI_USE_VERTEXAI=falsebefore importing/starting ContextRouter.
Documentation
- Full Documentation — complete guides and API reference
- Examples Directory — working code samples
- Contributing Guide — how to contribute to the project
Contributing
We welcome contributions! ContextRouter maintains strict coding standards with emphasis on:
- Security First — All contributions undergo security review and automated scanning
- Code Quality — Comprehensive linting, type checking, and automated testing
- Clean Architecture — Clear separation between business logic, infrastructure, and data layers
- Type Safety — Strict typing throughout the codebase with mypy validation
See our Contributing Guide for detailed guidelines and current development priorities.
License
This project is licensed under the terms specified in LICENSE.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file contextrouter-0.11.1.tar.gz.
File metadata
- Download URL: contextrouter-0.11.1.tar.gz
- Upload date:
- Size: 505.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99741afb74eaa2c1285d5023fdb307c4980c4b662b5a445a9bdab53976338908
|
|
| MD5 |
d08f4230bf9bf88b733fb5a4cd2c93a6
|
|
| BLAKE2b-256 |
415122f8e85b2a3f83092306cad9252eecb2d2c2a75e44ab71465f7f704b7656
|
Provenance
The following attestation bundles were made for contextrouter-0.11.1.tar.gz:
Publisher:
publish.yml on ContextRouter/contextrouter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextrouter-0.11.1.tar.gz -
Subject digest:
99741afb74eaa2c1285d5023fdb307c4980c4b662b5a445a9bdab53976338908 - Sigstore transparency entry: 835851274
- Sigstore integration time:
-
Permalink:
ContextRouter/contextrouter@4e7eb2ae1fa032474df5d6a596cee04039c7314f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ContextRouter
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4e7eb2ae1fa032474df5d6a596cee04039c7314f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file contextrouter-0.11.1-py3-none-any.whl.
File metadata
- Download URL: contextrouter-0.11.1-py3-none-any.whl
- Upload date:
- Size: 393.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29b6107ea4fdf86cc56a033c8330dcdeb77280e20f5eea697bb9959a0ed3a14e
|
|
| MD5 |
ed16a4a7a770fbe0c352aceee79d5412
|
|
| BLAKE2b-256 |
c0d57e23c472fe96fad0a89448da86275aa2400ae6d01bd219e7e116629ea82d
|
Provenance
The following attestation bundles were made for contextrouter-0.11.1-py3-none-any.whl:
Publisher:
publish.yml on ContextRouter/contextrouter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextrouter-0.11.1-py3-none-any.whl -
Subject digest:
29b6107ea4fdf86cc56a033c8330dcdeb77280e20f5eea697bb9959a0ed3a14e - Sigstore transparency entry: 835851277
- Sigstore integration time:
-
Permalink:
ContextRouter/contextrouter@4e7eb2ae1fa032474df5d6a596cee04039c7314f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ContextRouter
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4e7eb2ae1fa032474df5d6a596cee04039c7314f -
Trigger Event:
workflow_dispatch
-
Statement type: