Skip to main content

Code Interpreter Tool

Code Interpreter allows agents to write and run Python code in a sandboxed execution environment. Agents can iteratively solve complex problems involving code, math, data analysis, or create graphs and charts.

Key Features

  • Iterative execution: Agents can modify and retry code until it works
  • Data analysis: Process CSV files and perform calculations
  • Visualizations: Generate charts and graphs
  • File support: Upload and download files
  • Automatic retry: Failed code is automatically revised
Code Interpreter has additional charges beyond token-based fees. Each concurrent session is billed separately (active for 1 hour by default, 30-minute idle timeout).

Quick Start

Attaching Files

Supported File Types

  • Code: .py, .js, .java, .cpp, .c
  • Data: .csv, .json, .xml, .xlsx
  • Documents: .pdf, .docx, .txt, .md
  • Images: .jpg, .png, .gif
See File Search Tool for document retrieval.