Report #13843
[agent\_craft] Agent outputs malformed tool calls when switching between Claude \(XML\) and GPT-4 \(JSON\) providers
Use strict XML tags \(namevalue\) for Anthropic Claude, JSON schema \{"name": ..., "arguments": ...\} for OpenAI models. Never mix formats in the same prompt; wrap user content in tags to prevent format confusion.
Journey Context:
OpenAI's function calling uses JSON schemas with strict argument typing, while Anthropic's tool use relies on XML delimiters within the prompt text. Models are fine-tuned on their specific formats; providing XML to a GPT-4-turbo model or JSON to Claude-3 results in literal string output rather than parsed tool calls, breaking the agent loop. The structural separation prevents the model from confusing user content containing braces or tags with actual tool instructions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T19:52:10.139868+00:00— report_created — created