Skip to content

[Bug] Incomplete fix for #1091 - conversation_id still required in _TemporalModelStub.get_response() #1186

@danielmillerp

Description

@danielmillerp

What are you really trying to do?

I'm trying to use the Temporal Python SDK's OpenAI agents integration plugin to build and run agents with Temporal workflows.

Describe the bug

When using the Temporal OpenAI agents plugin, the _TemporalModelStub.get_response() method throws a TypeError because the optional parameters lack default
values:

TypeError: _TemporalModelStub.get_response() missing 1 required keyword-only argument: 'conversation_id'

This issue was previously reported in #1091 (#1091) and supposedly fixed by PR #1092, but the fix didn't fully
resolve the problem. The PR added the parameters to the method signature but didn't give them default values, so they're still required at runtime despite
being marked as Optional.

Minimal Reproduction

  1. Install temporalio 1.18.1 and openai-agents 0.2.7
  2. Set up any basic Temporal workflow using the OpenAI agents plugin
  3. Run the workflow
  4. Observe TypeError when the plugin tries to call get_response()

Environment/Versions

  • OS and processor: macOS Darwin 24.6.0 (M1)
  • Temporal SDK Version: 1.18.1
  • OpenAI Agents Version: 0.2.7
  • Python Version: 3.13

Additional context

Issue #1091 identified this problem and PR #1092 attempted to fix it by adding the conversation_id, previous_response_id, and prompt parameters. However, the
fix was incomplete - the parameters were added without default values.

Current implementation in temporalio/contrib/openai_agents/_temporal_model_stub.py:60-72:
async def get_response(
...
*,
previous_response_id: Optional[str],
conversation_id: Optional[str],
prompt: Optional[ResponsePromptParam],
) -> ModelResponse:

Required fix:
async def get_response(
...
*,
previous_response_id: Optional[str] = None,
conversation_id: Optional[str] = None,
prompt: Optional[ResponsePromptParam] = None,
) -> ModelResponse:

Adding = None makes these parameters truly optional, allowing the plugin to work without requiring callers to explicitly pass these arguments. Without this,
the TypeError persists despite the attempted fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions