Chrome DevTools for RAG Pipelines β Instrument your RAG code with a single decorator, and this dashboard visualizes every stage in real time: embedding, retrieval, re-ranking, answer generation, and grounding attribution.
When your RAG chatbot gives a wrong answer, you're left guessing. RAG Debugger makes the entire pipeline transparent:
| Question | Without RAG Debugger | With RAG Debugger |
|---|---|---|
| Was the right document retrieved? | π€· No idea | β See all chunks + similarity scores |
| Was the reranker helpful? | π€· No idea | β Compare cosine vs rerank scores side by side |
| Did the LLM use the context? | π€· No idea | β Sentence-level grounding highlights (green/red) |
| Which stage was slow? | π€· No idea | β Stage-by-stage latency timeline |
| Is quality improving over time? | π€· No idea | β Grounding trends + analytics dashboard |
Your RAG App SDK Server Dashboard
ββββββββββββ ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β embed() βββemitβββΆβ @rag_trace βββPOSTββΆβ FastAPI + βββGETββΆβ Next.js UI β
β retrieve β event β non-blocking β /eventsβ DuckDB β REST β D3 charts β
β rerank() β β auto trace β β grounding β + WS β live updates β
β generate β β PII scrub β β analytics β β analytics β
ββββββββββββ ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
| Component | What It Does | Why It Exists |
|---|---|---|
SDK (packages/sdk/) |
@rag_trace("retrieve") β one-line decorator on your existing functions |
Captures inputs, outputs, timing, errors without blocking your pipeline. Scrubs PII before sending. |
Server (apps/server/) |
FastAPI + DuckDB + sentence-transformers | Stores events, computes grounding scores (checks if each LLM sentence is supported by retrieved chunks), broadcasts via WebSocket. |
Dashboard (apps/dashboard/) |
Next.js 16 + D3.js + Recharts | Pipeline timeline, chunk waterfall chart, grounding highlighter, embedding scatter plot, live analytics. |
- Debug bad answers β drill into a specific trace, see which chunks were retrieved, and whether the LLM actually used them
- Optimize latency β see that retrieval takes 800ms (add a cache!) or generation takes 3s (use a faster model!)
- Detect hallucinations β the grounding highlighter shows you, sentence by sentence, what's supported by evidence vs. hallucinated
- Track quality over time β after changing your chunking strategy or embedding model, see if grounding scores improved
- Production monitoring β the live WebSocket feed shows every query flowing through your pipeline in real time
cd apps/server
uv venv && uv pip install -e .
uv run uvicorn main:app --host 0.0.0.0 --port 7777 --reloadcd apps/dashboard
pnpm install && pnpm devcd apps/test-app
uv venv --clear .venv
uv pip install --python .venv/bin/python3 httpx pydantic
.venv/bin/python3 main.py # Run all 8 sample queries
.venv/bin/python3 main.py --query "What is RAG?" # Single query
.venv/bin/python3 main.py --loop # Continuous (every 5s)
.venv/bin/python3 main.py --error # Simulate errorsOpen http://localhost:3000 (or :3001) β traces appear as the pipeline runs.
from rag_debugger import init, rag_trace
# 1. Initialize once at startup
init(dashboard_url="http://localhost:7777")
# 2. Decorate your pipeline functions β that's it
@rag_trace("embed")
async def embed_query(query: str) -> list[float]:
return await openai_embed(query)
@rag_trace("retrieve")
async def retrieve_chunks(vector: list[float], k: int = 10):
return await vector_store.query(vector, k)
@rag_trace("rerank")
async def rerank(query: str, chunks: list) -> list:
return await cohere_rerank(query, chunks)
@rag_trace("generate")
async def generate(query: str, context: str) -> str:
return await llm.complete(query, context)The decorator automatically:
- Generates
trace_idandquery_idvia ContextVar - Captures function inputs and outputs
- Measures
duration_ms - Emits events asynchronously (non-blocking, never crashes your pipeline)
- Scrubs PII (emails, API keys, SSNs) before sending
When you call your pipeline, here's the event flow:
embed_query("What is RAG?")
β @rag_trace captures 64-dim vector, 23ms duration β POST /events β
retrieve_chunks(vector, k=5)
β @rag_trace captures 5 chunks + cosine scores β POST /events β
rerank_chunks(query, chunks)
β @rag_trace captures reranked scores β POST /events β
generate_answer(query, context)
β @rag_trace captures answer text β POST /events β
β auto-emits session_complete summary β POST /events β
Server:
β Stores all 5 events in DuckDB
β Computes sentence-level grounding (MiniLM model)
β Broadcasts via WebSocket to dashboard
Dashboard:
β Pipeline timeline shows stage durations
β Chunk waterfall compares cosine vs rerank scores
β Grounding highlighter shows green (grounded) / red (hallucinated) sentences
from rag_debugger.adapters.langchain import RAGDebuggerCallback
handler = RAGDebuggerCallback()
chain.invoke({"query": "..."}, config={"callbacks": [handler]})from rag_debugger.adapters.llamaindex import RAGDebuggerLlamaIndex
from llama_index.core.callbacks import CallbackManager
handler = RAGDebuggerLlamaIndex()
callback_manager = CallbackManager([handler])
index = VectorStoreIndex.from_documents(docs, callback_manager=callback_manager)from rag_debugger.adapters.openai import RAGDebuggerOpenAI
client = RAGDebuggerOpenAI()
embedding = client.embed("What is RAG?") # β "embed" event
response = client.complete(messages=[...]) # β "generate" event| Method | Endpoint | Description |
|---|---|---|
| POST | /events |
Ingest SDK events |
| GET | /traces |
List query sessions (paginated, filterable) |
| GET | /traces/{id} |
Full trace with all events |
| GET | /traces/{id}/chunks |
Chunk scores across stages |
| GET | /traces/{id}/embeddings |
Vectors for UMAP projection |
| GET | /traces/{id}/grounding |
Sentence attribution data |
| GET | /analytics/metrics?days=7 |
Daily metrics (grounding, latency, errors) |
| WS | /ws/{trace_id} |
Real-time event stream |
| POST | /playground/query |
Test query endpoint |
| GET | /health |
Health check |
docker-compose up --build- Server: http://localhost:7777
- Dashboard: http://localhost:3000
rag-debugger/
βββ apps/
β βββ server/ # FastAPI backend
β β βββ routers/ # events, traces, analytics, ws, playground
β β βββ database.py # DuckDB connection + queries
β β βββ grounding.py # Sentence attribution scorer (MiniLM)
β β βββ models.py # Pydantic schemas
β βββ dashboard/ # Next.js 16 frontend
β β βββ app/ # Pages (Home, Traces, Analytics, Playground)
β β βββ components/ # D3 charts, timeline, grounding highlighter
β β βββ hooks/ # WebSocket, UMAP, metrics hooks
β β βββ lib/ # API client, TypeScript types
β βββ test-app/ # Test application for SDK integration
βββ packages/
β βββ sdk/ # Python instrumentation SDK
β βββ rag_debugger/ # Core SDK + framework adapters
βββ docs/ # Detailed docs (SERVER.md, SDK.md, DASHBOARD.md)
βββ docker-compose.yml
βββ Makefile
βββ README.md
| Layer | Technology |
|---|---|
| Frontend | Next.js 16, React 19, Tailwind CSS 4, TypeScript 5.9 |
| Charts | D3.js (waterfall), Recharts (metrics) |
| Embeddings | umap-js (browser), Canvas2D |
| Backend | FastAPI, Python 3.10+ |
| Database | DuckDB (columnar analytics) |
| Grounding | sentence-transformers (all-MiniLM-L6-v2) |
| Real-time | WebSockets |
| SDK | Python, httpx, ContextVar propagation |
MIT