A reproducible, evaluated, secured, observable, and deployable Agentic Retrieval-Augmented Generation (RAG) platform for continuously changing organizational knowledge.
A serious, portfolio-grade Agentic RAG system designed to be defensible in a senior AI Engineer / ML Engineer interview. It demonstrates:
# 1. Clone and enter
git clone https://github.com/AdilShamim8/Agentic-RAG-Platform.git agentic-rag-platform
cd agentic-rag-platform
# 2. Copy and fill in environment
cp .env.example .env
# Edit .env with your OpenAI / Hugging Face / Langfuse credentials
# 3. Bring up the stack
make up # docker compose up -d (postgres, api, web, worker, langfuse)
make migrate # alembic upgrade head
make seed # load demo users, roles, departments
# 4. Ingest sample documents
make ingest-local # ingests data/sources/local/
# 5. Run the API and frontend
open http://localhost:3000 # Next.js web UI
open http://localhost:8000/docs # FastAPI docs
See QUICKSTART.md for the full walkthrough and STEP_BY_STEP_GUIDE.md for the complete 14-day build guide.
Also in the repo: docs/references/ (generated-from-source reference pages, guard-tested) and docs/career/README.md (the interview kit — every number machine-checked against the eval artifacts by make career-check).
User → Next.js frontend → FastAPI /query endpoint → Agent Orchestrator (custom state machine) → Planner (LLM) → Tool calls (search_documents, search_by_date, memory_search, …) → Hybrid retrieval (dense via pgvector + lexical via Postgres FTS, fused with RRF) → Cross-encoder reranking → Evidence sufficiency check → LLM generation with citation markers → Citation validation → Response with citations + trace_id. PostgreSQL stores documents, chunks, embeddings, conversations, memories, evaluations, audit logs. OpenTelemetry exports traces to Langfuse. RBAC is enforced in the retrieval SQL WHERE clause, not after retrieval.
Full architecture diagrams in docs/architecture/.
.
├── apps/
│ ├── api/ # FastAPI backend
│ └── web/ # Next.js 14 frontend
├── src/ # Backend library code
│ ├── ingestion/ # Fetchers, parsers, cleaners, chunkers, indexer
│ ├── retrieval/ # Dense, lexical, hybrid, freshness
│ ├── reranking/ # Cross-encoder reranker
│ ├── agents/ # State machine, planner, classifier, tools
│ ├── memory/ # Short-term, long-term, retrieval
│ ├── citations/ # Builder + validator
│ ├── security/ # RBAC, prompt injection, audit
│ ├── evaluation/ # Metrics + runner
│ ├── observability/ # Tracing, metrics, logging, cost
│ ├── tools/ # Tool registry
│ └── core/ # DB, config, failures, retries
├── tests/ # Unit, integration, retrieval, agent, security, evaluation, e2e
├── evals/ # Golden dataset, baselines, experiments, reports
├── prompts/ # Versioned prompt files (v1, v2, ...)
├── configs/ # YAML configs (base, dev, staging, prod)
├── scripts/ # Operational scripts (ingest, migrate, eval, bench)
├── docs/ # Architecture, research, product, decisions, learning, security
├── infra/ # docker-compose.prod.yml, k8s/, terraform/
├── docker/ # Dockerfiles for api, web, worker
├── .github/workflows/ # CI/CD
├── alembic/ # DB migrations
├── Makefile # All common commands
├── pyproject.toml # Python project config
├── docker-compose.yml # Local dev stack
├── .env.example # Environment template
└── .gitignore
| Command | What it does |
|---|---|
make up |
Start all services (postgres, api, web, worker, langfuse) |
make down |
Stop all services |
make migrate |
Apply DB migrations |
make seed |
Load demo users, roles, departments |
make ingest-local |
Ingest documents from data/sources/local/ |
make test |
Run unit + integration tests |
make eval |
Run full evaluation on the golden dataset |
make eval-smoke |
Run 10-item smoke eval (used in CI) |
make eval-compare |
Generate evals/reports/comparison.md across baselines |
make lint |
ruff + black –check + mypy |
make format |
ruff –fix + black |
make bench |
Run performance benchmarks |
make db-reset |
Drop + recreate + migrate + seed (DESTRUCTIVE) |
| You want to… | Read this |
|---|---|
| Get started in 10 minutes | QUICKSTART.md |
| Build this from scratch | STEP_BY_STEP_GUIDE.md |
| Understand the architecture | docs/architecture/system-design.md |
| Understand a design decision | docs/decisions/ |
| See measured results | evals/reports/comparison.md |
| Operate the system | docs/operations/ |
| Learn RAG concepts | docs/learning/ |
| Review the security model | docs/security/ |
| Prepare for an interview | docs/career/interview-guide.md |
| Concern | Choice |
|---|---|
| Backend | Python 3.11, FastAPI, Pydantic v2 |
| Database | PostgreSQL 16 + pgvector 0.7 |
| Embeddings | BAAI/bge-m3 (local) or OpenAI |
| Reranker | BAAI/bge-reranker-v2-m3 |
| Orchestration | Custom state machine (no LangGraph) |
| LLM | OpenAI gpt-4o-mini + provider abstraction |
| Frontend | Next.js 14, Tailwind, shadcn/ui |
| Observability | OpenTelemetry + Langfuse (self-hosted) |
| CI | GitHub Actions |
| Containers | Docker + Compose |
Full rationale in docs/research/technology-selection.md.
MIT. See LICENSE.
Preparing for interviews with this repo? Start at
docs/career/README.md — measured numbers, an
evidence map, question bank, STAR stories, and walkthroughs. Every
number there is machine-checked against the eval artifacts
(scripts/check_career_claims.py).