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.
Metadata
Release files for modal-openai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| modal_openai-0.1.0.tar.gz | 185.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| modal_openai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 210.7 kB
Release files / modal_openai-0.1.0.tar.gz
| Download URL | modal_openai-0.1.0.tar.gz |
|---|---|
| Size | 185.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a414fbf615b16f7b836812122ecd4429e72f7c21ceaf0846b1e60dc05483c688
|
|
BLAKE2b-256 checksum How to use checksums |
65c55f2c274e34499cc4bcbfebb895af84602953d8ca186528a6b7445eb3364d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logRelease files / modal_openai-0.1.0-py3-none-any.whl
| Download URL | modal_openai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
74e756287964320b6203754cda5cee56c15c1dceea8cfc4f71726a48086e8e3d
|
|
BLAKE2b-256 checksum How to use checksums |
924cf69199fb7b40574f23338eb0050a33c928f76bf5bd9cdff3c1e7ae32268a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logSecurity for modal-openai 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for modal_openai-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.