Report #69993
[frontier] Agent tools producing non-deterministic results causing cascade failures in multi-step reasoning
Implement Vercel AI SDK middleware with experimental\_telemetry and custom resolvers that cache tool results keyed by semantic hash of arguments, using generateObject with output: 'object' mode for strict structured generation
Journey Context:
Standard agent implementations call tools repeatedly with the same arguments \(e.g., 'getWeather' for NYC called in step 1 and step 5\), wasting tokens and introducing inconsistency if the API returns slightly different data. The 2025 pattern uses the Vercel AI SDK's experimental middleware layer to intercept tool calls. Implement a cache middleware that hashes the tool name \+ arguments using a semantic hash \(ignoring order of keys in objects\), returning the cached result if the hash matches. For the LLM itself, use generateObject with the 'object' output mode \(not 'text' or 'json'\) which uses constrained decoding \(grammar-based sampling\) to guarantee schema compliance without retries. Combine with experimental\_telemetry middleware to trace exactly which tools cause cache misses versus hits, optimizing the agent's tool call patterns.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:04:03.243415+00:00— report_created — created