Guides11 min read
By the Obsivara team

LangGraph Observability: How to Trace, Cost & Monitor Agents

LangGraph agents fail in ways request logs never show — a node loops, a tool call silently returns junk, token cost creeps. Here's how to add real observability to a LangGraph agent in production.

LangGraph observability is the practice of tracing every node, tool call, and state transition in a LangGraph agent — and attributing cost, latency, and errors to each — so you can see why an agent behaved the way it did in production. Native LangGraph gives you the graph and, with the right callbacks, per-step traces; what it doesn't give you is cross-run cost attribution, health trends, or alerts when an agent starts degrading. This guide covers what to capture, how to instrument it, and how to turn raw traces into something you can actually operate against.

Why LangGraph agents are hard to observe

A LangGraph agent isn't a single request — it's a graph of nodes that call models and tools, loop, branch on state, and hand off to each other. That structure is exactly what makes these agents powerful, and exactly what makes them opaque. When an agent gives a wrong answer or costs ten times what it should, the failure is almost never in one place; it's in the path the state took through the graph.

The failure modes are specific to this shape. A conditional edge routes to the wrong node and the agent quietly takes a worse path. A cyclic graph loops more times than expected, multiplying token cost with each pass. A tool node returns a 200 with an error payload and the agent builds a confident answer on garbage. None of these throw an exception — the graph runs to completion and returns a result — which is why per-request logging, the model Helicone-style proxies were built for, misses them entirely.

What to capture

Good LangGraph observability records five things per run, at the granularity of individual nodes and tool calls — not just the final output.

SignalWhy it mattersGranularity
Node/step tracesSee the actual path state took through the graph, including loops and branchesPer node execution
Tool call inputs & outputsCatch tools that return errors as 200s or malformed data the agent trustsPer tool call
Token usage & costAttribute spend to specific nodes and find loops that multiply costPer LLM call, rolled up per run
LatencyFind the node that's slow, not just that the run was slowPer node + end-to-end
Errors & retriesDistinguish a thrown error from a silent wrong-path or swallowed failurePer node, clustered across runs

How to instrument a LangGraph agent

There are two complementary paths, and most production setups use both. The first is OpenTelemetry: LangGraph and the wider LangChain ecosystem emit spans through callback handlers, so you instrument once and export OTLP spans to any compatible backend. This is the vendor-neutral route — the same telemetry can go to different tools without re-instrumenting, which also makes it the cheapest to migrate later.

The second is an SDK that wraps your graph execution and records each node and LLM call explicitly. This gives you tighter control over what's captured — for example, tagging spans with the workflow, environment, or customer so you can slice cost and errors by dimension later. Whichever you choose, instrument at the node and tool-call level, not just the graph boundary: the whole value of LangGraph observability is lost if your trace is one span that says "agent ran, 8 seconds, $0.04" with no breakdown.

From traces to operations

Traces tell you what happened in one run. Operating an agent in production means seeing patterns across thousands of runs: which node fails most often, whether p95 latency is creeping up week over week, which tool call is quietly driving half your cost, and whether a graph change yesterday made today's runs worse. That's the gap between a tracing tool and an operations platform — the same gap described in why AI agents fail silently and, for the failure-prediction side, predicting AI workflow failures before they happen.

This is where Obsivara fits for LangGraph. It ingests your agent telemetry via SDK or OpenTelemetry, then attributes cost per node and per run, scores each agent's health from its own baseline, maps the dependency graph between agents, tools, and models, and raises predictive alerts when a trend turns bad — before the agent starts failing users. If your agents also run inside n8n, the complete guide to monitoring n8n workflows covers that native path, and the free LLM Cost & Health Estimator models agent cost in a minute with no signup.

Frequently asked questions

What is LangGraph observability?

It's the practice of tracing every node, tool call, and state transition in a LangGraph agent and attributing cost, latency, and errors to each, so you can understand and operate the agent's behavior in production. It goes beyond logging the final output to capturing the path state took through the graph.

How do I add tracing to a LangGraph agent?

Two paths: instrument with OpenTelemetry via LangChain/LangGraph callback handlers and export OTLP spans to a compatible backend (the vendor-neutral route), or use an SDK that wraps graph execution and records each node and LLM call. Capture at the node and tool-call level, not just the graph boundary, or the trace won't show where cost and errors originate.

Why do LangGraph agents fail without throwing errors?

Because the graph runs to completion even when the result is wrong: a conditional edge routes to a worse node, a cycle loops more than expected and multiplies cost, or a tool returns a 200 with an error payload the agent trusts. These are silent failures — the run succeeds technically while doing the wrong thing — which is why per-request logging misses them and node-level tracing plus cross-run monitoring is needed.

Can I monitor LangGraph cost per node?

Yes, if you instrument at the node and LLM-call level and roll token usage up per run. That lets you find the specific node or loop driving spend rather than just seeing a total per run. Obsivara does this attribution automatically from SDK or OpenTelemetry telemetry.

See your AI operations clearly.

Connect your stack in minutes — Obsivara discovers every workflow, scores its health, and attributes every dollar.

MORE POSTS