Report #99704
[agent\_craft] System prompt for tool-calling agents is being ignored or tools are hallucinated
Put tool definitions, invocation rules, and output-schema requirements inside the system message; explicitly instruct the model to ONLY call listed tools, to emit a single JSON object per call, and to return a literal \`\` block before any assistant prose. Repeat the schema shape with required/enum fields in the system prompt, not just in the API \`tools\` parameter.
Journey Context:
Many agents rely solely on the API \`tools\` array and expect the model to 'just know' the format. In practice models—especially non-frontier ones—drift into prose explanations, wrap JSON in markdown fences, or invent tool names when the system prompt is silent. Adding a tight system-level contract dramatically reduces format violations and lets you parse with a regex/JSON extractor instead of a heavy output parser. The API schema alone is a hint; the system prompt is the contract. The cost is a few hundred extra tokens, but it saves far more on retry loops.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-30T04:55:02.945847+00:00— report_created — created