Agentic-RAG-Platform

Project Story — Agentic RAG Platform

A structured, metric-driven narrative for technical architecture interviews, executive presentations, and engineering portfolio reviews.


1. The Core Engineering Narrative (3-Minute Overview)

Paragraph 1: The Problem & Requirements

I designed and built an enterprise-grade Agentic Retrieval-Augmented Generation (RAG) platform to solve the core challenges of querying continuously changing organizational knowledge. Naive “upload document $\rightarrow$ vector search $\rightarrow$ LLM answer” pipelines fail in production: they hallucinate without verifiable citations, lack awareness of document effective dates, cannot enforce role-based access control (RBAC), and break down on multi-hop questions requiring synthesis across multiple sources. My core engineering requirements were strict: zero hallucinations via automated citation verification, temporal document version awareness, pre-retrieval SQL RBAC preventing cross-role data leakage, and a fully reproducible evaluation framework wired into CI/CD.

Paragraph 2: Architecture & Implementation

I documented technology selection through 8 formal Architecture Decision Records (ADRs). To eliminate operational complexity, I standardized on a unified PostgreSQL foundation with pgvector for 1024-dimensional dense embeddings (BAAI/bge-m3) and native Full-Text Search (tsvector) for lexical keyword matching. These branches run concurrently and fuse via Reciprocal Rank Fusion (RRF, $k=60$). Candidates are refined through a cross-encoder reranker (BAAI/bge-reranker-v2-m3) to isolate the top 5 high-precision evidence chunks. Rather than adopting heavy orchestration frameworks like LangGraph, I engineered a custom deterministic Python state machine with explicit transitions (START $\rightarrow$ CLASSIFY $\rightarrow$ PLAN $\rightarrow$ TOOL_CALL $\rightarrow$ RETRIEVE $\rightarrow$ RERANK $\rightarrow$ EVIDENCE_VALIDATION $\rightarrow$ GENERATION $\rightarrow$ CITATION_VALIDATION $\rightarrow$ END). Observability was integrated from day one using OpenTelemetry distributed tracing and Langfuse telemetry.

Paragraph 3: Measured Results & Impact

The platform’s performance was validated against a 50-item golden evaluation dataset across 6 benchmark baselines:


2. Technical Interview Deep-Dive Themes

Theme A: “Why PostgreSQL + pgvector over a dedicated vector database like Pinecone or Qdrant?”

Theme B: “Why a custom state machine instead of LangGraph?”

Theme C: “How did you eliminate hallucinations?”


3. Executive Metrics Summary

Engineering Metric Measured Value Production Context
Metric Measured value Context (mock provider unless noted)
Recall@k (hybrid+reranked) 0.943 vs 0.486 lexical-only, 0.886 dense-only — golden 50 (evals/reports/comparison.md)
MRR (hybrid+reranked) 0.900 vs 0.486 lexical-only — same report
Behavior compliance (agentic) 0.960 best of six baselines; unexpected failures 0.040
Verified citation rate 1.000 unauthorized citations CI-gated to exactly 0
Injection regex layer 10/10 patterns flagged by construction, unit-tested (src/security/prompt_injection.py)
Judge layer blocked implemented, requires a real provider (llm_judge_methodology.md)
p95 / cost (smoke) 5 ms / $2.67e-05 committed smoke report; real-LLM figures are design estimates