Skip to content

Commit aab3d73

Browse files
committed
feat. Unset pydantic_data_converter if OpenAI Agents plugin being used
1 parent b272739 commit aab3d73

File tree

1 file changed

+17
-13
lines changed
  • src/agentex/lib/core/clients/temporal

1 file changed

+17
-13
lines changed

src/agentex/lib/core/clients/temporal/utils.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,24 @@ async def get_temporal_client(temporal_address: str, metrics_url: str | None = N
7474
if plugins:
7575
validate_client_plugins(plugins)
7676

77+
# Check if OpenAI plugin is present - it needs to configure its own data converter
78+
has_openai_plugin = any(
79+
type(p).__name__ == 'OpenAIAgentsPlugin' for p in (plugins or [])
80+
)
81+
82+
# Only set data_converter if OpenAI plugin is not present
83+
connect_kwargs = {
84+
"target_host": temporal_address,
85+
"plugins": plugins,
86+
}
87+
88+
if not has_openai_plugin:
89+
connect_kwargs["data_converter"] = pydantic_data_converter
90+
7791
if not metrics_url:
78-
client = await Client.connect(
79-
target_host=temporal_address,
80-
# data_converter=custom_data_converter,
81-
data_converter=pydantic_data_converter,
82-
plugins=plugins,
83-
)
92+
client = await Client.connect(**connect_kwargs)
8493
else:
8594
runtime = Runtime(telemetry=TelemetryConfig(metrics=OpenTelemetryConfig(url=metrics_url)))
86-
client = await Client.connect(
87-
target_host=temporal_address,
88-
# data_converter=custom_data_converter,
89-
data_converter=pydantic_data_converter,
90-
runtime=runtime,
91-
plugins=plugins,
92-
)
95+
connect_kwargs["runtime"] = runtime
96+
client = await Client.connect(**connect_kwargs)
9397
return client

0 commit comments

Comments
 (0)