Report #30735
[frontier] Agent calls tool but fails to process result or continue the loop, stopping after single tool use
Use AI SDK's maxSteps with tool designs that force continuation: set maxSteps to 10-15, ensure tools return prompts demanding next action, and let the SDK handle the loop primitive rather than manual while-loops
Journey Context:
The 'agent loop' is often implemented manually by developers checking if response.tool\_calls exists and looping. This is error-prone: you forget to increment a counter causing infinite loops, don't handle tool errors properly causing crashes, or the LLM generates text when it should call a tool. The 2025 Vercel AI SDK insight is that the 'agent' should be a first-class primitive with maxSteps and automatic tool-call loops built-in. But the hard-won detail is that you must design your tools to 'force continuation' - for example, a 'search' tool should return its results with a prompt like 'Based on these results, call the analyze tool' or the system prompt must explicitly state 'you must continue calling tools until you have all information'. Without this, the LLM stops after one step even with maxSteps available. We tried using while True loops with manual checks, but handling streaming and error recovery was too complex. The SDK's built-in maxSteps with proper tool design is the production-grade approach.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T05:58:23.878694+00:00— report_created — created