Skip to main content
Deep Agents is LangChain’s agent harness for long-running agents with planning, filesystem access, subagents, memory, and tool use. Braintrust traces Deep Agents runs so you can inspect the agent workflow, tool calls, and model calls in one trace.

Setup

Install Deep Agents with Braintrust and the LangChain model package you use.
1

Install packages

2

Set environment variables

Auto-instrumentation

To trace Deep Agents without wiring callbacks into each agent, call braintrust.auto_instrument() before importing Deep Agents or LangChain packages. Braintrust uses the LangChain integration because Deep Agents is built on LangChain and LangGraph.

Manual instrumentation

To control which Deep Agents runs are traced, attach BraintrustCallbackHandler through the LangChain callback configuration.
If you already use LangChain callbacks, add handler to the same callbacks list as your existing handlers.

What Braintrust traces

Braintrust captures:
  • Deep Agents run spans (<agent name>), with input messages, output messages, LangChain tags, and Deep Agents metadata such as ls_integration, lc_agent_name, and lc_versions
  • Chat model spans (<model class name>), with input messages, invocation parameters, output, model name, and token usage when the model provider returns LangChain usage metadata
  • Tool spans (<tool name>), with parsed tool inputs, outputs, metadata, and errors
  • Streaming timing on model spans, with time_to_first_token when LangChain emits new-token callbacks
  • Streaming timing on model spans, with time_to_first_token when LangChain emits new-token callbacks.

Tracing resources