anthropics / anthropics/claude-agent-sdk-typescript

Support outputFormat for Task tool / subagents

Open
#104 3 comments 0 reactions 0 assignees View on GitHub
enhancement
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.