Skip to main content
Automatically capture the full multi-agent hierarchy of DeepAgents pipelines. DeepAgents builds on LangChain, so TraceRoot instruments it via the LangChain callback manager.

Setup

import traceroot
from traceroot import Integration

traceroot.initialize(integrations=[Integration.LANGCHAIN])

Usage

from traceroot import observe, using_attributes
from deepagents import create_deep_agent

research_subagent = {
    "name": "research-agent",
    "description": "Searches the web to gather information on a topic.",
    "system_prompt": "You are a thorough research agent. Cite sources and organise findings clearly.",
    "tools": [web_search],
}

supervisor = create_deep_agent(
    model="claude-sonnet-4-6",
    system_prompt="You are a research supervisor. Delegate tasks to sub-agents and synthesise their outputs.",
    subagents=[research_subagent],
)

@observe(name="research_session", type="agent")
def run_research(query: str) -> str:
    result = supervisor.invoke({"messages": [{"role": "user", "content": query}]})
    messages = result.get("messages", [])
    return messages[-1].content if messages else ""

with using_attributes(user_id="demo-user", session_id="research-session"):
    report = run_research("What are the latest AI agent frameworks in 2025?")

What Gets Captured

AttributeDescription
Supervisor stepsEach supervisor reasoning and delegation step
Sub-agent callsEach sub-agent invocation with its own span
Tool callsTool inputs and outputs within sub-agents
LLM callsAll LLM calls across the full agent hierarchy
Token usageAggregated across all agents and LLM calls
CostTotal cost for the full multi-agent run