Since v0.4,
LangSightLangGraphCallback is an alias for LangSightLangChainCallback. The unified callback handles both LangChain and LangGraph automatically with auto-detect mode. This page covers the LangGraph-specific setup. For the full reference, see the LangChain integration.Install
langchain-core ships with langgraph — you don’t need the full langchain package. LangSight’s callback will find BaseCallbackHandler in langchain-core automatically.Setup (auto-detect mode)
The recommended setup for LangGraph omitsserver_name, enabling auto-detect mode. Agent names, parent links, and prompts are detected automatically from graph names.
Setup (fixed mode)
If you don’t need auto-detection, passserver_name for v0.3-compatible behavior:
Usage
Pass as a callback to your LangGraph invocation:graph.invoke() too.
Multi-agent workflows
In auto-detect mode, each named graph in your LangGraph workflow becomes an agent span. Cross-ainvoke parent linking happens automatically via a thread-local tool stack:
Migration from v0.3
The import path is unchanged — no code changes needed:server_name, the callback now enters auto-detect mode instead of defaulting to "langgraph". To preserve v0.3 behavior exactly, pass server_name explicitly.
What gets traced
| Field | Auto-detect mode | Fixed mode |
|---|---|---|
tool_name | Tool function name | Tool function name |
server_name | Agent name (auto-detected) | Value from constructor |
agent_name | Auto-detected from graph names | Value from constructor |
span_type | "agent" for agents, "tool_call" for tools | "tool_call" |
parent_span_id | Auto-linked | Manual or None |
latency_ms | Auto-computed | Auto-computed |
status | success, error, or timeout | success, error, or timeout |