Report #95436
[synthesis] Syntax errors when executing code passed as a string tool argument because it contains markdown fences
Add post-processing to strip markdown fences \(e.g., \`\`\`python ... \`\`\`\) from string tool arguments before execution, and add to the system prompt: 'When passing code or raw strings to tool parameters, never wrap them in markdown formatting.'
Journey Context:
When a tool expects a code snippet as a string parameter, GPT-4o generally passes the raw string. Claude 3.5 Sonnet frequently wraps the string in markdown code blocks, assuming the output is being read by a human. This causes syntax errors \(e.g., NameError\) when the agent actually executes the code. Application-level stripping is the most robust cross-model fix.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:46:09.900195+00:00— report_created — created