mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: runner was expecting Event object instead of Content object when using early exist feature
PiperOrigin-RevId: 788516645
This commit is contained in:
committed by
Copybara-Service
parent
9c0721beaa
commit
bf72426af2
@@ -258,16 +258,17 @@ class Runner:
|
||||
early_exit_result = await plugin_manager.run_before_run_callback(
|
||||
invocation_context=invocation_context
|
||||
)
|
||||
if isinstance(early_exit_result, Event):
|
||||
if isinstance(early_exit_result, types.Content):
|
||||
early_exit_event = Event(
|
||||
invocation_id=invocation_context.invocation_id,
|
||||
author='model',
|
||||
content=early_exit_result,
|
||||
)
|
||||
await self.session_service.append_event(
|
||||
session=session,
|
||||
event=Event(
|
||||
invocation_id=invocation_context.invocation_id,
|
||||
author='model',
|
||||
content=early_exit_result,
|
||||
),
|
||||
event=early_exit_event,
|
||||
)
|
||||
yield early_exit_result
|
||||
yield early_exit_event
|
||||
else:
|
||||
# Step 2: Otherwise continue with normal execution
|
||||
async for event in execute_fn(invocation_context):
|
||||
|
||||
Reference in New Issue
Block a user