Skip to main content
The LangChain integration installs as a LangChain callback handler. Every chain invoke, every LangGraph node, every tool call inside an AgentExecutor or ReAct loop is captured automatically.

Install

Use

There are two ways to attach the handler. Process-wide instrumentation is the shorter one; a per-call handler is the one to reach for when you need an isolated trace.

Instrument the process

Every LangChain call in the process is traced from this point on.
This entry point was called install() in 0.10.0 and earlier. It was renamed to instrument() in 0.10.2 — same arguments, same behaviour — because install had come to mean something else entirely: adding a skill to your workspace. See Vocabulary.install() still works and emits a DeprecationWarning, so existing code keeps running. decimalai.init(langchain=True) is unaffected on every version.
instrument() returns early if the process is already instrumented, so a later call with different arguments is a no-op rather than a reconfiguration. Setting DECIMAL_AUTO_TRACE or a bare DECIMAL_API_KEY instruments at import, which means an explicit instrument(...) after that point will not take effect.

Pass a handler per call

Construct the handler yourself and hand it to a single run. Use this when two runs share a process and their traces must stay separate.
A trace is sent when a chain, agent, or graph run completes — that is, on the outermost on_chain_end. Calling a bare llm.invoke("Hello!") with no surrounding chain never reaches that boundary and sends nothing.

LangGraph

The same handler traces a compiled graph. Each node becomes a span, with LLM and tool calls nested underneath it.

Multi-agent runs

Link a sub-agent’s trace to its orchestrator to get delegation analytics and subagent-health surfaces.

What gets captured

  • Chain / agent execution with all intermediate steps
  • LLM calls with prompt templates fully resolved (not raw {variable} placeholders)
  • Tool calls from AgentExecutor, ReAct loops, or LangGraph nodes
  • Auto-detected manifest from tool schemas + model config

Framework noise filtering

LangGraph and LangChain emit a lot of internal spans (call_model, should_continue, Prompt, RunnableSequence, etc.). The trace UI auto-collapses these by default; toggle “Show internals” in the waterfall header to reveal them.

Overriding dynamic prompts

If your prompts are built at runtime (not stored in the chain config), pass them to instrument():

What’s next

Tracing guide

What gets captured at each layer and how to enrich a trace.

Manifests

Auto-detection caveats for LangGraph state graphs.