You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Chat Completions streaming computes assistant output_index with a bool expression #3109
Have you searched for related issues? Others may have faced similar issues.
Describe the bug
The Chat Completions streaming handler sometimes passes a boolean value as output_index for assistant message events after a reasoning item has been emitted.
When reasoning content exists, this produces True rather than the integer 1. Python treats bool as a subclass of int, so this can pass local numeric checks, but downstream JSON consumers and event snapshots can observe the wrong type.
Relevant code:
src/agents/models/chatcmpl_stream_handler.py: text, refusal, content-part-done, and output-item-done events use the boolean expression above.
Debug information
Agents SDK version: current main at 3854c124
Python version: Python 3.12.1
Repro steps
Stream Chat Completions chunks where reasoning content is emitted before regular text content. Inspect the output_index on the text/message events that follow the reasoning item.
Current behavior: some events use True as output_index.
Expected behavior
All streamed response events should use integer output_index values, for example 0 for the reasoning item and 1 for the assistant message that follows it. No event should expose a boolean output_index.
changed the title [-]Chat Completions streaming emits boolean output_index values[/-][+]Chat Completions streaming computes assistant output_index with a bool expression[/+]on May 4, 2026
However, I could not reproduce the originally described downstream-visible behavior. The OpenAI SDK/Pydantic response event models coerce this value to int.
Activity
[-]Chat Completions streaming emits boolean output_index values[/-][+]Chat Completions streaming computes assistant output_index with a bool expression[/+]Aphroq commentedon May 4, 2026
Update:
I re-tested this on
main.The source observation is still valid: several event constructors pass:
However, I could not reproduce the originally described downstream-visible behavior. The OpenAI SDK/Pydantic response event models coerce this value to
int.Observed stream events:
Direct event construction also coerces
output_index=Trueto1, andmodel_dump_json()emits"output_index":1.So this issue should be treated as a code clarity / defensive consistency cleanup, not as a confirmed runtime bug where consumers observe
bool.fix: #3109 stabilize chat completions stream output indexes
seratch commentedon May 7, 2026
Fixed y #3176
fix: #3109 stabilize chat completions stream output indexes (#3176)
fix: openai#3109 stabilize chat completions stream output indexes (op…