Using LangChain, Langflow, LangGraph, or LangServe? See the dedicated LangChain integration —
LangSightLangChainCallback covers all four without wrapping individual MCP clients.Installation
LangSight is already installed — the SDK is part of the main package:2-line integration
Full example
How it works
Thewrap() method returns MCPClientProxy — a transparent proxy that:
- Calls the original
call_tool()method - Records start time, end time, and latency
- Sends a
ToolCallSpantoPOST /api/traces/spansasynchronously (fire-and-forget) - Returns the original result unchanged
Span metadata
Manual spans
Record spans without wrapping a client:Multi-agent tracing
When Agent A delegates to Agent B, pass thetrace_id and the parent agent’s span ID so LangSight can reconstruct the full call tree.
Using the session context manager
Manual parent_span_id
If you are not using the session context manager, setparent_span_id explicitly:
How parent_span_id works
parent_span_id uses the same model as OpenTelemetry distributed tracing. Each span has a unique span_id. When a child agent sets parent_span_id, LangSight can reconstruct the full call tree by following parent-child relationships from the flat span storage. No separate tree structure is required — tree reconstruction is a recursive query at read time.