rag-agno
Backend-only Agentic RAG · Engineering MVP

Authorization-first RAG,
not a chatbot demo.

PostgreSQL owns identity, corpus and generations. Qdrant is a derived index. Every answer is claim-bound to evidence or it abstains.

Diagnostic evidence only — not a release qualification. Not certified HSE advice.

Identity
Authority
Retrieval
Reasoning
Release

Architecture

Authority

PostgreSQL is authoritative for tenants, ACLs, revisions, approvals, sealed generations, and spend. Qdrant collections are per-generation and reauthorized before any text is exposed.

Retrieval matrix

Frozen comparison: dense · dense+rerank · hybrid · hybrid+rerank × simple · agentic. Only the declared factor changes. Budgets: 40 candidates, 8 evidence blocks, 6,000 tokens.

Models

Embedding text-embedding-3-large 3072-dim + BM25 sparse. Generation gpt-5.6-luna. Rerank diagnostic: Cohere rerank-v4.0-pro. Qualifying profile pins local BGE — Cohere never silently substitutes.

Release gate

Deterministic grounding gate: claim-level citations with document / revision / content_sha256, or fail-closed abstention (insufficient · unauthorized · unsafe_evidence).

Top numbers

Source: docs/evaluation/2026-08-13-current-rag-benchmark.md + 2026-08-04-live-rag-triad-results.md. Three separate runs — do not blend.

Retrieval — 5 reviewed queries, 29 candidates/tenant

ConfigRecall@10nDCG@10MRR@10
Dense baseline0.400.25240.20
Cohere rerank-v4.0-pro1.000.68930.5917
Target≥0.85—≥0.70

Recall passes · MRR fails — relevant revision present but not ranked early enough. 15 search units, $0.00, mean rerank 3041ms.

Historical end-to-end with Luna judge — 20 obs, rerank off

RetrievalOrchFaithfulnessRelevanceUnsupported
DenseSimple0.9660.8281
DenseAgentic0.9900.7600
HybridSimple0.9780.8301
HybridAgentic0.9680.7681
Pooled0.97550.79653

Context recall pooled 0.05. 3 unsupported claims = hard-gate failure despite high mean faithfulness. Acme relevance 0.944 vs Aurora 0.575.

Live reliability — 40 obs, 8 cells, no judge

CellCitedMeanp95
Hybrid · Simple5/57.69s8.43s
Dense · Simple5/57.87s10.44s
Hybrid · Agentic5/510.75s12.07s
Dense+rerank · Agentic5/517.41s19.34s
Hybrid+rerank · Agentic5/516.54s19.16s
Overall39/4011.61s18.97s

40/40 HTTP 200. One fail-closed unsafe_evidence abstention. Overall p95 18.97s fails 15s target even serial. Hybrid+Simple is the demo default — not a release winner.

Cost — that 40-obs matrix

201,616Luna input tokens
70.3%cached (141,784)
13,279output + 717 embed
$0.0309actual / $0.0414 guarded

Cumulative app spend $0.895818 actual / $0.946458 guarded. Per-answer ~5,086 input tokens — evidence repeats every query.

How quality is checked

  • Frozen corpus / queries / dims / prompts / budgets — vary one factor only (release_benchmark.py).
  • RAGChecker claim-P/R/F1 + RAGAS / ARES layers; retrieval scored separately from pipeline.
  • Luna judge for faithfulness + relevance + unsupported count; citation precision 1.00 required.
  • Safety is a hard gate — one unauthorized or unsupported release fails the run.
  • Not yet measured: current claim-F1, unanswerable abstention, ACL/PII/injection safety, cold/warm cache, concurrency-10, signed 120-case corpus.

Run it locally

uv sync --all-groups
cp .env.example .env
make compose-up
uv run rag-agno serve --host 127.0.0.1 --port 8000
# Evidence Desk (loopback only):
uv run rag-agno evidence-desk  # -> http://127.0.0.1:4173

Loopback only by contract. No public API, no browser-held bearer keys. Full gate: make check.