How do I trace a LangGraph agent?
LangGraph traces through LangSmith, not through a built-in OpenTelemetry exporter, so reaching your own backend means turning on LangSmith’s OTLP export rather than pointing a generic OTel SDK at the graph. Set LANGSMITH_TRACING=true and LANGSMITH_OTEL_ENABLED=true, then point OTEL_EXPORTER_OTLP_ENDPOINT at your collector: LangSmith exports the same spans it always recorded, over the standard protocol, instead of keeping them in its own UI only.
Because LangGraph saves state after every step, keyed by a thread id, each node’s span identifies exactly where in the graph a run was when it produced a given output, not just that the agent as a whole did something. That’s also what real replay depends on: rewinding to a saved checkpoint and running forward again with the exact state the graph had at the time, rather than a reconstruction from a paraphrased retry. It’s the same instrumentation job any agent needs, just scoped to one node instead of one whole turn, which is what makes “the router picked the wrong branch” a separate, gradeable finding from “the final answer was wrong.”