Repository navigation
en Home
Rael Corrales edited this page Nov 17, 2026
·
1 revision
Welcome to the Official Architecture, Implementation, and Best Practices Wiki for ai-rag-common-framework.
This wiki is engineered as a definitive technical source of truth to empower developers and architects to implement production-grade generative AI systems at 100% capacity: from junior developers writing their first RAG pipeline to Staff and Principal Engineers designing mission-critical distributed AI platforms.
flowchart TD
Goal["What is your primary goal?"]
Goal --> GettingStarted["Getting Started<br/><b>From Zero to Production</b>"]
Goal --> Senior["Senior Pathway<br/><b>Architecture, Agents & APIs</b>"]
Goal --> Staff["Staff Pathway<br/><b>Distributed Systems & FinOps</b>"]
GettingStarted --> G1["• Quickstart (15 lines)<br/>• Setup & Environments (.env)<br/>• CLI (Doctor & REPL)<br/>• Glossary & Mental Models"]
Senior --> S1["• FastAPI Gateway & Routes<br/>• Dual Memory in Agents<br/>• Namespaces & Multi-Tenancy<br/>• Testing & CI/CD ($0 APIs)"]
Staff --> St1["• Latency Budgets (p95)<br/>• W3C OpenTelemetry Tracing<br/>• FinOps & Token Cost Tracking<br/>• Production Runbook & Triage"]
- Quickstart: Your First RAG in 15 Lines: Build a fully functional, embedded RAG pipeline in minutes with zero database daemons.
-
Installation, Configuration, and Environments: Modular feature bundles (
[api],[mcp],[rag],[all]), environment variables, and settings precedence. -
CLI Interactive Guide and Playground: Master environment diagnostics with
doctor, live terminal prototyping withrepl, and scaffolding withinit. - Key Concepts, Glossary, and Mental Models: Tokens, Embeddings, BM25, Cosine Similarity, RRF, Cross-Encoders, and the RAG Triad formally explained.
- System Philosophy and Hexagonal Architecture: Clean Architecture, Zero-Bloat design, and Architectural Trade-off Matrix.
- Design Patterns in RAG and Agents: Factory, Strategy, Circuit Breaker, Proxy, Interceptor, and State Machine patterns.
- Data Anatomy and Lifecycle: Dual ingestion (FTS5 + Dense Vectors), GEMV BLAS, WAL concurrency, and online query lifecycle.
- Multi-Agent Systems and Orchestration Topologies: ReAct, Supervisor-Workers, deterministic StateGraph, and mitigation of agent failure modes.
- LLM Engine, Resilience, and Semantic Caching: Automatic failover, Structured Outputs, and Sub-millisecond Semantic Cache.
- Advanced RAG, Hybrid Search, and Reranking: Okapi BM25 + Dense Vectors fused via RRF, HyDE, MultiQuery, and Cross-Encoders.
-
Autonomous Agents and StateGraph: ReAct loops,
AgentBus, cyclic state machines, and Human-in-the-Loop (HITL) hooks. -
Model Context Protocol (MCP 2.x): Servers and Clients over
stdioandSSE, dynamic tool mounting, andas_tool(). -
Security, Guardrails, and Sandboxing: Ephemeral
CodeInterpretersandbox, PII sanitization, and Prompt Injection mitigation. -
FastAPI API Gateway and Routes: Production HTTP microservice, endpoints
/query,/retrieve,/ingest, SSE streaming, and MCP auth. -
Conversational and Vector Memory: Short-term buffer preserving system prompts and long-term semantic
VectorMemory. - Collections and Multi-Tenancy: Logical partitioning with namespaces in SQLite vs physical multi-database isolation.
-
Deterministic Testing, Mocking, and CI/CD ($0 APIs): Offline unit tests with
MockEmbeddingProvider, pytest fixtures, and GitHub Actions. - Migration Guide from LangChain and LlamaIndex: Direct class mapping, removing bloatware, and side-by-side code comparisons.
-
Staff Engineer Guide: SLAs, Observabilidad, FinOps, and Production:
- Latency Budgets Breakdown (p50, p95, p99).
- FinOps governance with
TokenCostTrackerand tenant quotas. - Distributed telemetry with W3C
traceparentcontext propagation and native Prometheus/metrics. - Continuous CI/CD evaluation using the RAG Triad and sentence-level hallucination scoring.
- Enterprise Production Readiness Checklist.
- Production Troubleshooting and Runbook: Fast triage trees for RateLimits, 502 Bad Gateway, SQLite database locks, SSRF rejections, and MCP transport issues.
- Practical and Advanced Recipes: Self-healing code pipelines, FinOps caching shields, and < 100MB Docker microservices.
- Check out the API Cheat Sheet for copy-paste ready signatures, parameters, and snippets of all public classes and functions across the framework.
| Module | Document | Focus Area |
|---|---|---|
| Reference | API Cheat Sheet | Compact signatures, parameters, and snippets for the entire framework |
| 01. Architecture | 01. System Philosophy and Design | Zero-Bloat principles, Ports & Adapters, Trade-off Matrix |
| 01. Architecture | 02. Design Patterns in RAG and Agents | Factory, Strategy, Circuit Breaker, Proxy, HITL |
| 01. Architecture | 03. Data Anatomy and Lifecycle | Dual indexing (FTS5 + Dense), GEMV BLAS, WAL concurrency |
| 01. Architecture | 04. Multi-Agent Systems and Topologies | ReAct vs Supervisor vs StateGraph, loop mitigations |
| 02. Getting Started | 01. Quickstart: Your First RAG | 15-line RAG pipeline with SQLiteVectorStore |
| 02. Getting Started | 02. Installation and Environments | Optional bundles, .env guide, and Settings precedence |
| 02. Getting Started | 03. CLI Guide and Playground |
doctor, interactive repl, init scaffolding, and rag-mcp
|
| 02. Getting Started | 04. Key Concepts and Glossary | Tokens, Embeddings, BM25, RRF, Cross-Encoders, RAG Triad |
| 03. Deep Dive | 01. LLM Engine, Resilience & Cache | Multi-provider, Failover, Structured Outputs, Cache |
| 03. Deep Dive | 02. Advanced RAG and Reranking | FTS5 + Dense with RRF, HyDE, MultiQuery, Cross-Encoders |
| 03. Deep Dive | 03. Autonomous Agents & StateGraph | ReAct, Supervisor-Worker, AgentBus, StateGraph, HITL |
| 03. Deep Dive | 04. Model Context Protocol (MCP) | MCP 2.x Servers and Clients (stdio / SSE), as_tool()
|
| 03. Deep Dive | 05. Security, Guardrails & Sandboxing | Subprocess isolation, PII Sanitizer, Prompt Injection |
| 03. Deep Dive | 06. FastAPI Gateway and Routes |
create_app, RAG router, SSE streaming, exception mapping |
| 03. Deep Dive | 07. Conversational & Vector Memory |
ConversationBufferMemory, VectorMemory, associative recall |
| 03. Deep Dive | 08. Collections and Multi-Tenancy | Logical namespaces in SQLite vs physical multi-database isolation |
| 04. Patterns | 01. Practical and Advanced Recipes | Self-healing pipelines, Cost-Shield FinOps, Multi-Tenant |
| 04. Patterns | 02. Testing, Mocking, and CI/CD | Offline unit tests with MockEmbeddingProvider
|
| 04. Patterns | 03. Migration from LangChain & LlamaIndex | Direct class mapping, reducing dependencies and lines of code |
| 05. Production | 01. Staff Engineer Guide | Latency budgets, OpenTelemetry W3C, Prometheus, Evals |
| 05. Production | 02. Troubleshooting and Runbook | Fast triage tree for RateLimits, 502, SQLite locks, SSRF |
"Build with clean, strongly-typed, asynchronous primitives on top of Python's standard library and Pydantic, eliminating unnecessary abstractions to deliver auditable, deterministic, and ultra-low latency systems."
English Documentation | Documentación en Español
- Overview
- 01. Architecture & Concepts
- 02. Getting Started
- 03. Implementation & Components
- 04. Patterns & Recipes
- 05. Staff Guide & Production
- General
- 01. Arquitectura y Conceptos
- 02. Primeros Pasos
- 03. Implementación y Componentes
- 04. Patrones y Recetas
- 05. Guía Staff y Producción