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, callbraintrust.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, attachBraintrustCallbackHandler through the LangChain callback configuration.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 asls_integration,lc_agent_name, andlc_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_tokenwhen LangChain emits new-token callbacks - Streaming timing on model spans, with
time_to_first_tokenwhen LangChain emits new-token callbacks.