What it does
When enabled, the agent can call OpenAI’s hosted python tool to write and run Python in an ephemeral container. Use it when you need exact results that language models alone cannot guarantee — for example splitting spreadsheet rows into precise batches, computing statistics, or transforming tabular data. Important: Code Interpreter is for computation only. Downloadable files (PDF, DOCX, XLSX, CSV) are still created through File Tools (write_file). The agent should print results as CSV/JSON text, then call write_file so Fetch Hive stores a real asset in your workspace.
Requirements
- Agent provider must be OpenAI.
- The tool is not enabled by default — add it from the tool picker.
Adding the tool to an agent
- Open an agent in the editor.
- Click the button with the tooltip Add MCP Tool or Sub Agent.
- In MCP Tools, click OpenAI Code Interpreter.
How it works with File Tools
Typical flow for spreadsheet slicing:- The agent (or File Tools
read_file) loads the source data. - Code Interpreter runs Python to slice or transform the data and prints CSV/JSON.
- The agent calls
write_filewith that text to create downloadable XLSX/CSV assets.
write_file for user-facing files.
Limitations (v1)
- OpenAI only — Anthropic and xAI code-execution tools are not wired yet.
- No multi-turn Python state — each agent turn starts a fresh container; variables from a previous turn do not persist.
- Fixed 1 GB memory — higher OpenAI memory tiers are not exposed yet.
- Each Code Interpreter call counts as 1 task credit (same pattern as GPT Search). Container-minute spend is tracked only as estimated operator metadata (
estimated: true) on the completion — not a separate user-facing USD line item. On hosted keys, OpenAI container minutes are absorbed by Fetch Hive.
Use cases
- Exact row slicing (rows 1–50, 51–100, …) before exporting XLSX batches.
- Numerical / statistical calculations that must be precise.
- Parsing or reshaping tabular data before writing a file.
Notes
- Use Testing with Chat to watch Code Interpreter and File Tools calls during a conversation.
- To add or remove tools from an agent, see Creating and Configuring.
- See also File Tools for creating downloadable assets.

