Commit 08456dc
yana-gi
docs(plugins): correct before_run_callback flow control behavior
The "Runner start callbacks" section described `before_run_callback` as
returning a `types.Content` to "replace the user's original message". That is
actually the behavior of `on_user_message_callback`; the text (including the
"Purpose" line) was duplicated from that section.
In the implementation, returning a `Content` from `before_run_callback` halts
the run: the Runner yields it as an early-exit event and skips all subsequent
processing instead of invoking the agent.
See `Runner._exec_with_plugin` in `src/google/adk/runners.py`:
early_exit_result = await plugin_manager.run_before_run_callback(...)
if isinstance(early_exit_result, types.Content):
early_exit_event = Event(..., content=early_exit_result)
...
yield early_exit_event # early exit, agent never runs
else:
# normal execution
This also matches the BasePlugin docstring: "Returning a value to halt
execution of the runner and ends the runner with that event."
Fix the "When It Runs", "Purpose", and "Flow Control" bullets accordingly.1 parent 9db36de commit 08456dc
1 file changed
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
796 | 796 | | |
797 | 797 | | |
798 | 798 | | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
| |||
0 commit comments