How digibhatia/tracing-debugging works
Nidan is a trace-driven debugging lab for a document-grounded financial agent. Users submit questions or session chats through the API, which runs an agent turn and returns an answer and trace; additional endpoints delegate a fraud check, replay or diff runs, grade outcome and tool trajectory, and seed or reveal blind incidents. Document ingestion and retrieval support policy answers, while OpenTelemetry exports traces for diagnosis. Several connections rely on README descriptions or module references rather than a complete app excerpt; those uncertain runtime links are dashed.
Main entry points: app.py HTTP API · tools.py Agent tools · vectorstore.py Vector retrieval · llm_provider.py LLM provider
Components 22
API and orchestration
- HTTP API
app.py - Session memory
memory_store.py
Agent execution
- Agent turn
app.py - LLM provider
llm_provider.py - Agent tools
tools.py - Fraud sub-agent
delegation.py
Policy knowledge
- Policy documents
documents - Format loaders
loaders.py - Document chunking
chunking.py - Vector retrieval
vectorstore.py - Context packing
context.py - Index builder
build_vectorstore.py
Debugging workflows
- Replay and diff
replay.py - Trajectory grading
trajectory_eval.py - Blind incidents
incidents.py
Trace instrumentation
- Trace setup
otel_setup.py - GenAI conventions
genai_conventions.py - PII redaction
pii.py
Other components
- Engineer or user
- OpenAI API
- OTel Collector
- Jaeger
Connections 27
- Engineer or user → HTTP API: submits requests
README.md - HTTP API → Agent turn: runs turns
README.md - HTTP API → Session memory: reads and updates
app.py - HTTP API → Fraud sub-agent: routes delegation
app.py - HTTP API → Replay and diff: runs replay and diff
app.py - HTTP API → Trajectory grading: grades runs
app.py - HTTP API → Blind incidents: manages incidents
app.py - Agent turn → LLM provider: requests completions
app.py - Agent turn → Agent tools: dispatches tools
app.py - Fraud sub-agent → LLM provider: requests completions
delegation.py - Fraud sub-agent → Agent tools: executes tool calls
delegation.py - LLM provider → OpenAI API: calls chat API
llm_provider.py - Agent tools → Vector retrieval: queries policies
tools.py - Agent tools → Context packing: packs retrieved text
tools.py - Index builder → Vector retrieval: builds collection
build_vectorstore.py - Vector retrieval → Format loaders: loads documents
vectorstore.py - Vector retrieval → Document chunking: chunks text
vectorstore.py - Vector retrieval → PII redaction: redacts text
vectorstore.py - Policy documents → Format loaders: provides source files
- Replay and diff → LLM provider: runs completions
replay.py - Replay and diff → Agent tools: executes tool calls
replay.py - HTTP API → Trajectory grading: evaluates answer and tools
app.py - LLM provider → Trace setup: creates spans
llm_provider.py - Agent tools → Trace setup: creates spans
tools.py - GenAI conventions → PII redaction: redacts span prompts
genai_conventions.py - Trace setup → OTel Collector: exports traces
README.md - OTel Collector → Jaeger: forwards traces
README.md