-
Notifications
You must be signed in to change notification settings - Fork 618
Add OnAgentErrorCallback for error observability #709
Copy link
Copy link
Open
Description
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
OnAgentErrorCallbackinConfigandPlugin. - Update
agent.Runto 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels