Introduction
RAGSpine is a framework-free backend RAG engine — deterministic dual-channel retrieval and agent orchestration, with anti-fabrication and source provenance as code-enforced invariants.
RAGSpine is a backend RAG engine you assemble in plain Python — not a framework you
submit to. No Dify, no LangGraph, no graph DSL, no bundled UI. Just a coherent,
batteries-included library of composable parts — retrieval, agent orchestration, document
extraction, evaluation, and an HTTP service layer — wired together by ordinary functions and
typed Protocols. The core imports zero SDKs and runs fully offline with a deterministic
MockProvider.
It was built for a demanding use case (executive insight Q&A over financial and operational reports) and ships that rigor as first-class, code-enforced invariants:
- Never fabricate. When the data isn't there, the orchestrator deterministically refuses ("not found") regardless of what the LLM says — anti-fabrication lives in the control flow, not in a prompt you hope the model obeys.
- Always cite. Every answer carries source lineage (document + locator).
- Two channels, one router. A deterministic structured / numeric channel answers "what's the number," a narrative RAG channel answers "why / what happened," and an agent routes each question — or splits a composite one and runs both.
- Everything is pluggable. LLM, embeddings, reranker, OCR, retriever, task queue — all
typed
Protocols injected at the edges.
Start here
Installation
pip install rag-spine, the optional extras, and a from-source setup.
Quickstart
Run the offline demo, ask a question, and call the Python API in minutes.
Dual channel
How the structured numeric and narrative RAG channels split the work.
Anti-fabrication
The invariant that rewrites an unsupported answer to an honest refusal.
Architecture
The request flow, the channels, and the deep domain-grouped layout.
Configuration
Environment variables and the CompanyProfile that drives identity.
Explore the domains
The engine is organized by domain — find the file by folder before you read its name. Each has a focused guide: