Skip to content

Commit 6a2977f

Browse files
committed
fix(agent_tool): Pass run_config to sub-agent runner for Token Streaming support
1 parent cfb8581 commit 6a2977f

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/google/adk/tools/agent_tool.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,13 @@ async def run_async(
227227
)
228228

229229
last_content = None
230+
invocation_context = tool_context._invocation_context
230231
async with Aclosing(
231232
runner.run_async(
232-
user_id=session.user_id, session_id=session.id, new_message=content
233+
user_id=session.user_id,
234+
session_id=session.id,
235+
new_message=content,
236+
run_config=invocation_context.run_config,
233237
)
234238
) as agen:
235239
async for event in agen:
@@ -269,9 +273,13 @@ async def run_async_with_events(
269273
)
270274

271275
# Yield events from the sub-agent as they are generated
276+
invocation_context = tool_context._invocation_context
272277
async with Aclosing(
273278
runner.run_async(
274-
user_id=session.user_id, session_id=session.id, new_message=content
279+
user_id=session.user_id,
280+
session_id=session.id,
281+
new_message=content,
282+
run_config=invocation_context.run_config,
275283
)
276284
) as agen:
277285
async for event in agen:

0 commit comments

Comments
 (0)