Report #53483
[agent\_craft] Agent hallucinates tool parameters or ignores tool schema constraints
Wrap tool definitions in XML tags \(e.g., read\_file...\) and place these definitions at the END of the system prompt to leverage recency bias for constraint adherence.
Journey Context:
Many agents place tool schemas at the beginning of the system prompt or use loose JSON descriptions. This leads to the model ignoring optional parameters or inventing arguments, especially when the user's request \(in the user message\) comes after and contradicts the schema. By wrapping tool definitions in strict XML-like tags and placing them at the very end of the system prompt \(just before the user message\), you leverage the model's recency bias—later instructions are weighted more heavily. This is critical when using models without native tool-calling APIs. Alternative: Native function calling \(OpenAI/Anthropic\) handles this automatically, but for local models or base LLMs, XML-structured schemas at the end of the prompt is the robust pattern.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:15:57.109865+00:00— report_created — created