Skip to content

Commit e767013

Browse files
authored
Add workaround for case where un-picklable types are passed to Runner (#997)
1 parent beb9c9d commit e767013

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

temporalio/contrib/openai_agents/_openai_runner.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import typing
23
from dataclasses import replace
34
from typing import Any, Union
@@ -13,6 +14,7 @@
1314
TResponseInputItem,
1415
)
1516
from agents.run import DEFAULT_AGENT_RUNNER, DEFAULT_MAX_TURNS, AgentRunner
17+
from pydantic_core import to_json
1618

1719
from temporalio import workflow
1820
from temporalio.contrib.openai_agents._model_parameters import ModelActivityParameters
@@ -57,6 +59,11 @@ async def run(
5759
"Temporal OpenAI agent does not support on demand MCP servers."
5860
)
5961

62+
# workaround for https://github.com/pydantic/pydantic/issues/9541
63+
# ValidatorIterator returned
64+
input_json = to_json(input)
65+
input = json.loads(input_json)
66+
6067
context = kwargs.get("context")
6168
max_turns = kwargs.get("max_turns", DEFAULT_MAX_TURNS)
6269
hooks = kwargs.get("hooks")

0 commit comments

Comments
 (0)