What you need
- LangSight running locally (
./scripts/quickstart.shordocker compose up -d) - Python 3.11+
- An OpenAI API key (or swap for any LangChain-supported LLM)
Install
1. Create a project and get your API key
- Open
http://localhost:3003and log in - Go to Settings → Projects and copy your project ID
- Go to Settings → API Keys and create a key
.env:
2. Build a RAG chain with tracing
3. View the trace
http://localhost:3003 → Sessions → click the session row → Trace tab for the full nested call tree.
What gets traced
| Span | What it captures |
|---|---|
| Retriever call | Tool name, latency, status |
| LLM call | Model, input/output tokens, cost, latency |
| Agent span | Wraps all calls in the session |
Using a different LLM
SwapChatOpenAI for any LangChain-compatible model. The callback is LLM-agnostic — it traces at the LangChain callback layer, not the model SDK layer.
Loop detection and budget guardrails
If the retriever is called in a loop (e.g. a retry chain that keeps fetching), LangSight can stop the session automatically. Add to your client:Next steps
- LangChain integration reference — full callback options, auto-detect mode, LangGraph multi-agent trees
- Session health tags — understand
loop_detected,budget_exceeded,tool_failure - Costs dashboard — see cost by tool, agent, and model
- MCP health monitoring — if your RAG pipeline calls MCP servers