modal-openai
Run OpenAI Agents in Modal Sandboxes. OpenAI runs the agent; Modal provides an isolated environment where it can run commands and edit files.
Getting started
You need Python 3.12+, uv, a Modal account, and an OpenAI project with Agents API access. Your GitHub account must have access to the Agents API SDK.
git clone https://github.com/modal-labs/modal-openai.git
cd modal-openai
uv sync --locked
uv run modal setup
uv run modal-agents init research-agent
Setup guides you through selecting or creating an agent, configuring credentials, and deploying its sandbox configuration. Have your OpenAI application key and a separate restricted executor key ready. See credentials for the required permissions.
When prompted, register the supplied URL in
OpenAI Project Webhooks
for agent.session.action_required and agent.session.failed, then paste the
signing secret back into setup.
Get a response
Ask the agent to run a command and tell you a joke:
uv run modal-agents smoke research-agent \
--prompt "Use the shell to print hello, then tell me a joke."
The command prints the agent's response and cleans up the test session and sandbox. It uses your OpenAI application key and incurs normal OpenAI and Modal usage charges.
For sessions in your own application, see examples/session.py.
Use the agent ID saved in agents/research-agent.py and the same workspace path
(default /workspace).
Configure the sandbox
Edit agents/research-agent.py to choose the image, CPU, memory, GPU, and timeout.
For example, add .pip_install("pandas", "matplotlib") to the image for data
analysis, or set gpu="A10G" for GPU workloads.
Deploy your changes:
uv run modal-agents deploy research-agent
New sandboxes use the updated configuration. Files remain available for the sandbox's lifetime, which defaults to 30 minutes.
More
License
MIT.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modal_openai-0.1.0.tar.gz.
File metadata
- Download URL: modal_openai-0.1.0.tar.gz
- Upload date:
- Size: 185.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a414fbf615b16f7b836812122ecd4429e72f7c21ceaf0846b1e60dc05483c688
|
|
| MD5 |
0e683d1875f02dcd7ff52c891ba7edeb
|
|
| BLAKE2b-256 |
65c55f2c274e34499cc4bcbfebb895af84602953d8ca186528a6b7445eb3364d
|
Provenance
The following attestation bundles were made for modal_openai-0.1.0.tar.gz:
Publisher:
workflow.yml on modal-labs/modal-openai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modal_openai-0.1.0.tar.gz -
Subject digest:
a414fbf615b16f7b836812122ecd4429e72f7c21ceaf0846b1e60dc05483c688 - Sigstore transparency entry: 2784679403
- Sigstore integration time:
-
Permalink:
modal-labs/modal-openai@44491e1bcc2c7fd8ab878ea1d456b5d2408e9c09 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/modal-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@44491e1bcc2c7fd8ab878ea1d456b5d2408e9c09 -
Trigger Event:
release
-
Statement type:
File details
Details for the file modal_openai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: modal_openai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74e756287964320b6203754cda5cee56c15c1dceea8cfc4f71726a48086e8e3d
|
|
| MD5 |
f820752128c13993f5dae0986da1c695
|
|
| BLAKE2b-256 |
924cf69199fb7b40574f23338eb0050a33c928f76bf5bd9cdff3c1e7ae32268a
|
Provenance
The following attestation bundles were made for modal_openai-0.1.0-py3-none-any.whl:
Publisher:
workflow.yml on modal-labs/modal-openai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modal_openai-0.1.0-py3-none-any.whl -
Subject digest:
74e756287964320b6203754cda5cee56c15c1dceea8cfc4f71726a48086e8e3d - Sigstore transparency entry: 2784679419
- Sigstore integration time:
-
Permalink:
modal-labs/modal-openai@44491e1bcc2c7fd8ab878ea1d456b5d2408e9c09 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/modal-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@44491e1bcc2c7fd8ab878ea1d456b5d2408e9c09 -
Trigger Event:
release
-
Statement type: