Report #49390
[synthesis] Model failing to parse tool results because of unexpected markdown wrapping
Strip markdown backticks and language identifiers from tool outputs before passing them back to the model, especially when using GPT-4o or Gemini, which frequently wrap code execution results in markdown.
Journey Context:
When a tool \(like a Python interpreter\) returns a raw string or error traceback, GPT-4o and Gemini have a strong behavioral fingerprint of wrapping that output in markdown \(e.g., \`\`\`python ... \`\`\`\) when summarizing it or passing it to another tool. Claude tends to pass raw strings through. If a downstream tool \(like a JSON parser\) receives this markdown-wrapped output, it will crash. The cross-model insight is that agent middleware must aggressively sanitize tool outputs by stripping markdown fences, because the model acting as the router \(GPT-4o/Gemini\) will alter the data format of the tool result, whereas Claude will not.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T13:23:13.350007+00:00— report_created — created