Implement a robust reason-act tool-use loop for an LLM agent with bounded iteration, error recovery, and reliable termination.
## CONTEXT You are implementing the core reason-act loop that lets an LLM agent interleave thinking, tool calls, and observations until it completes a task. This loop is where agents most often misbehave: looping forever, repeating failed tool calls, or stopping prematurely. The user wants a reliable, bounded,…
Premium Prompt
Unlock this prompt — and all 25,000+ expert-crafted prompts — with Pro.
Unlock with Pro