What
When running Claude Code in headless or -p (print) mode with streamed JSON output, both successful and error result objects can now include a result_index field. This field is actually populated, counting up for each result delivered during a run.
Why
This gives tools consuming streamed JSON output a reliable way to know the order in which results were delivered.
Names in the bundleresult_index
Documented inapi/api/beta
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
Confirmed since
Anthropic's documentation has since written up result_index, on Agent SDK reference - TypeScript.
result_index?: number;agent-sdk/typescript see the edit
One source agreesOne thing we can check says the same as this entry.
Anthropic's documentation agrees
Anthropic's documentation has since written up result_index, on Agent SDK reference - TypeScript.