Repository navigation
Commit a4b8ee9
feat(plugins): classify error-bearing tool results and extract shared callback helpers
- Introduce `ToolResultClassification` and `ToolResultClassifier` in
`google.adk.plugins._callback_helpers`, re-exported from `google.adk.plugins`
and `bigquery_agent_analytics_plugin`, so an application can classify tool
results that report a failure without raising an exception.
- Record, per plugin instance, a weak reference to the `ToolContext` whose
failure `on_tool_error_callback` recorded, so `after_tool_callback` does not
record the same failure again when a recovery plugin's answer reaches it as
the call's result. Two plugins in one runner never consume each other's
marker.
- Record `ReflectAndRetryToolPlugin` answers and MCP `CallToolResult` results
with `isError` set as `TOOL_ERROR` rows in `BigQueryAgentAnalyticsPlugin`.
The new `BigQueryLoggerConfig.tool_result_classifier` lets an application
classify its own tools' results: an `OK` verdict keeps `TOOL_COMPLETED` where
the MCP rule would record a failure, but cannot hide a retry answer.
- Record the exception type name as the `TOOL_ERROR` message when a raised
error has no message, matching what a `ReflectAndRetryToolPlugin` answer
records for it.
- Add `TOOLBOX` and `SKILL` tool origin detection, and inspect tool results
without running their code, so a hostile or malformed result cannot raise
into a callback or leak its content into a log.
- Move the model finish and block reason codes and the durable workflow node
error check into `_callback_helpers` for the other observability plugins to
share.
Fixes #7112
Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 10013171851 parent 18a41a5 commit a4b8ee9
4 files changed
Lines changed: 3686 additions & 23 deletions
File tree
- src/google/adk/plugins
- tests/unittests/plugins
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| 46 | + | |
| 47 | + | |
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
| |||
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
| 61 | + | |
| 62 | + | |
57 | 63 | | |
58 | 64 | | |
59 | 65 | | |
| |||
0 commit comments