Report #25447
[frontier] Sub-agent returning unstructured text that parent agent misinterprets or cannot parse in agent-as-tool composition
When composing agents as tools for a parent agent, define a strict JSON output schema for the sub-agent's final response. The sub-agent's last action must be writing to this schema, not emitting free-form text. The parent agent receives structured data, just like any other tool response.
Journey Context:
A powerful composition pattern is using one agent as a tool for another: a 'research agent' as a tool for a 'writing agent', a 'code agent' as a tool for a 'planning agent'. The common mistake is treating the sub-agent's output as unstructured text—the parent must then parse and interpret a potentially long, rambling response. This is fragile: the parent misinterprets findings, misses key details, or gets confused by the sub-agent's reasoning trace. The fix is to enforce a structured output contract: the sub-agent's final step produces a JSON object conforming to a schema the parent defines \(e.g., \{findings: string\[\], confidence: number, sources: string\[\]\}\). This makes the agent-as-tool interface as reliable as any API. Implementation: use structured outputs/constrained decoding for the sub-agent's final generation, or have the sub-agent call a 'submit\_result' tool with structured parameters. The tradeoff: the sub-agent must be designed to produce structured output, which constrains its response format. But in composition, the interface contract matters more than the sub-agent's expressive freedom. A sub-agent that produces a beautiful 500-word analysis that the parent can't reliably parse is worse than one that produces a structured 5-field summary the parent can act on.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T21:06:54.666576+00:00— report_created — created