{
  "id": "code-execution-tool",
  "code": "PTL-0138",
  "term": "Code Execution Tool",
  "aliases": [
    "code interpreter",
    "code sandbox",
    "Python tool"
  ],
  "category": "retrieval-tools",
  "definition": "A code execution tool gives a language model a sandboxed environment in which it can write and run code, such as Python or shell commands, and read the output, so that it can compute, analyze data, and check its own work.",
  "description": "Running code replaces error-prone mental arithmetic and lets the model iterate on errors, which is the same idea behind program-aided language models. Sandboxes typically have no network access and resource limits, because the code is model-written and may be influenced by untrusted input.",
  "example": null,
  "broader": [
    "function-calling"
  ],
  "narrower": [],
  "related": [
    "program-aided-language-models",
    "program-of-thoughts",
    "critic",
    "coding-agent"
  ],
  "introduced": null,
  "added": "2026-10-10",
  "sources": [
    {
      "title": "Code execution tool",
      "authors": "Anthropic",
      "year": 2025,
      "url": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool"
    },
    {
      "title": "PAL: Program-aided Language Models",
      "authors": "Gao et al.",
      "year": 2022,
      "url": "https://arxiv.org/abs/2211.10435"
    }
  ],
  "url": "https://protologue.com/t/code-execution-tool/",
  "citation": "Protologue. (2026). Code Execution Tool. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.4.0, PTL-0138). https://protologue.com/t/code-execution-tool/"
}