8000 Add role to the event returned in agent callback sample · fu/adk-python@ff9de71 · GitHub
[go: up one dir, main page]

Skip to content

Commit ff9de71

Browse files
selcukguncopybara-github
authored andcommitted
Add role to the event returned in agent callback sample
Events without a role are filtered out in the next turns. PiperOrigin-RevId: 758393355
1 parent f6bdd55 commit ff9de71

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

contributing/samples/callbacks/agent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ def after_agent_cb1(callback_context):
9292

9393
def after_agent_cb2(callback_context):
9494
print('@after_agent_cb2')
95-
return types.Content(
95+
# ModelContent (or Content with role set to 'model') must be returned.
96+
# Otherwise, the event will be excluded from the context in the next turn.
97+
return types.ModelContent(
9698
parts=[
9799
types.Part(
98100
text='(stopped) after_agent_cb2',

0 commit comments

Comments
 (0)
0