AI GLOSSARY · AGENTS AND AGENT TOOLING

Code execution (tool)

Markdown version

Definition

Code execution, as an AI tool, lets a model write code and run it in a sandbox, an isolated environment, then use the output. Anthropic offers a code execution tool and OpenAI offers a code interpreter tool for this.

Also called: code interpreter, code execution tool, python tool AI, sandboxed code execution.

In plain language

Language models are weak at exact arithmetic and at reading a large data file by eye. A code execution tool helps by letting the model write a short program, run it in a locked-off workspace and read the result. You upload a spreadsheet, ask for the average by region, and the model computes it instead of guessing. The workspace is separate from your computer, which limits the damage a bad program can do. The limits are practical: the model can still write wrong code, the sandbox has a fixed set of tools, and results are only as good as the file you gave it. Read the code it ran.

Technical definition

Anthropic's code execution tool runs Bash commands and file operations in a sandboxed Linux container, with Python pre-installed. Its documentation says the container has no internet access, so only pre-installed libraries are available, and that each request runs in a new container unless you pass the earlier container ID back. OpenAI's code interpreter tool lets models write and run Python in a sandboxed environment; its documentation describes a container as a fully sandboxed virtual machine that expires if it is not used for 20 minutes. Both are vendor-run tools, not code running on your own machine.

Worked examples in this catalogue

Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.

  1. Skill by Skill Almanac · Illustrative, not executed

    data-analysis-eda 56/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    A fixed exploratory-analysis procedure and CSV profiler that keeps findings descriptive, evidenced and caveated.
    Why it exercises the concept
    Profiling a CSV is a task where running code can beat estimating. The skill keeps findings tied to what was computed.
  2. Skill by Anthropic · Illustrative, not executed

    xlsx 30/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    A skill that opens, edits, fixes and creates spreadsheet files and cleans messy tabular data.
    Why it exercises the concept
    Anthropic's documentation says its tool can analyze data, create and edit files and process uploaded files, which is the kind of work this skill describes.
  3. Coding tool · Illustrative, not executed

    Claude Code

    What you see
    The what-is-claude-code guide says Claude Code can run commands on your machine, and that shell commands outside a fixed read-only list prompt for approval by default.
    Why it exercises the concept
    This is the contrast case. A vendor code execution tool runs in the vendor's sandbox. Claude Code runs commands on your machine under your permission rules.

How it shows up when you use agents

When you attach a data file to a chat or an API request and ask for numbers, charts or a cleaned file, code execution is often the tool doing the work. The model writes code, the vendor runs it in a container and the output comes back into the conversation. Anthropic's documentation says the container has no internet access, so the model cannot download new packages while it works.

Claude Code is a different arrangement. According to the Claude Code permissions documentation, it can run commands on your own machine, and shell commands outside a built-in read-only set require approval by default. Both rely on tool calling: the model asks for an action and the host runs it. A coding agent such as Claude Code adds your repository and your permission rules, where a vendor sandbox starts empty.

What breaks when it is misunderstood: people trust a number because "it ran code". Code can be wrong, or run on the wrong column. The safer habit is to read the code and the output, and to check the result on a small slice by hand.

Next action: upload a small CSV with a known answer, ask for the average of one column, and compare. The Data Analysis EDA skill is a fixed procedure for this kind of check.

Common confusions

  • Code execution versus a coding agent. A code execution tool runs in a vendor sandbox. A coding agent works in your project with your permissions.
  • Sandbox versus your computer. The sandbox is separate from your machine. Per Anthropic's documentation, its container has no outbound network access.
  • Code execution versus the model guessing. Without the tool, a model estimates numbers in text. With it, the model computes them by running a program, which can still contain errors.
  • Code interpreter versus code execution. Vendors use different names for the same idea. OpenAI calls its tool code interpreter and Anthropic calls its tool code execution.

Terms that mention Code execution (tool)

9 terms mention this one

Guides that mention Code execution (tool)

Show all 7 guides

More in Agents and agent tooling

Next steps

  1. data-analysis-eda A skill that exercises it.
  2. AI agent Related term.
  3. Tool calling (function calling) Related term.
  4. All glossary terms A to Z and by family.

Sources

Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-25. Wikipedia is never the only source.

Review record

Last verified

Drafted by claude-sonnet-5-5; sources and example targets checked by Independent automated source review (OpenAI Codex); not human peer review on 2026-11-25. Last verified .

Change log (4)
  • : Independent automated factual/example review completed. Cached US query estimate aligned to receipt; no traffic promise. Final technical gate recorded separately; publication disabled.
  • : First version.
  • : Verifier pass: attributed to permissions docs.
  • : Automated review completed; approved for the staged public release. Search indexing is controlled by the release configuration.