Recover sub-agent runs as nested traces. A subagent-dispatch tool call (the
Agent tool on the live CLI — older docs say Task — carrying an
input.subagent_type) spawns a subagent whose own events the CLI tags with a
top-level parent_tool_use_id = the dispatch tool-use id. We group those
tagged tool calls under their dispatch, keyed by subagent_type. Schema
verified against real claude output (parent_tool_use_id sibling of
message, subagent_type in the dispatch input; tool named Agent) — the
same message.content line shape parseToolCalls consumes, and we match the
input field NOT the tool name so a future rename can't break it. Pure; empty
for a harness that doesn't emit parent_tool_use_id (e.g. Codex).
Recover sub-agent runs as nested traces. A subagent-dispatch tool call (the
Agenttool on the live CLI — older docs sayTask— carrying aninput.subagent_type) spawns a subagent whose own events the CLI tags with a top-levelparent_tool_use_id= the dispatch tool-use id. We group those tagged tool calls under their dispatch, keyed bysubagent_type. Schema verified against real claude output (parent_tool_use_idsibling ofmessage,subagent_typein the dispatch input; tool namedAgent) — the samemessage.contentline shapeparseToolCallsconsumes, and we match the input field NOT the tool name so a future rename can't break it. Pure; empty for a harness that doesn't emitparent_tool_use_id(e.g. Codex).