Code Interpreter in OCI Generative AI

The Code Interpreter tool in OCI Generative AI runs Python code in an isolated execution environment for analysis and computation. The environment includes 420+ preinstalled libraries and has no external network access, supporting safer execution for data processing and reasoning workflows.

For API, see Containers API.

Container Memory Limits

A total memory pool of 64 GB per tenancy is supported, allowing multiple containers with different memory sizes to match workload needs (for example, sixty-four 1GB containers, sixteen 4GB containers, or a single 64GB container).

  • Supported sizes: 1GB, 4GB, 16GB, and 64GB
  • Expansion: If a higher total capacity is required, submit a Service Request to increase the limit.

Container Expiry

  • A container expires if it's not used for 20 minutes.
  • An expired container can't be reactivated. Create a new container and upload files again. Any in-memory state (such as Python objects) from the expired container is lost.

Example

response = client.responses.create(
    model="openai.gpt-oss-120b",
    tools=[
        {
            "type": "code_interpreter",
            "container": {"type": "auto", "memory_limit": "4g"}
        }
    ],
    instructions="write and run code using the Python tool to answer the question",
    input="I need to solve the equation 3x + 11 = 14. Can you help me?",
)

print(response.output_text)

The Python tool in this example is the code interpreter.