Source Intelligence

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

All of v2.1.238 Home All releases olderv2.1.237 v2.1.239newer
Claude Code v2.1.238

SDK result messages now report subagent statistics

Use it now
Useful3 Signal4
SDK Notable not in their notes

SDK result messages now include a summary of the subagents your session started.

subagent_stats
What

Every result message the SDK emits carries a new subagent_stats block summarising the subagents the Agent tool started this session. It is on the published result schema as an optional field marked internal, ships to every SDK consumer on this build with no flag, and is attached on success, on budget exhaustion, and on both structured-output retry-exhaustion errors.

Details
  • Counters include subagents actually started (a refused or failed launch is not counted), how many were requested background, foreground or unset, how many ended up in the background, counts by agent type, maximum spawn depth, and spawns made from inside another subagent.
  • Also tracked: completed, failed, killed split into parent/user/system, and refused split into depth limit, concurrency limit and budget. A user cancel records a kill attributed to the user.
  • task_started and task_notification events gained is_backgrounded and spawn_depth.
  • Snapshot failures are caught and dropped, so a result is still emitted without the block. Nothing in the build reads the field locally; it exists for whoever consumes the result stream.
Evidence

@internal Running totals of the subagents the Agent tool started this session; see SDKSubagentStats., Subagents actually started (one tengu_agent_tool_selected each); a refused or failed launch is not counted., subagent_stats, Spawns made from inside another subagent (depth > 1).

Strings lifted out of the shipped bundle, so the claim above can be checked against them.

Related

Other releases about the same thing. Found by shared names or similar wording; neither means one caused the other.

See this entry in the whole of v2.1.238 →