This guide shows you how to use CoreWeave Agent Lens to trace sub-agents so that delegated agent invocations appear as nested spans in the same trace as the parent turn. Tracing sub-agents lets you see the full hierarchy of an agent’s reasoning, including which specialist agents the parent called, what they did, and how they contributed to the final answer. This guide is for developers instrumenting multi-agent systems with Agent Lens.
A sub-agent is a delegated agent invocation that runs inside a turn. Use sub-agents when one agent hands off to another, such as when a supervisor agent dispatches a specialist agent.
When you instrument them with Agent Lens, sub-agents emit a nested invoke_agent OpenTelemetry (OTel) span in the same trace as the parent turn. In the Conversations tab, this nesting renders as a sub-agent invocation under the turn that triggered it, with its own LLM calls and tool calls grouped beneath.
Sub-agent data model
Before instrumenting your code, it helps to understand how Agent Lens represents sub-agents in a trace. The tracing.start_subagent span maps to the OTel invoke_agent span and emits the same operation name as the parent turn. Agent Lens distinguishes the two by their parent-child relationship in the trace:
Sub-agents inherit the active conversation’s conversation_id, so they’re grouped with the rest of the conversation in the Conversations tab.
tracing.start_subagent creates an invoke_agent span that automatically becomes a child of whatever span is currently active in OTel context, typically the parent turn or the LLM call that triggered the delegation. OTel context propagation handles the parent-child relationship, so you don’t need explicit delegation.
Trace a single sub-agent
The following example runs a supervisor agent that receives a request and delegates it to a research-specialist sub-agent that uses a Wikipedia search tool to find the answer.
Agent Lens captures the full hierarchy by wrapping the conversation in tracing.start_conversation and then a conversation.start_turn. Agent Lens then captures the sub-agent trace using the tracing.start_subagent block for the specialist, and records each LLM call and tool execution as child spans.
The routing logic is intentionally omitted from these examples to focus on the tracing between agents.
In the Conversations tab, the sub-agent appears as a nested invoke_agent block inside the turn, with its own LLM calls and tool calls grouped beneath. The supervisor’s direct LLM calls remain siblings of the sub-agent.
Trace multiple sub-agents
The following example runs a content-pipeline agent that handles a single request by delegating to three sibling sub-agents in sequence: a researcher that gathers facts, a writer that drafts the post, and a reviewer that polishes the final output.
Agent Lens captures all three sub-agents as siblings under the same turn by opening a separate tracing.start_subagent block for each. Because each sub-agent inherits the active turn’s OTel context, the sub-agents appear as peer invoke_agent spans nested under the turn rather than under each other.
In the Conversations tab, the turn contains three sibling sub-agent invocations, each with its own LLM call nested beneath, and the researcher includes its tool call. None of the sub-agents are children of each other.
Trace nested sub-agents
A sub-agent can itself delegate to another sub-agent. Each start_subagent call nests under whatever span is currently active in OTel context.
The example produces three levels of nesting under the turn:
In the Conversations tab, research-coordinator appears as a sub-agent of the turn, anthropic-researcher and openai-researcher appear as siblings under the coordinator, and anthropic-summarizer appears as a sub-agent of anthropic-researcher. Last modified on September 30, 2026