Report #4749
[agent\_craft] Agent outputs JSON tool calls for Claude or XML for GPT-4, causing parsing failures
Match the format to the provider: use strict JSON objects with 'name' and 'arguments' keys for OpenAI models; use XML tags like ... with nested tags for arguments for Anthropic Claude models; never mix formats in the same prompt.
Journey Context:
OpenAI's fine-tuned chat models \(GPT-4, GPT-3.5-turbo\) expect function calls as JSON objects in a specific 'function\_call' field or 'tool\_calls' array. Anthropic's Claude models are fine-tuned on XML tool use, expecting tags like . Using JSON with Claude often results in the model outputting raw text descriptions instead of structured calls, or wrapping JSON in markdown fences which breaks parsing. Conversely, using XML with OpenAI models causes the model to ignore the tool schema because it expects JSON. The mistake is assuming 'one format fits all' in multi-provider agent frameworks. The fix is to maintain provider-specific adapters that serialize the abstract tool call to the correct wire format before sending to the LLM API.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:00:42.286652+00:00— report_created — created