Skip to content

AttributeError: 'Response' object has no attribute 'response_id' when using streaming #2505

@shatsss

Description

@shatsss

Bug: AttributeError: 'Response' object has no attribute 'response_id'

Environment: openai-agents 0.9.1, openai 2.21.0, Python 3.10

Issue: The SDK tries to access response_id on Response objects, but the field is actually named id.

Location: agents/run.py line 1179 (and lines 677, 790, 1118, 1128)

Error:

response_id=turn_result.model_response.response_id  # ❌ response_id doesn't exist
AttributeError: 'Response' object has no attribute 'response_id'

Root Cause:
The Response class from openai.types.responses has an id field, not response_id:

Response.model_fields.keys()  # includes 'id', 'previous_response_id', but NOT 'response_id'

Fix:
Change all occurrences from:

turn_result.model_response.response_id

to:

turn_result.model_response.id

Impact: Affects custom model implementations that return Response objects, particularly when using streaming.

Workaround:

from openai.types.responses import Response

@property
def response_id(self):
    return self.id

Response.response_id = response_id

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions