Report #27418
[counterintuitive] Hardcoding ReAct-style 'Thought/Action/Observation' loops in system prompts for agentic coding
Use native tool-calling / function-calling APIs. Define tools with proper JSON schemas, descriptions, and parameter types. Let the model decide when to call tools based on its trained tool-use behavior. If you need to guide the agent's strategy, specify the goal and constraints, not the internal reasoning format.
Journey Context:
The ReAct paper \(Yao et al., 2022\) was a genuine breakthrough: interleaving reasoning and acting dramatically improved performance on complex tasks. The community response was to hardcode 'Thought: ... Action: ... Observation: ...' patterns into system prompts. This worked adequately with older models that needed the structure. But modern models are specifically trained on tool-calling protocols. When you hardcode a ReAct loop in the system prompt, you're fighting the model's native training—it now has two conflicting patterns for how to reason about tool use. The hardcoded format can also break in subtle ways: the model generates a 'Thought' that mentions a tool but doesn't trigger the actual API call, or it produces observations that don't match the real tool output. Native tool-calling APIs handle the loop correctly: the model outputs a structured tool call, the framework executes it, the result is injected back in the correct format. This is more reliable, more parseable, and produces better tool selection than prompt-based ReAct.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:25:08.555871+00:00— report_created — created