All capabilities Data and analysis
Let the model write and run real code mid-answer
Instead of describing an analysis, the model executes it in a sandbox, reads the actual output, and corrects itself before answering.
DocsOfficially documentedTestNot tested by benchr
Claude APIGemini APIClaude Opus 5Claude Sonnet 5+4
Overview
- Runs Python, and on Anthropic's tool also bash, inside a sandboxed container with a filesystem it can read and write.
- Turns arithmetic and data questions from a guessing task into a computed one.
- Renders charts inline on Gemini, where Matplotlib figures come back as images in the response.
How it works
- 01Attach the code execution tool and upload the input file rather than pasting the data into the prompt.
- 02Ask for the artefact and the code that produced it, so the result is auditable.
- 03Keep each run small. Gemini's environment stops at 30 seconds of runtime and allows up to five automatic regeneration attempts after an error.
- 04Expect text and CSV to behave best; both vendors describe those as the well-supported inputs.
Limits
- Anthropic's code execution is not eligible for zero data retention, and it is unavailable on Amazon Bedrock and Google Cloud.
- On Claude Haiku 4.5, programmatic tool calling and REPL state persistence are unavailable, so newer tool versions behave like the 2025 one.
- Gemini's sandbox caps runtime at 30 seconds and cannot return media artefacts other than inline Matplotlib output.
- Skills running on the Claude API sandbox have no network access and cannot install packages at runtime.
Verification
benchr test runs
benchr has not run this capability. No test has been published.
benchr test runs →
Evidence
Sources
- Anthropic - Code execution tool: models, platforms and constraints Tier 1 · September 1, 2026
- Google - Gemini code execution: 30-second runtime, library set, output rules Tier 1 · September 1, 2026
Not stated by the source
- The exact package list available in each vendor's sandbox on any given day
- Memory or CPU allocation for either environment
Source-check history
- September 1, 2026DocsOfficially documentedFirst logged from both vendors' current tool pages, including the Haiku 4.5 exception and Gemini's 30-second cap.
Changes
Provider changes affecting this
- August 31, 2026Claude Sonnet 5Pricing changed
- August 21, 2026Gemini 3.7 FlashModel released
- July 3, 2026Claude Sonnet 5Pricing changed
- July 1, 2026Claude Sonnet 5Model released