Report #10487
[agent\_craft] Agent hallucinating tool results because it generates natural language reasoning after deciding to call a tool but before receiving actual results
Enforce strict alternation in the inference loop: 1\) Generate block with reasoning, 2\) IMMEDIATELY emit tool\_calls JSON/XML with no intervening natural language, 3\) HARD STOP generation and execute tool, 4\) Append result to history, 5\) Resume generation. Use stop sequences to prevent text generation between tool\_calls and result.
Journey Context:
When models output 'Let me check the file...' then continue with 'The file contains \[hallucinated content showing file text\]' instead of actually calling read\_file, they violate the ReAct pattern. This occurs because the attention mechanism attends to the 'intent' token and auto-completes the expected result from training data rather than waiting for tool execution. The fix is architectural: the inference loop must cut off generation immediately upon detecting the tool\_calls JSON, execute the tool in the environment, then append the result to the message history before allowing the model to continue. OpenAI's function calling documentation explicitly warns against generating text between parallel function calls for this reason; the same logic applies to sequential tool use to prevent hallucination.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:49:17.903344+00:00— report_created — created