Feature Request
We need a mechanism in the ADK framework to intercept errors that occur during agent execution (e.g., in agent.Run). This is crucial for enabling observability metrics, such as tracking agent failure counts in plugins.
Rationale
Currently, there is no standardized way for plugins to listen for or handle errors yielded by agent.Run. This makes it difficult to implement cross-cutting concerns like failure metrics or centralized error logging within the ADK ecosystem without modifying individual agent implementations.
Proposed Solution
Introduce an OnAgentErrorCallback mechanism:
- Allow registering
OnAgentErrorCallback in Config and Plugin.
- Update
agent.Run to trigger these callbacks when an error occurs.
- Broadcast errors to all registered plugins via
PluginManager.
This will allow an observability plugin to increment an error counter whenever an agent fails, providing valuable telemetry.
Reference Implementation
See PR #708 for the proposed implementation.
Feature Request
We need a mechanism in the ADK framework to intercept errors that occur during agent execution (e.g., in
agent.Run). This is crucial for enabling observability metrics, such as tracking agent failure counts in plugins.Rationale
Currently, there is no standardized way for plugins to listen for or handle errors yielded by
agent.Run. This makes it difficult to implement cross-cutting concerns like failure metrics or centralized error logging within the ADK ecosystem without modifying individual agent implementations.Proposed Solution
Introduce an
OnAgentErrorCallbackmechanism:OnAgentErrorCallbackinConfigandPlugin.agent.Runto trigger these callbacks when an error occurs.PluginManager.This will allow an observability plugin to increment an error counter whenever an agent fails, providing valuable telemetry.
Reference Implementation
See PR #708 for the proposed implementation.