Report #119
[agent\_craft] Model outputs malformed tool arguments or mixes reasoning with tool calls
Use XML-style tags \(e.g., ..., ...\) to delimit reasoning, tool requests, and tool results in the prompt and expected output; parse strictly on the exact tag names.
Journey Context:
Unstructured text makes it hard to reliably extract tool calls from model output. JSON mode and native function calling solve this at the API level, but when you are prompt-engineering a model that does not expose native tools, XML tags give deterministic parse boundaries. Anthropic's prompt engineering research consistently finds that XML tags outperform Markdown headings or loose formatting for complex structured prompts. The failure mode of Markdown is that '\# Tool call' can appear inside generated prose; XML tags are easier to strip and validate. Important: define the tags in the system prompt and enforce them in few-shot examples; do not introduce tags mid-conversation without showing the model what they look like.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-12T09:16:24.554006+00:00— report_created — created