-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Plugin framework: on_state_change_callback is never invoked #4393
Copy link
Copy link
Closed
Labels
bq[Component] This issue is related to Big Query integration[Component] This issue is related to Big Query integrationrequest clarification[Status] The maintainer need clarification or more information from the author[Status] The maintainer need clarification or more information from the authorstale[Status] Issues which have been marked inactive since there is no user response[Status] Issues which have been marked inactive since there is no user response
Metadata
Metadata
Assignees
Labels
bq[Component] This issue is related to Big Query integration[Component] This issue is related to Big Query integrationrequest clarification[Status] The maintainer need clarification or more information from the author[Status] The maintainer need clarification or more information from the authorstale[Status] Issues which have been marked inactive since there is no user response[Status] Issues which have been marked inactive since there is no user response
Description
The plugin framework provides hooks for various lifecycle events (before/after agent, tool, model callbacks, etc.), but there is no mechanism to notify plugins when session state changes occur via
event.actions.state_delta.The
BigQueryAgentAnalyticsPluginalready implements anon_state_change_callback()method, demonstrating real demand for this hook, but the framework never invokes it because:BasePluginhas no defaulton_state_change_callbackmethodPluginManagerhas no dispatcher for itExpected Behavior
When an event with a non-empty
state_deltais yielded from the runner, all registered plugins should have theiron_state_change_callbackinvoked with the state delta (as a copy, to prevent mutation).Proposed Solution
on_state_change_callbacktoBasePluginas a default no-op method"on_state_change_callback"toPluginCallbackNameand arun_on_state_change_callbackdispatcher toPluginManagerRunner._exec_with_plugin, after yielding the final event, check forstate_deltaand invoke the callbackThe callback should be observational (return value ignored) and receive a copy of the state delta to prevent plugins from mutating event state.