anthropics / anthropics/claude-agent-sdk-typescript
Support outputFormat for Task tool / subagents
- Dominant language
- Shell
- Stars
- 1.8k
- Forks
- 226
- PR merge metrics
- No merged PRs in 30d
Description
**Problem**
When using the Task tool to spawn subagents, the full subagent response is returned to the main agent's context. This causes context bloat and defeats the purpose of using subagents for context isolation.
Currently, outputFormat with json_schema only works for the top-level query(), not for subagent results.
**Use Case**
Building agents that spawn multiple parallel workers to process documents. Each worker reads sources, writes analysis to disk, and should return only a compact JSON summary to the main agent.
Without schema enforcement on subagent output, 10 workers returning 5000 tokens each = 50000 tokens of context bloat. With enforcement, 10 workers × 150 tokens = 1500 tokens.
This pattern is essential for scalable multi-agent workflows
**Proposed Solution**
Add outputFormat support to either:
- Task tool parameters, or
- Programmatic agent definitions via the agents option
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.