10-minute path from
git cloneto a working local Agentic RAG platform.
make, curl, jqgit clone <your-repo-url> agentic-rag-platform
cd agentic-rag-platform
cp .env.example .env
Edit .env and fill in:
OPENAI_API_KEY=sk-...
HF_TOKEN=hf_...
LANGFUSE_SECRET=... # any random 32-char string
LANGFUSE_PUBLIC=... # any random 32-char string
APP_SECRET_KEY=... # any random 64-char string (REQUIRED, min 32 chars)
JWT_SECRET=... # any random 64-char string (REQUIRED, min 32 chars)
DATABASE_URL=postgresql+asyncpg://rag:rag@postgres:5432/rag
Both APP_SECRET_KEY and JWT_SECRET are required by the API and worker services;
the stack will not start without them.
Generate random secrets with:
openssl rand -hex 32
make up # postgres, api, web, worker, langfuse
make migrate # apply database migrations
make seed # load demo users, roles, departments
Verify health:
curl -s http://localhost:8000/health | jq
# {
# "status": "ok",
# "db": "ok",
# "embedder": "ok",
# "llm": "ok",
# "version": "..."
# }
Drop a few markdown or PDF files into data/sources/local/, then:
make ingest-local
Verify chunks were created:
docker compose exec postgres psql -U rag -d rag \
-c "SELECT count(*) FROM document_chunks;"
Open http://localhost:3000 and log in with:
alice@demo.dev (administrator)password123Ask a question. Try: “What is the remote work policy?”
# Get a JWT
TOKEN=$(curl -s -X POST http://localhost:8000/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"alice@demo.dev","password":"password123"}' | jq -r .access_token)
# Query
curl -s -X POST http://localhost:8000/query \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"query":"What is our remote work policy?"}' | jq
# Ingest in the background (worker picks it up from Redis; poll the job id)
JOB=$(curl -s -X POST http://localhost:8000/documents/ingest-async \
-H "Authorization: Bearer $TOKEN" \
-F "file=@docs/policy.md" | jq -r .job_id)
curl -s http://localhost:8000/documents/jobs/$JOB \
-H "Authorization: Bearer $TOKEN" | jq
# Logout (revokes the refresh token server-side and clears the cookie)
curl -s -X POST http://localhost:8000/auth/logout \
-H "Authorization: Bearer $TOKEN" -o /dev/null -w "%{http_code}\n"
Note: the browser flow keeps its refresh token in an HttpOnly cookie
(never in JavaScript-readable storage); curl users can pass
{"refresh_token": "..."} in the body of /auth/refresh instead.
Open http://localhost:3001 (Langfuse UI, log in with the LANGFUSE_SECRET credentials) and find the most recent trace. You should see the full span tree: rag.query → embed → retrieval.dense → retrieval.lexical → rerank → agent.planner → generate → validate_citations.
make eval
This runs the full golden dataset (~50–100 items) through all configured baselines and produces evals/reports/comparison.md.
For a fast smoke test (10 items, used in CI):
make eval-smoke
make test # unit + integration
make test-unit # just unit
make test-security # RBAC + prompt injection
make down
To wipe the database and start over:
make db-reset
| Symptom | Fix |
|---|---|
make up fails on port conflict |
Edit docker-compose.yml, change ports: to non-conflicting |
Health check shows embedder: fail |
docker compose logs api, look for HF model download errors |
Health check shows llm: fail |
Check OPENAI_API_KEY in .env, check your billing |
make migrate fails |
docker compose restart postgres, then retry |
| Ingestion succeeds but 0 chunks | Verify data/sources/local/ has files; check docker compose logs worker |
| Query returns “no relevant documents” | Your corpus might not match the query; try the seed corpus |
Citations appear but text is [1] [2] |
Citation parser issue; check docker compose logs api |
| Langfuse shows no traces | Verify LANGFUSE_SECRET matches in both api and langfuse |
make doc-links # every relative markdown link resolves
make career-check # career-kit numbers == eval artifacts
Both run in CI; both caught real rot in this repo’s history (20 broken links; unbacked headline numbers).