Report #94559
[agent\_craft] Agent loops infinitely retrying failed tool calls with identical parameters instead of parsing stderr or adjusting arguments
Implement the ReAct \(Reasoning \+ Acting\) loop where the LLM observes the error message \(stderr/exit code\), reasons about the failure cause \(e.g., FileNotFound vs PermissionDenied\), and generates a new Action with corrected parameters. Force the model to output 'Thought: \[reasoning\]' before 'Action: \[tool\_call\]'.
Journey Context:
Naive agents call a tool, get an error, and either fail immediately or retry blindly. Effective agents \(ReAct pattern, Yao et al. 2022\) treat the environment as a stateful loop: Thought -> Action -> Observation -> ... The 'Observation' must include rich error context, not just 'failed.' For example, if \`cat file.txt\` fails, the observation should include 'Error: No such file or directory,' leading the LLM to Thought: 'The file doesn't exist; I should create it first or check the path.' Without this structured reasoning step, agents cannot recover from transient or semantic errors. The explicit 'Thought:' prefix forces the model to generate the reasoning trace before the action, preventing reflexive retries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:18:02.276041+00:00— report_created — created