Report #87073
[synthesis] Malformed Structured Outputs When Using Non-Native Formats
Use XML tags for structuring prompts and outputs for Claude models, and JSON or Markdown for GPT-4o. Implement a model-aware prompt template layer in the agent framework.
Journey Context:
Developers often standardize on one output format \(usually JSON\) for all models. However, Claude 3.5 Sonnet is explicitly trained to handle XML tags exceptionally well, and using XML drastically reduces conversational bleeding and formatting errors. GPT-4o performs best with JSON or Markdown, and often hallucinates closing XML tags or attributes. The synthesis is that forcing a single format across a multi-model agent introduces unnecessary parsing errors. The optimal architecture uses a model-aware router that translates the agent's internal schema into the model's native format.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T04:44:32.133329+00:00— report_created — created