LangGraph (tracing)
LangGraph (tracing)
LangGraph is a framework for building stateful, multi-step agent workflows as graphs. Nodes represent operations such as LLM calls, tools, and routing decisions, while edges define the flow between them. Respan gives you full observability over every graph run, node, tool call, and LLM generation — and gateway routing through the OpenAI-compatible Respan endpoint.
Set up Respan
Create an account at platform.respan.ai and grab an API key.
Run npx @respan/cli setup to set up with your coding agent.
Use Respan Gateway
See LangGraph gateway setup to route this integration through the Respan gateway.
Example projects
Setup
Set environment variables
RESPAN_API_KEY is used to export traces to Respan. Set OPENAI_API_KEY too when graph nodes call provider-backed models.
Initialize and run
LangGraph runs through LangChain callback managers, so use respan-instrumentation-langchain and pass LangChainInstrumentor() to Respan(instrumentations=[...]).
Python — the instrumentor patches the LangChain and LangGraph callback managers on init, so the compiled graph, every node, and their nested LLM and tool calls are traced automatically. No per-call setup.
TypeScript — the instrumentor does not patch globally. Attach langgraph.addCallback(...) at the compiled graph’s top-level app.invoke() (or app.stream()), not inside a node; LangGraph propagates it to every node. Attaching it only inside a single node yields just that node’s spans.
View your trace
Open the Traces page to see the graph execution with node spans, LLM calls, and state transitions.
Configuration
Attributes
In Respan()
Set defaults at initialization — these apply to all spans.
With propagate_attributes
Override per-request using a context scope.
Decorators (optional)
Decorators are not required. Graph and node runs are traced automatically by the instrumentor in Python, and when you attach the Respan callback config to the graph invocation in TypeScript. Use @workflow and @task (Python) or withWorkflow and withTask (TypeScript) to group graph runs inside larger application workflows.
Examples
Streaming updates
Stream graph node updates while keeping the same trace.
Tool nodes
Tool calls inside graph nodes are captured as tool spans.