# Code Execution (Code Interpreter)

> Code execution lets an AI assistant write and run real code in a sandbox, so numbers, files, and charts come from a computation rather than an estimate.

Code execution, also called code interpreter, is the capability that lets an assistant write and run code in a sandboxed container instead of reasoning about numbers in text. It is the single feature that separates real analysis from a plausible-looking answer, and the container is isolated from your systems with its outbound network tightly controlled.

**Code execution, often called code interpreter, is the capability that lets an AI assistant write real code and run it in a sandboxed container, then use the output in its answer.** For anyone working with data, it is the line between analysis and plausible-sounding text.

The mechanics are consistent across products. You upload a file, the model writes code, a container runs it, and the results come back as tables, charts, or files. [ChatGPT](/tools/chatgpt) runs Python in a stateful notebook session where variables persist between turns. [Claude](/tools/claude) runs code in an isolated container and can turn the result into a real `.xlsx`, `.docx`, `.pptx`, or PDF, with a documented ceiling of 30MB per file for uploads and downloads. Neither sandbox browses on your behalf, which is a safety property rather than a limitation: any data you want analyzed has to be uploaded or connected first. OpenAI's environment cannot make external web requests at all; Claude's API container has internet access completely disabled, while in the Claude apps outbound network egress is a capability setting, on by default for Free, Pro, and Max and off by default for Team and Enterprise.

The practical consequence for an analyst is that the code is the audit trail. When an assistant hands you a number, the question worth asking is whether it ran something. If it did, read the code, check the filters, and the answer becomes verifiable in the same way a colleague's notebook is. If it did not, treat the number as a [hallucination](/glossary/hallucination) risk regardless of how confident it sounds.

The workflow built on it is [Claude for data analysis](/guides/analytics/claude-for-data-analysis), and the two big assistants are compared in [ChatGPT vs Claude for data analysis](/guides/comparisons/chatgpt-vs-claude-for-data-analysis). For how a model decides to call this tool at all, see [AI agent](/glossary/ai-agent).

---

_Source: https://agentscamp.com/glossary/code-execution — Term on AgentsCamp._
