Containers API

The Containers API provides secure, stateful, isolated sandboxes where agents can run code and shell commands (for example, Python) to process data.

This API supports multi-step, computation-heavy workflows, such as analysis, file upload and download, and generating artifacts, providing a managed place for agents to run code and apply programmatic logic to complete complex tasks.

Note

The Containers API uses the same format as the OpenAI Containers API. See OpenAI Containers API documentation.

Creating a Container

POST/containers

Reference

Create container

Example:

# create container
container = client.containers.create(
    name="name",
)
print(container.id)
OCI Limitations
Note

Skills and Network Policies aren't supported.

Listing Containers

GET/containers

Reference

List containers

Example:

# list containers
page = client.containers.list()
page = page.data[0]
print(page.id)

Retrieving Container Information

GET/containers/{container_id}

Reference

Retrieve container

Example:

# retrieve container
container = client.containers.retrieve(
    "container_id",
)
print(container.id)

Deleting a Container

DELETE/containers/{container_id}

Reference

Delete container

Example:

# delete container
client.containers.delete(
    "container_id",
)