TaskOutput returns full JSONL transcript instead of agent's final response
Resolved 💬 3 comments Opened Jan 24, 2026 by miguel-iex Closed Jan 24, 2026
Summary
When using TaskOutput to retrieve results from background agents (run_in_background=true), the tool returns the entire agent conversation transcript as a serialized JSONL string instead of just the agent's final response text.
Reproduction
- Spawn a background agent:
Task(
subagent_type="general-purpose",
prompt="Do something and return a summary",
run_in_background=True
)
- Retrieve results:
TaskOutput(task_id="<agent_id>", block=True)
- The returned
task.outputfield contains the full JSONL conversation history (~200-500KB) instead of the agent's final text response (~500 bytes).
Expected Behavior
TaskOutput should return only the agent's final assistant message text, e.g.:
Output: outputs/my-file.md
Summary:
- Finding 1
- Finding 2
Confidence: 0.92
Actual Behavior
TaskOutput returns a serialized JSONL string containing all messages from the agent's sidechain conversation:
{"parentUuid":null,"isSidechain":true,"type":"user","message":{...}}
{"type":"assistant","message":{...}}
{"type":"user","toolUseResult":{...}}
... (40+ messages, 200-500KB total)
Impact
- Context bloat: Each background agent result consumes 200-500KB instead of ~500 bytes
- Transcript size: A session with 2 background agents had a 2.1MB transcript instead of ~200KB
- Token waste: Unnecessary context consumption affects cost and may cause truncation
Evidence
From session a97c8078-bf8e-4c09-b1e2-bda06542e91f:
- Line 107: 457KB TaskOutput result (should be ~500 bytes)
- Line 111: 514KB TaskOutput result (should be ~500 bytes)
- Both contained 42 JSONL messages each
Environment
- Claude Code version: 2.1.19
- OS: macOS (Darwin 24.6.0)
Workaround
The orchestrator can work around this by having agents write to output files and reading those files directly, ignoring the bloated task.output field.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗