-
Notifications
You must be signed in to change notification settings - Fork 141
Description
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
- Install temporalio 1.18.1 and openai-agents 0.2.7
- Set up any basic Temporal workflow using the OpenAI agents plugin
- Run the workflow
- 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.