A lightweight, modular, zero-bloat foundation framework for RAG, MCP servers, and modern AI workflows.
pip install ai-rag-common-framework==0.19.10
A lightweight, modular, zero-bloat foundation framework for building RAG systems, Model Context Protocol (MCP) servers, autonomous multi-agent workflows, and production AI microservices.
A lightweight, modular, zero-bloat foundation framework for building RAG systems, Model Context Protocol (MCP) servers, autonomous multi-agent workflows, and production AI microservices.
π Overview & Current Status: v0.19.10 (SLA Benchmark Performance Optimization & P2 Audit Remediation)
AI RAG Common Framework is engineered as a clean, idiomatic, and dependency-light standard library for modern AI engineering. It replaces sprawling, over-engineered stacks with composable, typed primitives that work seamlessly across asynchronous coroutines and synchronous pipelines.
π Core Architectural Pillars
Agnostic LLM Engine & Enterprise Resilience: Unified asynchronous LLM client supporting Google Gemini, OpenAI, Anthropic, Ollama, DeepSeek, Groq, and vLLM. FallbackLLMClient : Automatic circuit-breaking failover across prioritized provider chains. Real-time Server-Sent Events (SSE) token streaming ( complete_stream() ). SemanticCache : Sub-millisecond similarity caching with LRU eviction and TTL invalidation. Native Pydantic Structured Outputs with schema validation.
Agnostic LLM Engine & Enterprise Resilience:
Unified asynchronous LLM client supporting Google Gemini, OpenAI, Anthropic, Ollama, DeepSeek, Groq, and vLLM.
FallbackLLMClient : Automatic circuit-breaking failover across prioritized provider chains.
Real-time Server-Sent Events (SSE) token streaming ( complete_stream() ).
SemanticCache : Sub-millisecond similarity caching with LRU eviction and TTL invalidation.
Native Pydantic Structured Outputs with schema validation.
Advanced RAG & Embedded Vector Persistence: RAGEngine : End-to-end orchestration of chunking, vectorization, hybrid retrieval, and generation. SQLiteVectorStore : ACID-compliant, single-file embedded vector store using Python's standard library sqlite3 and FTS5 full-text indexing (no external database daemon required). InMemoryVectorStore : High-performance pure-Python vector store with BLAS GEMV acceleration. Hybrid : Native Okapi BM25 sparse matching fused with dense vector similarity via Reciprocal Rank Fusion (RRF). Algorithmic Retrieval Strategies: Parallel MultiQueryStrategy expansion and Hypothetical Document Embeddings ( HyDEStrategy ). Two-Stage Reranking: LocalCrossEncoderReranker and CohereReranker pipeline stages.
Advanced RAG & Embedded Vector Persistence:
RAGEngine : End-to-end orchestration of chunking, vectorization, hybrid retrieval, and generation.
SQLiteVectorStore : ACID-compliant, single-file embedded vector store using Python's standard library sqlite3 and FTS5 full-text indexing (no external database daemon required).
InMemoryVectorStore : High-performance pure-Python vector store with BLAS GEMV acceleration.
Hybrid : Native Okapi BM25 sparse matching fused with dense vector similarity via Reciprocal Rank Fusion (RRF).
Algorithmic Retrieval Strategies: Parallel MultiQueryStrategy expansion and Hypothetical Document Embeddings ( HyDEStrategy ).
Two-Stage Reranking: LocalCrossEncoderReranker and CohereReranker pipeline stages.
Autonomous Agents & Stateful Workflow Orchestration: ReActAgent : Autonomous thought-action-observation reasoning loop with iteration limits. AgentSupervisor : Orchestrator-Workers hierarchy routing subtasks to specialized agents with a shared AgentBus state bus. StateGraph : Stateful directed graph execution engine supporting cyclic and acyclic workflow topologies, conditional branching, execution history, and state checkpointing. ConversationBufferMemory and VectorMemory for contextual recall. Human-in-the-Loop (HITL) approval hooks for sensitive tool execution.
Autonomous Agents & Stateful Workflow Orchestration:
ReActAgent : Autonomous thought-action-observation reasoning loop with iteration limits.
AgentSupervisor : Orchestrator-Workers hierarchy routing subtasks to specialized agents with a shared AgentBus state bus.
StateGraph : Stateful directed graph execution engine supporting cyclic and acyclic workflow topologies, conditional branching, execution history, and state checkpointing.
ConversationBufferMemory and VectorMemory for contextual recall.
Human-in-the-Loop (HITL) approval hooks for sensitive tool execution.
Universal Tooling & Model Context Protocol (MCP 2.x): Universal @tool decorator generating standard JSON schemas via Pydantic introspection. FrameworkMCPServer : Full MCP 2.x server adapter supporting Tools, Resources, and Prompts over stdio and SSE transports. FrameworkMCPClient : Bidirectional MCP client dynamically discovering and mounting remote tools into local agent registries. Single-line export: Any RAG pipeline or interpreter can be converted into an MCP tool via as_tool() .
Universal Tooling & Model Context Protocol (MCP 2.x):
Universal @tool decorator generating standard JSON schemas via Pydantic introspection.
FrameworkMCPServer : Full MCP 2.x server adapter supporting Tools, Resources, and Prompts over stdio and SSE transports.
FrameworkMCPClient : Bidirectional MCP client dynamically discovering and mounting remote tools into local agent registries.
Single-line export: Any RAG pipeline or interpreter can be converted into an MCP tool via as_tool() .
Security, Guardrails & Ephemeral Sandboxing: CodeInterpreter : Secure Python code sandbox running in isolated subprocesses with ephemeral directories, secret scrubbing, and execution timeouts. PromptGuardrail : Fast regex and heuristic detection of prompt injections, jailbreaks, and system prompt override attempts. PIISanitizer : High-throughput redacting and masking of sensitive personal data (emails, credit cards, SSNs, API keys). Strict SSRF validation and path traversal guards across all filesystem persistence.
Security, Guardrails & Ephemeral Sandboxing:
CodeInterpreter : Secure Python code sandbox running in isolated subprocesses with ephemeral directories, secret scrubbing, and execution timeouts.
PromptGuardrail : Fast regex and heuristic detection of prompt injections, jailbreaks, and system prompt override attempts.
PIISanitizer : High-throughput redacting and masking of sensitive personal data (emails, credit cards, SSNs, API keys).
Strict SSRF validation and path traversal guards across all filesystem persistence.
Observability, Telemetry & Quality Evaluation: TokenCostTracker : Granular dollar accounting tracking prompt and completion tokens across providers. PrometheusRegistry : Zero-dependency metrics router exposing /metrics in standard Prometheus text format. Distributed OpenTelemetry Tracing: W3C traceparent context propagation and trace_span context managers. RAGTriadEvaluator : In-process evaluation of Context Relevance, Groundedness (Faithfulness), and Answer Relevance. HallucinationDetector : Sentence-level grounding confidence scoring without third-party LLM evaluation dependencies.
Observability, Telemetry & Quality Evaluation:
TokenCostTracker : Granular dollar accounting tracking prompt and completion tokens across providers.
PrometheusRegistry : Zero-dependency metrics router exposing /metrics in standard Prometheus text format.
Distributed OpenTelemetry Tracing: W3C traceparent context propagation and trace_span context managers.
RAGTriadEvaluator : In-process evaluation of Context Relevance, Groundedness (Faithfulness), and Answer Relevance.
HallucinationDetector : Sentence-level grounding confidence scoring without third-party LLM evaluation dependencies.
Developer CLI & Interactive Playground: Unified CLI console command: ai-rag and rag-mcp . ai-rag doctor : Comprehensive diagnostic utility checking Python version, API keys, Ollama reachability, and directory permissions. ai-rag repl : Interactive terminal playground for testing prompts, running tools, ingesting documents, and executing RAG queries live. ai-rag init : Production microservice scaffolding generator.
Developer CLI & Interactive Playground:
Unified CLI console command: ai-rag and rag-mcp .
ai-rag doctor : Comprehensive diagnostic utility checking Python version, API keys, Ollama reachability, and directory permissions.
ai-rag repl : Interactive terminal playground for testing prompts, running tools, ingesting documents, and executing RAG queries live.
ai-rag init : Production microservice scaffolding generator.
From PyPI (Standard Release)
Install with optional feature bundles:
Local Development Installation
Clone the repository and install in editable mode:
π οΈ Quick Configuration
Create a .env file in your project root (refer to .env.example ):
1. Unified LLM with Structured Outputs & Model Fallbacks
2. Embedded SQLite Vector Store with FTS5 Hybrid
3. Multi-Agent Supervisor & Delegation Pattern
4. Stateful Directed Graph Workflow ( StateGraph )
5. Sandboxed Python Code Interpreter
6. Production FastAPI Microservice with RAG & Authenticated MCP
7. Unified Framework CLI
The package provides the ai-rag command-line interface out of the box:
π§ͺ Running Tests & Quality Verification
The test harness executes 331 tests (100% passing) with 91% global line coverage :
312 unit and regression tests across 29 focused test modules in tests/
19 enterprise end-to-end integration tests across 5 test suites in examples/enterprise/
π Documentation & Roadmap
CHANGELOG.md : Complete release history, Pull Request notes, and breaking changes.
RELEASE.md : Gitflow release process, tagging schemes, and tag-by-tag release notes.
ROADMAP.md : Release train progression and future architectural milestones.
This project is licensed under the MIT License .
Release files for ai-rag-common-framework 0.19.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation .
Source distribution (sdist)
Built distribution (wheel)
Total release size: 422.4 kB
Release files / ai_rag_common_framework-0.19.10.tar.gz
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 Nov 26, 2026.
Release files / ai_rag_common_framework-0.19.10-py3-none-any.whl
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 Nov 26, 2026.
Security for ai-rag-common-framework 0.19.10
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.
Both files in this release have been uploaded with provenance metadata.
Attestation for ai_rag_common_framework-0.19.10.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 Nov 26, 2026.
Attestation for ai_rag_common_framework-0.19.10-py3-none-any.whl
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 Nov 26, 2026.
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.
Release history Release notifications | RSS feed
Nov 26, 2026 2 release files Full provenance
Nov 23, 2026 2 release files Full provenance
Nov 20, 2026 2 release files Full provenance
Nov 16, 2026 2 release files Full provenance
The full story
This article is one source in a clustered incident β the cluster page carries the summary, timeline and every other outlet covering it.
