Example: find the source of refund assistant latency
A request might select tools, guard a refund and review the answer. Added latency may come from generation, order APIs or JEV retries. Record version, budget and latency per judgment and correlate tool results from the same run instead of relying on total Agent time alone.Set a decision budget and register an observer
The example uses a bounded in-memory queue to show the observer boundary. In production an asynchronous consumer can drain it into your telemetry system.offer returns false and the example drops that observation without blocking the Agent. This is not reliable auditing. Track drops if needed and attach the current run/session before enqueueing. Each decision budget includes all its batches, retries and backoff, not the whole Agent. Response roundBudget includes original generation. Browser budgets include actions and verification. See each Source-taking overload for whether it also bounds reading.
Observers should return promptly. RuntimeExceptions are isolated, but synchronous blocking callbacks do not automatically receive a background thread or extra timeout. Bound HTTP, data-source and storage operations separately.
Fields to record
Do not count a SHADOW model recommendation as a dispatch, or a recommended denial as a prevented tool call. Stage-routing CallRecord records dispatch and model usage. Trace, code review and evidence reports record judgment requests in calls. Missing usage means unknown cost, not zero.