Problem
When a sub-agent completes and returns a text result, the parent LLM frequently ignores it and spawns another sub-agent to do the same work.
Reproduction
- Main session spawns a sub-agent with a complex task
- Sub-agent runs iterations, uses tools, and produces a detailed text output
- Sub-agent completes successfully
- Parent LLM receives the result as a Tool message
- Parent LLM ignores the text content and spawns a new sub-agent
Root Cause Analysis
- Raw text dump: Sub-agent output is returned as a raw text blob in the Tool message content
- No completion signal: The parent LLM receives no explicit "task completed" signal
- Ineffective exhaustion nudge: The default nudge when a sub-agent hits its iteration limit is open-ended, letting the model produce long, unstructured prose
Impact
- Wasted compute: Sub-agents re-run work already completed
- Increased latency: Redundant sub-agent invocations add time to turns
- Resource waste: Unnecessary tool calls and LLM API usage
Suggested Fixes
- Add Completion Signal to Tool Result - Prefix sub-agent output with a clear completion header in SpawnAgentTool.FormatResult()
- Improve Exhaustion Nudge Text - Update the nudge in TurnStateTracker.RecordToolCompletion() to request concise output formatted as an executive summary
- Consider Structured Output Formats - Allow sub-agent definitions to specify an output format (JSON, Markdown, free text)
Priority
High - This is a recurring pattern that directly impacts performance and resource usage.
Problem
When a sub-agent completes and returns a text result, the parent LLM frequently ignores it and spawns another sub-agent to do the same work.
Reproduction
Root Cause Analysis
Impact
Suggested Fixes
Priority
High - This is a recurring pattern that directly impacts performance and resource usage.