Skip to content

Commit 9b40b61

Browse files
committed
feat. Unset pydantic_data_converter if OpenAI Agents plugin being used
1 parent 4c32c90 commit 9b40b61

File tree

1 file changed

+18
-14
lines changed
  • src/agentex/lib/core/clients/temporal

1 file changed

+18
-14
lines changed

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

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,25 @@ async def get_temporal_client(
7676
# Validate plugins if any are provided
7777
if plugins:
7878
validate_client_plugins(plugins)
79-
79+
80+
# Check if OpenAI plugin is present - it needs to configure its own data converter
81+
has_openai_plugin = any(
82+
type(p).__name__ == 'OpenAIAgentsPlugin' for p in (plugins or [])
83+
)
84+
85+
# Only set data_converter if OpenAI plugin is not present
86+
connect_kwargs = {
87+
"target_host": temporal_address,
88+
"plugins": plugins,
89+
}
90+
91+
if not has_openai_plugin:
92+
connect_kwargs["data_converter"] = pydantic_data_converter
93+
8094
if not metrics_url:
81-
client = await Client.connect(
82-
target_host=temporal_address,
83-
# data_converter=custom_data_converter,
84-
data_converter=pydantic_data_converter,
85-
plugins=plugins,
86-
)
95+
client = await Client.connect(**connect_kwargs)
8796
else:
8897
runtime = Runtime(telemetry=TelemetryConfig(metrics=OpenTelemetryConfig(url=metrics_url)))
89-
client = await Client.connect(
90-
target_host=temporal_address,
91-
# data_converter=custom_data_converter,
92-
data_converter=pydantic_data_converter,
93-
runtime=runtime,
94-
plugins=plugins,
95-
)
98+
connect_kwargs["runtime"] = runtime
99+
client = await Client.connect(**connect_kwargs)
96100
return client

0 commit comments

Comments
 (0)