Skip to content

Commit 1f8cfb5

Browse files
committed
Fix streaming bugs
1 parent 03e4078 commit 1f8cfb5

File tree

1 file changed

+20
-4
lines changed
  • src/agentex/lib/adk/providers/_modules

1 file changed

+20
-4
lines changed

src/agentex/lib/adk/providers/_modules/openai.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def __init__(
6565
async def run_agent(
6666
self,
6767
input_list: list[dict[str, Any]],
68-
mcp_server_params: list[StdioServerParameters],
6968
agent_name: str,
7069
agent_instructions: str,
70+
mcp_server_params: list[StdioServerParameters] | None = None,
7171
trace_id: str | None = None,
7272
parent_span_id: str | None = None,
7373
start_to_close_timeout: timedelta = timedelta(seconds=600),
@@ -119,6 +119,10 @@ async def run_agent(
119119
Returns:
120120
Union[SerializableRunResult, RunResult]: SerializableRunResult when in Temporal, RunResult otherwise.
121121
"""
122+
# Default to empty list if not provided
123+
if mcp_server_params is None:
124+
mcp_server_params = []
125+
122126
if in_temporal_workflow():
123127
params = RunAgentParams(
124128
trace_id=trace_id,
@@ -174,9 +178,9 @@ async def run_agent_auto_send(
174178
self,
175179
task_id: str,
176180
input_list: list[dict[str, Any]],
177-
mcp_server_params: list[StdioServerParameters],
178181
agent_name: str,
179182
agent_instructions: str,
183+
mcp_server_params: list[StdioServerParameters] | None = None,
180184
trace_id: str | None = None,
181185
parent_span_id: str | None = None,
182186
start_to_close_timeout: timedelta = timedelta(seconds=600),
@@ -227,6 +231,10 @@ async def run_agent_auto_send(
227231
Returns:
228232
Union[SerializableRunResult, RunResult]: SerializableRunResult when in Temporal, RunResult otherwise.
229233
"""
234+
# Default to empty list if not provided
235+
if mcp_server_params is None:
236+
mcp_server_params = []
237+
230238
if in_temporal_workflow():
231239
params = RunAgentAutoSendParams(
232240
trace_id=trace_id,
@@ -283,9 +291,9 @@ async def run_agent_auto_send(
283291
async def run_agent_streamed(
284292
self,
285293
input_list: list[dict[str, Any]],
286-
mcp_server_params: list[StdioServerParameters],
287294
agent_name: str,
288295
agent_instructions: str,
296+
mcp_server_params: list[StdioServerParameters] | None = None,
289297
trace_id: str | None = None,
290298
parent_span_id: str | None = None,
291299
handoff_description: str | None = None,
@@ -340,6 +348,10 @@ async def run_agent_streamed(
340348
Raises:
341349
ValueError: If called from within a Temporal workflow
342350
"""
351+
# Default to empty list if not provided
352+
if mcp_server_params is None:
353+
mcp_server_params = []
354+
343355
# Temporal workflows should use the auto_send variant
344356
if in_temporal_workflow():
345357
raise ValueError(
@@ -373,9 +385,9 @@ async def run_agent_streamed_auto_send(
373385
self,
374386
task_id: str,
375387
input_list: list[dict[str, Any]],
376-
mcp_server_params: list[StdioServerParameters],
377388
agent_name: str,
378389
agent_instructions: str,
390+
mcp_server_params: list[StdioServerParameters] | None = None,
379391
trace_id: str | None = None,
380392
parent_span_id: str | None = None,
381393
start_to_close_timeout: timedelta = timedelta(seconds=600),
@@ -426,6 +438,10 @@ async def run_agent_streamed_auto_send(
426438
Returns:
427439
Union[SerializableRunResultStreaming, RunResultStreaming]: SerializableRunResultStreaming when in Temporal, RunResultStreaming otherwise.
428440
"""
441+
# Default to empty list if not provided
442+
if mcp_server_params is None:
443+
mcp_server_params = []
444+
429445
if in_temporal_workflow():
430446
params = RunAgentStreamedAutoSendParams(
431447
trace_id=trace_id,

0 commit comments

Comments
 (0)