Feature Request: Include output delta in tool_progress events for Agent SDK (small fix)
Summary
When using the Claude Agent SDK, tool_progress events for Bash tool execution only include elapsed_time_seconds but not the actual output content. The output is already being streamed internally (as bash_progress events with output and fullOutput fields), but this data isn't exposed to SDK consumers.
Current Behavior
SDK consumers receive tool_progress events like:
{
type: "tool_progress",
tool_use_id: "...",
tool_name: "Bash",
elapsed_time_seconds: 5.2,
// No output content!
}
Desired Behavior
Include the output delta in tool_progress events:
{
type: "tool_progress",
tool_use_id: "...",
tool_name: "Bash",
elapsed_time_seconds: 5.2,
output: "Building project...\n", // Delta chunk
total_lines: 42
}
Why This Matters
- Real-time feedback: SDK consumers (like custom UIs, monitoring tools) can show live command output instead of waiting for completion
- Better UX: Long-running commands feel more responsive when users see progress
- Parity with CLI: The Claude Code CLI already displays streaming output internally - this just exposes it to SDK consumers
Technical Details
Looking at the code, the internal bash_progress event already contains the output:
// Internal event (line ~476437)
{
type: "bash_progress",
output: _A.output, // ← Already available!
fullOutput: _A.fullOutput,
elapsedTimeSeconds: _A.elapsedTimeSeconds,
totalLines: _A.totalLines
}
But when converted for SDK output, the output fields are omitted:
// SDK output (line ~457906)
yield {
type: "tool_progress",
elapsed_time_seconds: A.data.elapsedTimeSeconds,
// output not included
}
The fix is literally adding output: A.data.output to the yield statement.
There's also a check that only emits progress in remote/container mode (CLAUDE_CODE_REMOTE or CLAUDE_CODE_CONTAINER_ID) - it would be great to enable this for local SDK usage too.
Environment
- Claude Code version: 2.1.4
- Using: Claude Agent SDK (TypeScript)
Thank you for considering this enhancement!
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗