Examples and guides for using the OpenAI API
Organize Agents API sandbox examples by provider (#3134)
Abdulrahman Alfozan6dc6324fb9ed
diff --git a/examples/agents_api/README.md b/examples/agents_api/README.mdindex 88bacab6..f61765e3 100644--- a/examples/agents_api/README.md+++ b/examples/agents_api/README.md@@ -15,10 +15,10 @@ README walks through the implementation and explains how to run it.## Sandbox integrations-- [Application-managed](https://github.com/openai/openai-cookbook/tree/main/examples/agents_api/sandboxes/application_managed): your application+- [Application-managed](sandboxes/README.md): your applicationstarts and stops the sandbox directly.-- [Webhook-managed](https://github.com/openai/openai-cookbook/tree/main/examples/agents_api/sandboxes/webhook_managed): a deployed handler- provisions the sandbox while a shared client calls the Agents API.+- [Webhook-managed](sandboxes/webhook_managed.md): a deployed handler+ provisions the sandbox while the provider's `client.py` calls the Agents API.See the [sandbox overview](https://github.com/openai/openai-cookbook/tree/main/examples/agents_api/sandboxes) to choose a provisioning mode.diff --git a/examples/agents_api/apps/document_review/README.md b/examples/agents_api/apps/document_review/README.mdindex b12e989d..2c216f49 100644--- a/examples/agents_api/apps/document_review/README.md+++ b/examples/agents_api/apps/document_review/README.md@@ -24,7 +24,7 @@ From the repository root:```bashcp examples/agents_api/apps/document_review/.env.example examples/agents_api/apps/document_review/.env-docker build -t agent-api-sandbox:latest examples/agents_api/sandboxes/application_managed/docker+docker build -t agent-api-sandbox:latest examples/agents_api/sandboxes/docker/application_managed```Set `OPENAI_API_KEY` and `OPENAI_EXECUTOR_API_KEY` in `examples/agents_api/apps/document_review/.env`. Use keys with the same owner, organization, and project. Only the executor key enters the sandbox. It needs `api.agents.environments.connect` and IP restrictions that allow the sandbox's outbound network. The application loads this file automatically.diff --git a/examples/agents_api/apps/github_issues/README.md b/examples/agents_api/apps/github_issues/README.mdindex 5bdf471a..c599e16d 100644--- a/examples/agents_api/apps/github_issues/README.md+++ b/examples/agents_api/apps/github_issues/README.md@@ -24,7 +24,7 @@ From the repository root:```bashcp examples/agents_api/apps/github_issues/.env.example examples/agents_api/apps/github_issues/.env-docker build -t agent-api-sandbox:latest examples/agents_api/sandboxes/application_managed/docker+docker build -t agent-api-sandbox:latest examples/agents_api/sandboxes/docker/application_managed```Set `OPENAI_API_KEY` and `OPENAI_EXECUTOR_API_KEY` in `examples/agents_api/apps/github_issues/.env`. Use keys with the same owner, organization, and project. Only the executor key enters the sandbox. It needs `api.agents.environments.connect` and IP restrictions that allow the sandbox's outbound network. You can also replace Docker with a compatible [sandbox provider](https://developers.openai.com/api/docs/guides/agents-api/environments/self-hosted#sandbox-providers).diff --git a/examples/agents_api/apps/slack_bot/README.md b/examples/agents_api/apps/slack_bot/README.mdindex 423a79ab..a86ad780 100644--- a/examples/agents_api/apps/slack_bot/README.md+++ b/examples/agents_api/apps/slack_bot/README.md@@ -27,7 +27,7 @@ From the repository root:```bashcp examples/agents_api/apps/slack_bot/.env.example examples/agents_api/apps/slack_bot/.env-docker build -t agent-api-sandbox:latest examples/agents_api/sandboxes/application_managed/docker+docker build -t agent-api-sandbox:latest examples/agents_api/sandboxes/docker/application_managed```Set `OPENAI_API_KEY` and `OPENAI_EXECUTOR_API_KEY` in `examples/agents_api/apps/slack_bot/.env`. Use keys with the same owner, organization, and project. Only the executor key enters the sandbox. It needs `api.agents.environments.connect` and IP restrictions that allow the sandbox's outbound network. The application loads this file automatically.diff --git a/examples/agents_api/sandboxes/README.md b/examples/agents_api/sandboxes/README.mdindex 09c55bfd..6c22881d 100644--- a/examples/agents_api/sandboxes/README.md+++ b/examples/agents_api/sandboxes/README.md@@ -5,36 +5,27 @@ OpenAI's cloud and connect the sandbox through `codex exec-server`.| Mode | Your application | Sandbox provisioning || --- | --- | --- |-| [Application-managed](application_managed/README.md) | Run a provider-specific `main.py`. It calls both the Agents API and the sandbox provider. | Your application starts and stops compute directly; no webhook handler. |-| [Webhook-managed](webhook_managed/README.md) | Run the shared `client.py`. It calls only the Agents API. | A separately deployed handler starts or reconnects compute when OpenAI sends a webhook. |+| Application-managed | Run the provider's `application_managed/main.py`. | Your application starts and stops compute directly; no webhook handler. |+| [Webhook-managed](webhook_managed.md) | Run the provider's `webhook_managed/client.py`. It calls only the Agents API. | A separately deployed handler starts or reconnects compute when OpenAI sends a webhook. |Choose one provisioning mode per session. Deleting an API session does not stopprovider compute; each example documents cleanup of both.-```text-sandboxes/-├── application_managed/-│ ├── blaxel/main.py-│ ├── cloudflare/ # Python application + provisioning Worker-│ ├── daytona/main.py-│ ├── digitalocean/ # Python application + sandbox manifest-│ ├── docker/main.py # Application + Docker provisioning-│ ├── e2b/main.py-│ ├── modal/main.py # Application + Modal provisioning-│ ├── oci/main.py # Application + OCI provisioning-│ ├── runloop/main.py # Application + Runloop provisioning-│ └── vercel/main.py-└── webhook_managed/- ├── client.py # Shared application; Agents API only- ├── modal/ # Deployable provider handler- ├── vercel/ # Deployable provider handler- ├── cloudflare/ # Deployable provider handler- ├── blaxel/ # Deployable provider handler- ├── daytona/ # Deployable provider handler- ├── digitalocean/ # Deployable provider handler- ├── e2b/ # Deployable provider handler- └── runloop/ # Deployable provider handler-```+## Choose a provider-Start with the README for your chosen mode, then the provider README. Run commands-from the Cookbook repository root unless a provider README says otherwise.+| Provider | Application-managed | Webhook-managed |+| --- | --- | --- |+| [Blaxel](blaxel/README.md) | [Run](blaxel/application_managed/README.md) | [Deploy](blaxel/webhook_managed/README.md) |+| [Cloudflare](cloudflare/README.md) | [Run](cloudflare/application_managed/README.md) | [Deploy](cloudflare/webhook_managed/README.md) |+| [Daytona](daytona/README.md) | [Run](daytona/application_managed/README.md) | [Deploy](daytona/webhook_managed/README.md) |+| [DigitalOcean](digitalocean/README.md) | [Run](digitalocean/application_managed/README.md) | [Deploy](digitalocean/webhook_managed/README.md) |+| [Docker](docker/README.md) | [Run](docker/application_managed/README.md) | Not included |+| [E2B](e2b/README.md) | [Run](e2b/application_managed/README.md) | [Deploy](e2b/webhook_managed/README.md) |+| [Modal](modal/README.md) | [Run](modal/application_managed/README.md) | [Deploy](modal/webhook_managed/README.md) |+| [OCI](oci/README.md) | [Run](oci/application_managed/README.md) | Not included |+| [Runloop](runloop/README.md) | [Run](runloop/application_managed/README.md) | [Deploy](runloop/webhook_managed/README.md) |+| [Vercel](vercel/README.md) | [Run](vercel/application_managed/README.md) | [Deploy](vercel/webhook_managed/README.md) |++Each provider folder contains its examples and shared sandbox setup. Webhook+examples include their own client; they do not import code from another provider.+Run commands from the Cookbook repository root unless the provider README says otherwise.diff --git a/examples/agents_api/sandboxes/application_managed/README.md b/examples/agents_api/sandboxes/application_managed/README.mddeleted file mode 100644index 444e8a57..00000000--- a/examples/agents_api/sandboxes/application_managed/README.md+++ /dev/null@@ -1,32 +0,0 @@-# Application-managed sandboxes--Your application calls both the Agents API and the sandbox provider. Run one-provider-specific `main.py` locally or in your own cloud; no webhook handler is-deployed.--## How it works--Each example creates an API session, starts the sandbox and executor, submits-input, streams the result, then cleans up both the sandbox and session.--## Choose an example--| Provider | Application and provisioning code | Setup |-| --- | --- | --- |-| Blaxel | [blaxel/main.py](blaxel/main.py) | [Run with Blaxel](blaxel/README.md) |-| Cloudflare | [cloudflare/main.py](cloudflare/main.py) + Worker | [Run with Cloudflare](cloudflare/README.md) |-| Daytona | [daytona/main.py](daytona/main.py) | [Run with Daytona](daytona/README.md) |-| DigitalOcean | [digitalocean/main.py](digitalocean/main.py) | [Run with DigitalOcean](digitalocean/README.md) |-| Docker | [docker/main.py](docker/main.py) | [Run locally](docker/README.md) |-| E2B | [e2b/main.py](e2b/main.py) | [Run with E2B](e2b/README.md) |-| Modal | [modal/main.py](modal/main.py) | [Run with Modal](modal/README.md) |-| Runloop | [runloop/main.py](runloop/main.py) | [Run with Runloop](runloop/README.md) |-| Oracle Cloud Infrastructure (OCI) | [oci/main.py](oci/main.py) | [Run with OCI](oci/README.md) |-| Vercel | [vercel/main.py](vercel/main.py) | [Run with Vercel](vercel/README.md) |--Each provider directory includes its sample and setup instructions.-Run the example from the Cookbook repository root.--For an application that only calls the Agents API, use-[webhook-managed sandboxes](../webhook_managed/README.md) instead. Do not attach a-provisioning webhook handler to sessions already managed by these examples.diff --git a/examples/agents_api/sandboxes/application_managed/__init__.py b/examples/agents_api/sandboxes/application_managed/__init__.pydeleted file mode 100644index c5dbaac1..00000000--- a/examples/agents_api/sandboxes/application_managed/__init__.py+++ /dev/null@@ -1 +0,0 @@-"""Examples where the application owns sandbox provisioning."""diff --git a/examples/agents_api/sandboxes/application_managed/cloudflare/.dockerignore b/examples/agents_api/sandboxes/application_managed/cloudflare/.dockerignoredeleted file mode 100644index 073e02da..00000000--- a/examples/agents_api/sandboxes/application_managed/cloudflare/.dockerignore+++ /dev/null@@ -1,3 +0,0 @@-node_modules-.wrangler-.dev.varsdiff --git a/examples/agents_api/sandboxes/application_managed/cloudflare/package.json b/examples/agents_api/sandboxes/application_managed/cloudflare/package.jsondeleted file mode 100644index b811b91c..00000000--- a/examples/agents_api/sandboxes/application_managed/cloudflare/package.json+++ /dev/null@@ -1,17 +0,0 @@-{- "name": "agents-api-application-cloudflare",- "private": true,- "type": "module",- "scripts": {- "check": "tsc --noEmit",- "deploy": "wrangler deploy"- },- "dependencies": {- "@cloudflare/sandbox": ">=0.12.8 <1"- },- "devDependencies": {- "@cloudflare/workers-types": ">=4.20260702.1",- "typescript": ">=5.9 <6",- "wrangler": ">=4.90.0 <5"- }-}diff --git a/examples/agents_api/sandboxes/blaxel/README.md b/examples/agents_api/sandboxes/blaxel/README.mdnew file mode 100644index 00000000..c177268b--- /dev/null+++ b/examples/agents_api/sandboxes/blaxel/README.md@@ -0,0 +1,12 @@+# Blaxel sandboxes++Run Agents API tasks with `codex exec-server` in Blaxel sandboxes:++- [Application-managed](application_managed/README.md): create a sandbox, run a task,+ read its output, and clean up the sandbox and session.+- [Webhook-managed](webhook_managed/README.md): deploy a controller that provisions+ workers when a session needs an environment connection.++Both modes use [sandbox.py](sandbox.py) for executor installation and launch.+Workers receive only the restricted executor key; application credentials stay+in the application or webhook controller.diff --git a/examples/agents_api/sandboxes/application_managed/blaxel/README.md b/examples/agents_api/sandboxes/blaxel/application_managed/README.mdsimilarity index 90%rename from examples/agents_api/sandboxes/application_managed/blaxel/README.mdrename to examples/agents_api/sandboxes/blaxel/application_managed/README.mdindex 86415f19..cc20e6c0 100644--- a/examples/agents_api/sandboxes/application_managed/blaxel/README.md+++ b/examples/agents_api/sandboxes/blaxel/application_managed/README.md@@ -14,7 +14,7 @@ Set `BL_REGION` to choose a region; the default is `us-pdx-1`.From the Cookbook repository root:```bash-uv run examples/agents_api/sandboxes/application_managed/blaxel/main.py+uv run examples/agents_api/sandboxes/blaxel/application_managed/main.py```Dependencies are declared inline. The script allows six minutes for setup and@@ -29,4 +29,4 @@ Do not attach a provisioning webhook handler to these sessions.- [Blaxel sandbox documentation](https://docs.blaxel.ai/Sandboxes/Overview)- [Blaxel Python SDK](https://github.com/blaxel-ai/sdk-python)-- [Webhook-managed example](../../webhook_managed/blaxel/README.md)+- [Webhook-managed example](../webhook_managed/README.md)diff --git a/examples/agents_api/sandboxes/application_managed/blaxel/main.py b/examples/agents_api/sandboxes/blaxel/application_managed/main.pysimilarity index 72%rename from examples/agents_api/sandboxes/application_managed/blaxel/main.pyrename to examples/agents_api/sandboxes/blaxel/application_managed/main.pyindex a0b3b9d1..97bd3faa 100644--- a/examples/agents_api/sandboxes/application_managed/blaxel/main.py+++ b/examples/agents_api/sandboxes/blaxel/application_managed/main.py@@ -10,12 +10,15 @@import asyncioimport os-import shlex+import sys+from pathlib import Pathfrom blaxel.core.sandbox import SandboxInstancefrom openai import AsyncOpenAI-WORKSPACE = "/workspace"+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))+from sandbox import WORKSPACE, install_executor, start_executor+BRIEF = "Migrate a synchronous Python service to async without changing its API.\n"@@ -30,13 +33,6 @@ async def main() -> None:print(f"Session: {session.id}", flush=True)try:assert session.environment.type == "self_hosted"- executor_args = [- "exec-server",- "--remote",- session.environment.remote_url,- "--environment-id",- session.environment.id,- ]async with asyncio.timeout(360):sandbox = await SandboxInstance.create({@@ -47,25 +43,13 @@ async def main() -> None:})print(f"Sandbox: {sandbox.metadata.name}", flush=True)- setup = await sandbox.process.exec(- {- "command": "mkdir -p /workspace && npm install -g @openai/codex@alpha",- "wait_for_completion": True,- "timeout": 180,- }- )- if setup.exit_code != 0:- raise RuntimeError("Executor installation failed")+ await install_executor(sandbox)await sandbox.fs.write(f"{WORKSPACE}/brief.txt", BRIEF)- await sandbox.process.exec(- {- "command": shlex.join(["codex", *executor_args]),- "working_dir": WORKSPACE,- "env": {"CODEX_API_KEY": executor_key},- "wait_for_completion": False,- "keep_alive": True,- "timeout": 600,- }+ await start_executor(+ sandbox,+ session.environment.remote_url,+ session.environment.id,+ executor_key,)async with client.beta.agents.sessions.stream(diff --git a/examples/agents_api/sandboxes/blaxel/sandbox.py b/examples/agents_api/sandboxes/blaxel/sandbox.pynew file mode 100644index 00000000..9b61845c--- /dev/null+++ b/examples/agents_api/sandboxes/blaxel/sandbox.py@@ -0,0 +1,59 @@+"""Executor setup and launch shared by the two Blaxel examples."""++import shlex++from blaxel.core.sandbox import SandboxInstance++WORKSPACE = "/workspace"+++async def install_executor(+ sandbox: SandboxInstance, *, reconnect: bool = False+) -> None:+ command = "mkdir -p /workspace && npm install -g @openai/codex@alpha"+ if reconnect:+ command = (+ "mkdir -p /workspace && "+ "(command -v codex || npm install -g @openai/codex@alpha) && "+ "(command -v rg || apk add --no-cache ripgrep util-linux)"+ )+ result = await sandbox.process.exec(+ {+ "command": command,+ "wait_for_completion": True,+ "timeout": 120 if reconnect else 180,+ }+ )+ if result.exit_code != 0:+ raise RuntimeError("Executor installation failed")+++async def start_executor(+ sandbox: SandboxInstance,+ remote_url: str,+ environment_id: str,+ executor_key: str,+ *,+ reconnect: bool = False,+) -> None:+ args = [+ "codex",+ "exec-server",+ "--remote",+ remote_url,+ "--environment-id",+ environment_id,+ ]+ if reconnect:+ # The controller serializes jobs; flock also prevents duplicate executors.+ args = ["flock", "-n", "/tmp/codex-executor.lock", *args]+ await sandbox.process.exec(+ {+ "command": shlex.join(args),+ "working_dir": WORKSPACE,+ "env": {"CODEX_API_KEY": executor_key},+ "wait_for_completion": False,+ "keep_alive": True,+ "timeout": 1800 if reconnect else 600,+ }+ )diff --git a/examples/agents_api/sandboxes/webhook_managed/blaxel/README.md b/examples/agents_api/sandboxes/blaxel/webhook_managed/README.mdsimilarity index 84%rename from examples/agents_api/sandboxes/webhook_managed/blaxel/README.mdrename to examples/agents_api/sandboxes/blaxel/webhook_managed/README.mdindex b5f5e51f..e599d4fe 100644--- a/examples/agents_api/sandboxes/webhook_managed/blaxel/README.md+++ b/examples/agents_api/sandboxes/blaxel/webhook_managed/README.md@@ -6,7 +6,7 @@ The queue survives controller process restarts, but not deletion of the controll## Deploy-Create an agent using the [shared setup](../README.md#set-up-once). Run the+Create an agent using the [shared setup](../../webhook_managed.md#set-up-once). Run thedeployment command below from the Cookbook repository root.Provide these environment variables through your secret manager:@@ -19,13 +19,18 @@ Provide these environment variables through your secret manager:- `OPENAI_WEBHOOK_SECRET`: signing secret, once the webhook has been registered.```bash-uv run examples/agents_api/sandboxes/webhook_managed/blaxel/deploy.py+uv run examples/agents_api/sandboxes/blaxel/webhook_managed/deploy.py```The deployment creates a controller and prints its public webhook URL. Until thesigning secret is configured, the endpoint returns `503`. Register the URL withOpenAI, set the real signing secret, and rerun deployment. Then use the-[shared client](../README.md#run-and-reconnect).+[run and reconnect guide](../../webhook_managed.md#run-and-reconnect) with this+provider's client:++```bash+uv run examples/agents_api/sandboxes/blaxel/webhook_managed/client.py --agent-id "$OPENAI_AGENT_ID"+```Rerun deployment after changing credentials; keep the same signing secret unlessyou rotate it in OpenAI.diff --git a/examples/agents_api/sandboxes/webhook_managed/client.py b/examples/agents_api/sandboxes/blaxel/webhook_managed/client.pysimilarity index 100%rename from examples/agents_api/sandboxes/webhook_managed/client.pyrename to examples/agents_api/sandboxes/blaxel/webhook_managed/client.pydiff --git a/examples/agents_api/sandboxes/webhook_managed/blaxel/deploy.py b/examples/agents_api/sandboxes/blaxel/webhook_managed/deploy.pysimilarity index 88%rename from examples/agents_api/sandboxes/webhook_managed/blaxel/deploy.pyrename to examples/agents_api/sandboxes/blaxel/webhook_managed/deploy.pyindex 3b0fab46..cbd00687 100644--- a/examples/agents_api/sandboxes/webhook_managed/blaxel/deploy.py+++ b/examples/agents_api/sandboxes/blaxel/webhook_managed/deploy.py@@ -16,6 +16,7 @@ from pathlib import Pathfrom blaxel.core.sandbox import SandboxInstanceNAME = "agents-api-webhook-controller"+ROOT = Path(__file__).parentasync def main() -> None:@@ -46,7 +47,7 @@ async def main() -> None:)setup = await sandbox.process.exec({- "command": "apk add --no-cache python3 py3-pip && python3 -m venv /opt/controller && /opt/controller/bin/pip install uv && mkdir -p /app",+ "command": "apk add --no-cache python3 py3-pip && python3 -m venv /opt/controller && /opt/controller/bin/pip install uv && mkdir -p /app/webhook_managed","wait_for_completion": True,"timeout": 180,}@@ -54,11 +55,14 @@ async def main() -> None:if setup.exit_code != 0:raise RuntimeError("Controller dependency installation failed")await sandbox.fs.write(- "/app/handler.py", Path(__file__).with_name("handler.py").read_text()+ "/app/webhook_managed/handler.py", ROOT.joinpath("handler.py").read_text()+ )+ await sandbox.fs.write(+ "/app/sandbox.py", ROOT.parent.joinpath("sandbox.py").read_text())install = await sandbox.process.exec({- "command": "/opt/controller/bin/uv pip install --python /opt/controller/bin/python -r /app/handler.py",+ "command": "/opt/controller/bin/uv pip install --python /opt/controller/bin/python -r /app/webhook_managed/handler.py","wait_for_completion": True,"timeout": 180,}@@ -73,7 +77,7 @@ async def main() -> None:{"name": "webhook-controller","command": "/opt/controller/bin/uvicorn handler:app --host 0.0.0.0 --port 8000",- "working_dir": "/app",+ "working_dir": "/app/webhook_managed","env": values,"wait_for_completion": False,"keep_alive": True,diff --git a/examples/agents_api/sandboxes/webhook_managed/blaxel/handler.py b/examples/agents_api/sandboxes/blaxel/webhook_managed/handler.pysimilarity index 82%rename from examples/agents_api/sandboxes/webhook_managed/blaxel/handler.pyrename to examples/agents_api/sandboxes/blaxel/webhook_managed/handler.pyindex 88238819..d3615c4d 100644--- a/examples/agents_api/sandboxes/webhook_managed/blaxel/handler.py+++ b/examples/agents_api/sandboxes/blaxel/webhook_managed/handler.py@@ -17,17 +17,21 @@ import asyncioimport hashlibimport jsonimport os-import shleximport sqlite3+import sysimport timefrom collections.abc import AsyncIteratorfrom contextlib import asynccontextmanager+from pathlib import Pathfrom blaxel.core.sandbox import SandboxInstancefrom fastapi import FastAPI, Requestfrom fastapi.responses import JSONResponsefrom openai import AsyncOpenAI, InvalidWebhookSignatureError, NotFoundError, OpenAI+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))+from sandbox import install_executor, start_executor+DB_PATH = os.environ.get("QUEUE_PATH", "/app/pending.sqlite3")@@ -69,38 +73,13 @@ async def reconcile(session_id: str) -> None:"labels": {"agents-session-id": session_id},})- setup = await sandbox.process.exec(- {- "command": "mkdir -p /workspace && (command -v codex || npm install -g @openai/codex@alpha) && (command -v rg || apk add --no-cache ripgrep util-linux)",- "wait_for_completion": True,- "timeout": 120,- }- )- if setup.exit_code != 0:- raise RuntimeError("Executor setup failed")- # The controller serializes jobs; flock also prevents duplicate executors.- command = shlex.join(- [- "flock",- "-n",- "/tmp/codex-executor.lock",- "codex",- "exec-server",- "--remote",- session.environment.remote_url,- "--environment-id",- session.environment.id,- ]- )- await sandbox.process.exec(- {- "command": command,- "working_dir": "/workspace",- "wait_for_completion": False,- "keep_alive": True,- "timeout": 1800,- "env": {"CODEX_API_KEY": os.environ["OPENAI_EXECUTOR_API_KEY"]},- }+ await install_executor(sandbox, reconnect=True)+ await start_executor(+ sandbox,+ session.environment.remote_url,+ session.environment.id,+ os.environ["OPENAI_EXECUTOR_API_KEY"],+ reconnect=True,)print(json.dumps(diff --git a/examples/agents_api/sandboxes/webhook_managed/cloudflare/.dockerignore b/examples/agents_api/sandboxes/cloudflare/.dockerignoresimilarity index 100%rename from examples/agents_api/sandboxes/webhook_managed/cloudflare/.dockerignorerename to examples/agents_api/sandboxes/cloudflare/.dockerignorediff --git a/examples/agents_api/sandboxes/application_managed/cloudflare/.gitignore b/examples/agents_api/sandboxes/cloudflare/.gitignoresimilarity index 69%rename from examples/agents_api/sandboxes/application_managed/cloudflare/.gitignorerename to examples/agents_api/sandboxes/cloudflare/.gitignoreindex a933f108..8fbcf8f7 100644--- a/examples/agents_api/sandboxes/application_managed/cloudflare/.gitignore+++ b/examples/agents_api/sandboxes/cloudflare/.gitignore@@ -1,3 +1,3 @@node_modules/.wrangler/-.dev.vars+.dev.vars*diff --git a/examples/agents_api/sandboxes/application_managed/cloudflare/Dockerfile b/examples/agents_api/sandboxes/cloudflare/Dockerfilesimilarity index 90%rename from examples/agents_api/sandboxes/application_managed/cloudflare/Dockerfilerename to examples/agents_api/sandboxes/cloudflare/Dockerfileindex 6711bed7..d3d63440 100644--- a/examples/agents_api/sandboxes/application_managed/cloudflare/Dockerfile+++ b/examples/agents_api/sandboxes/cloudflare/Dockerfile@@ -1,5 +1,5 @@FROM docker.io/cloudflare/sandbox:0.12.9-RUN apt-get update && apt-get install -y --no-install-recommends util-linux \+RUN apt-get update && apt-get install -y --no-install-recommends ripgrep util-linux \&& npm install -g @openai/codex@alpha \&& mkdir -p /workspace \&& rm -rf /var/lib/apt/lists/*diff --git a/examples/agents_api/sandboxes/cloudflare/README.md b/examples/agents_api/sandboxes/cloudflare/README.mdnew file mode 100644index 00000000..d6cb0cbf--- /dev/null+++ b/examples/agents_api/sandboxes/cloudflare/README.md@@ -0,0 +1,32 @@+# Cloudflare sandboxes++Choose who starts and reconnects the executor:++- [Application-managed](application_managed/README.md): a Python application calls+ authenticated Worker routes to start a sandbox, read its output, and destroy it.+- [Webhook-managed](webhook_managed/README.md): a signed OpenAI webhook wakes a+ Durable Object controller that provisions and reconnects the sandbox.++Both modes share the `Dockerfile`, npm dependencies, TypeScript configuration,+and `executor.ts`. Each mode keeps its own Worker entrypoint and Wrangler+configuration because authentication and lifecycle management differ.++## Prerequisites++Use a Cloudflare account with Workers Paid and Containers enabled, Node.js, and+Docker running for image builds. Use separate Worker names for the two modes and+for tests; do not deploy over an existing application.++Install and check both Workers from this directory:++```bash+npm ci+npm run check+npx wrangler login+```++The pinned Sandbox SDK version matches the Docker image. When upgrading it,+update both together. Set a separate restricted `OPENAI_EXECUTOR_API_KEY` for+the sandbox. Keep the application/session-read key out of the container.++Follow a mode's README for its configuration, deployment, and cleanup commands.diff --git a/examples/agents_api/sandboxes/application_managed/cloudflare/README.md b/examples/agents_api/sandboxes/cloudflare/application_managed/README.mdsimilarity index 67%rename from examples/agents_api/sandboxes/application_managed/cloudflare/README.mdrename to examples/agents_api/sandboxes/cloudflare/application_managed/README.mdindex 322924be..26ce9e99 100644--- a/examples/agents_api/sandboxes/application_managed/cloudflare/README.md+++ b/examples/agents_api/sandboxes/cloudflare/application_managed/README.md@@ -10,16 +10,15 @@ provides authenticated start, file-read, and destroy routes for the Python clien## Deploy the Worker-You need Cloudflare Workers Paid with Containers enabled, Node.js, and Docker-running for the image build.+Complete the [provider setup](../README.md#prerequisites). Set a unique Worker+name in `application_managed/wrangler.jsonc`. Starting at the Cookbook repository+root, change into the Cloudflare provider directory and deploy:```bash-cd examples/agents_api/sandboxes/application_managed/cloudflare-npm ci-npx wrangler login-npm run deploy-npx wrangler secret put OPENAI_EXECUTOR_API_KEY-npx wrangler secret put SANDBOX_CONTROL_TOKEN+cd examples/agents_api/sandboxes/cloudflare+npm run deploy:application+npx wrangler secret put OPENAI_EXECUTOR_API_KEY --config application_managed/wrangler.jsonc+npx wrangler secret put SANDBOX_CONTROL_TOKEN --config application_managed/wrangler.jsonc```Use a restricted executor key and a separate random control token. Keep the@@ -33,7 +32,7 @@ Worker), and `CLOUDFLARE_SANDBOX_WORKER_URL` to the deployed Worker URL.From the Cookbook repository root:```bash-uv run examples/agents_api/sandboxes/application_managed/cloudflare/main.py+uv run examples/agents_api/sandboxes/cloudflare/application_managed/main.py```Python dependencies are declared inline. The script allows six minutes for@@ -44,10 +43,12 @@ the Agents API session.For follow-up turns, keep both resources until the application is finished.Do not attach a provisioning webhook handler to these sessions. When finished-with this deployment, run `npx wrangler delete` from the Worker directory.+with this deployment, run `npx wrangler delete --config application_managed/wrangler.jsonc`+from the provider directory.## References- [Cloudflare Sandbox documentation](https://developers.cloudflare.com/sandbox/)- [Background processes](https://developers.cloudflare.com/sandbox/guides/background-processes/)-- [Webhook-managed example](../../webhook_managed/cloudflare/README.md)+- [Webhook-managed example](../webhook_managed/README.md)+- [Webhook setup and lifecycle](../../webhook_managed.md#set-up-once)diff --git a/examples/agents_api/sandboxes/application_managed/cloudflare/main.py b/examples/agents_api/sandboxes/cloudflare/application_managed/main.pysimilarity index 100%rename from examples/agents_api/sandboxes/application_managed/cloudflare/main.pyrename to examples/agents_api/sandboxes/cloudflare/application_managed/main.pydiff --git a/examples/agents_api/sandboxes/application_managed/cloudflare/src/index.ts b/examples/agents_api/sandboxes/cloudflare/application_managed/src/index.tssimilarity index 89%rename from examples/agents_api/sandboxes/application_managed/cloudflare/src/index.tsrename to examples/agents_api/sandboxes/cloudflare/application_managed/src/index.tsindex 53c3dedb..24793325 100644--- a/examples/agents_api/sandboxes/application_managed/cloudflare/src/index.ts+++ b/examples/agents_api/sandboxes/cloudflare/application_managed/src/index.ts@@ -1,4 +1,5 @@import { getSandbox, type Sandbox as SandboxType } from "@cloudflare/sandbox";+import { startExecutor } from "../../executor";export { Sandbox } from "@cloudflare/sandbox";@@ -51,9 +52,10 @@ export default {"/workspace/brief.txt","Migrate a synchronous Python service to async without changing its API.\n",);- await sandbox.startProcess(- `flock -n /tmp/executor.lock codex exec-server --remote ${remote_url} --environment-id ${environment_id}`,- { cwd: "/workspace", env: { CODEX_API_KEY: env.OPENAI_EXECUTOR_API_KEY } },+ await startExecutor(+ sandbox,+ { id: environment_id, remote_url },+ env.OPENAI_EXECUTOR_API_KEY,);return Response.json({ started: match[1] });},diff --git a/examples/agents_api/sandboxes/application_managed/cloudflare/wrangler.jsonc b/examples/agents_api/sandboxes/cloudflare/application_managed/wrangler.jsoncsimilarity index 73%rename from examples/agents_api/sandboxes/application_managed/cloudflare/wrangler.jsoncrename to examples/agents_api/sandboxes/cloudflare/application_managed/wrangler.jsoncindex a8a39379..9e0512b0 100644--- a/examples/agents_api/sandboxes/application_managed/cloudflare/wrangler.jsonc+++ b/examples/agents_api/sandboxes/cloudflare/application_managed/wrangler.jsonc@@ -1,11 +1,11 @@{- "$schema": "node_modules/wrangler/config-schema.json",+ "$schema": "../node_modules/wrangler/config-schema.json","name": "agents-api-application-cloudflare","main": "src/index.ts","compatibility_date": "2026-05-07","compatibility_flags": ["nodejs_compat"],"containers": [- { "class_name": "Sandbox", "image": "./Dockerfile", "max_instances": 4 },+ { "class_name": "Sandbox", "image": "../Dockerfile", "max_instances": 4 },],"durable_objects": {"bindings": [{ "name": "Sandbox", "class_name": "Sandbox" }],diff --git a/examples/agents_api/sandboxes/cloudflare/executor.ts b/examples/agents_api/sandboxes/cloudflare/executor.tsnew file mode 100644index 00000000..e5240dbd--- /dev/null+++ b/examples/agents_api/sandboxes/cloudflare/executor.ts@@ -0,0 +1,25 @@+import type { Sandbox } from "@cloudflare/sandbox";++export async function startExecutor(+ sandbox: Sandbox,+ environment: { id: string; remote_url: string },+ executorKey: string,+) {+ const command = [+ "flock",+ "-n",+ "/tmp/codex-executor.lock",+ "codex",+ "exec-server",+ "--remote",+ environment.remote_url,+ "--environment-id",+ environment.id,+ ]+ .map((arg) => `'${arg.replaceAll("'", "'\\''")}'`)+ .join(" ");+ return sandbox.startProcess(command, {+ cwd: "/workspace",+ env: { CODEX_API_KEY: executorKey },+ });+}diff --git a/examples/agents_api/sandboxes/application_managed/cloudflare/package-lock.json b/examples/agents_api/sandboxes/cloudflare/package-lock.jsonsimilarity index 97%rename from examples/agents_api/sandboxes/application_managed/cloudflare/package-lock.jsonrename to examples/agents_api/sandboxes/cloudflare/package-lock.jsonindex 66b6c8a6..61860ebd 100644--- a/examples/agents_api/sandboxes/application_managed/cloudflare/package-lock.json+++ b/examples/agents_api/sandboxes/cloudflare/package-lock.json@@ -1,12 +1,13 @@{- "name": "agents-api-application-cloudflare",+ "name": "agents-api-cloudflare","lockfileVersion": 3,"requires": true,"packages": {"": {- "name": "agents-api-application-cloudflare",+ "name": "agents-api-cloudflare","dependencies": {- "@cloudflare/sandbox": ">=0.12.8 <1"+ "@cloudflare/sandbox": "0.12.9",+ "openai": ">=7.15.0 <8"},"devDependencies": {"@cloudflare/workers-types": ">=4.20260702.1",@@ -1431,6 +1432,43 @@"node": ">=22.0.0"}},+ "node_modules/openai": {+ "version": "7.19.0",+ "resolved": "https://socket-firewall-registry.gateway.unified-30.internal.api.openai.org/npm/openai/-/openai-7.19.0.tgz",+ "integrity": "sha512-MX2s3u2L5racTO0CC/SWpCOasJQBCJrqLKXK+l82cAhdeF8mPMBEe/gxMm0ZFa2xpKpOFLRjxv5afYEZbBXmbQ==",+ "license": "Apache-2.0",+ "engines": {+ "node": ">=22.0.0"+ },+ "peerDependencies": {+ "@aws-sdk/credential-provider-node": ">=3.972.0 <4",+ "@smithy/hash-node": ">=4.3.0 <5",+ "@smithy/signature-v4": ">=5.4.0 <6",+ "undici": ">=5 <9",+ "ws": "^8.21.0",+ "zod": "^3.25 || ^4.0"+ },+ "peerDependenciesMeta": {+ "@aws-sdk/credential-provider-node": {+ "optional": true+ },+ "@smithy/hash-node": {+ "optional": true+ },+ "@smithy/signature-v4": {+ "optional": true+ },+ "undici": {+ "optional": true+ },+ "ws": {+ "optional": true+ },+ "zod": {+ "optional": true+ }+ }+ },"node_modules/path-to-regexp": {"version": "6.3.0","resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz",@@ -1542,7 +1580,7 @@"version": "7.29.0","resolved": "https://registry.npmjs.org/undici/-/undici-7.29.0.tgz","integrity": "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==",- "dev": true,+ "devOptional": true,"license": "MIT","engines": {"node": ">=20.18.1"@@ -1619,7 +1657,7 @@"version": "8.21.0","resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz","integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==",- "dev": true,+ "devOptional": true,"license": "MIT","engines": {"node": ">=10.0.0"diff --git a/examples/agents_api/sandboxes/cloudflare/package.json b/examples/agents_api/sandboxes/cloudflare/package.jsonnew file mode 100644index 00000000..ed97b4d4--- /dev/null+++ b/examples/agents_api/sandboxes/cloudflare/package.json@@ -0,0 +1,19 @@+{+ "name": "agents-api-cloudflare",+ "private": true,+ "type": "module",+ "scripts": {+ "check": "tsc --noEmit",+ "deploy:application": "wrangler deploy --config application_managed/wrangler.jsonc",+ "deploy:webhook": "wrangler deploy --config webhook_managed/wrangler.jsonc"+ },+ "dependencies": {+ "@cloudflare/sandbox": "0.12.9",+ "openai": ">=7.15.0 <8"+ },+ "devDependencies": {+ "@cloudflare/workers-types": ">=4.20260702.1",+ "typescript": ">=5.9 <6",+ "wrangler": ">=4.90.0 <5"+ }+}diff --git a/examples/agents_api/sandboxes/application_managed/cloudflare/tsconfig.json b/examples/agents_api/sandboxes/cloudflare/tsconfig.jsonsimilarity index 72%rename from examples/agents_api/sandboxes/application_managed/cloudflare/tsconfig.jsonrename to examples/agents_api/sandboxes/cloudflare/tsconfig.jsonindex 1d566bd4..8152199d 100644--- a/examples/agents_api/sandboxes/application_managed/cloudflare/tsconfig.json+++ b/examples/agents_api/sandboxes/cloudflare/tsconfig.json@@ -9,5 +9,5 @@"types": ["@cloudflare/workers-types"],"lib": ["ES2022"]},- "include": ["src/**/*.ts"]+ "include": ["executor.ts", "application_managed/src/**/*.ts", "webhook_managed/src/**/*.ts"]}diff --git a/examples/agents_api/sandboxes/cloudflare/webhook_managed/README.md b/examples/agents_api/sandboxes/cloudflare/webhook_managed/README.mdnew file mode 100644index 00000000..c65ae9ae--- /dev/null+++ b/examples/agents_api/sandboxes/cloudflare/webhook_managed/README.md@@ -0,0 +1,71 @@+# Cloudflare webhook-managed sandbox++The Worker verifies the signature and persists a wakeup in a per-session Durable+Object. Its alarm starts the Sandbox executor. Durable storage handles retries;+the session ID identifies the sandbox, and an OS lock prevents duplicate executors.++## Deploy++Complete the [provider setup](../README.md#prerequisites).+Create the agent using the [shared setup](../../webhook_managed.md#set-up-once)+with this mode's `client.py`. Starting at the Cookbook repository root:++```bash+cd examples/agents_api/sandboxes/cloudflare+uv run webhook_managed/client.py --create-agent cloudflare-webhook-example+```++Set a unique Worker name and `OPENAI_AGENT_ID` in `webhook_managed/wrangler.jsonc`.+Stay in the Cloudflare provider directory for the remaining commands. Deploy+and add secrets using the CLI's prompts:++```bash+npm run deploy:webhook+npx wrangler secret put OPENAI_API_KEY --config webhook_managed/wrangler.jsonc+npx wrangler secret put OPENAI_EXECUTOR_API_KEY --config webhook_managed/wrangler.jsonc+npx wrangler secret put OPENAI_WEBHOOK_SECRET --config webhook_managed/wrangler.jsonc+npx wrangler secret put SANDBOX_CONTROL_TOKEN --config webhook_managed/wrangler.jsonc+```++Use a separate random control token for the cleanup endpoint. For the first+deployment only, the signing value may be `pending-webhook-registration`; the+receiver rejects it. The SDK and Dockerfile use matching Sandbox versions.++Register `https://YOUR_WORKER.workers.dev/webhook` with OpenAI. Set the real signing+secret using `npx wrangler secret put OPENAI_WEBHOOK_SECRET --config webhook_managed/wrangler.jsonc`.+Run the [client and reconnect flow](../../webhook_managed.md#run-and-reconnect)+with the provider-local client:++```bash+uv run webhook_managed/client.py --agent-id "$OPENAI_AGENT_ID"+uv run webhook_managed/client.py --session-id "$SESSION_ID" --input "Run another shell command."+```++Keep `OPENAI_AGENT_ID` set when redeploying; sessions for other agents are ignored.++## Stop or clean up++Call the authenticated cleanup endpoint after a turn finishes:++```python+import os+import httpx++response = httpx.delete(+ f"{os.environ['WORKER_URL']}/sandboxes/{os.environ['SESSION_ID']}",+ headers={"Authorization": f"Bearer {os.environ['SANDBOX_CONTROL_TOKEN']}"},+ timeout=60,+)+response.raise_for_status()+```++A following input triggers a new connection. Final cleanup also requires deleting+the API session. The controller schedules a maximum-lifetime cleanup alarm because+the executor keeps the container alive. Replacement containers have a fresh filesystem.+Remove the OpenAI webhook before deleting the Worker and its containers:++```bash+npx wrangler delete --config webhook_managed/wrangler.jsonc+```++See the [application-managed mode](../application_managed/README.md) for direct provisioning.diff --git a/examples/agents_api/sandboxes/cloudflare/webhook_managed/client.py b/examples/agents_api/sandboxes/cloudflare/webhook_managed/client.pynew file mode 100644index 00000000..fb62b24f--- /dev/null+++ b/examples/agents_api/sandboxes/cloudflare/webhook_managed/client.py@@ -0,0 +1,83 @@+# /// script+# requires-python = ">=3.11"+# dependencies = [+# "openai>=3.13.0",+# ]+# ///++"""Use Agents API without importing a sandbox provider SDK."""++from __future__ import annotations++import argparse+import asyncio+import json++from openai import AsyncOpenAI+++async def main() -> None:+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--create-agent", metavar="NAME")+ parser.add_argument("--agent-id")+ parser.add_argument("--session-id")+ parser.add_argument("--delete", action="store_true")+ parser.add_argument("--model", default="gpt-5.6-sol")+ parser.add_argument("--workspace", default="/workspace")+ parser.add_argument(+ "--input", default="Run a shell command to print hello from the sandbox."+ )+ args = parser.parse_args()++ async with AsyncOpenAI(timeout=600) as client:+ if args.create_agent:+ agent = await client.beta.agents.create(+ model=args.model, name=args.create_agent+ )+ print(json.dumps({"agent_id": agent.id}))+ return+ if args.delete:+ if not args.session_id:+ parser.error(+ "--delete requires --session-id; stop provider compute separately"+ )+ await client.beta.agents.sessions.delete(args.session_id)+ print(json.dumps({"deleted": args.session_id}))+ return+ if args.session_id:+ session = await client.beta.agents.sessions.retrieve(args.session_id)+ else:+ if not args.agent_id:+ parser.error(+ "Pass --agent-id from --create-agent, or an existing --session-id"+ )+ session = await client.beta.agents.sessions.create(+ agent_id=args.agent_id,+ environment={+ "type": "self_hosted",+ "workspace_directory": args.workspace,+ },+ )+ print(json.dumps({"session_id": session.id}), flush=True)+ completed = False+ async with client.beta.agents.sessions.stream(+ session.id, input=args.input+ ) as events:+ async for event in events:+ if event.type in {+ "agent.session.turn.failed",+ "agent.session.turn.cancelled",+ "agent.session.failed",+ }:+ raise RuntimeError(f"Agent failed: {event.type}")+ if event.type == "agent.session.turn.output_text.delta":+ print(event.delta, end="", flush=True)+ if event.type == "agent.session.turn.completed":+ completed = True+ if not completed:+ raise RuntimeError("Stream ended without a completed turn")+ print()+++if __name__ == "__main__":+ asyncio.run(main())diff --git a/examples/agents_api/sandboxes/webhook_managed/cloudflare/src/index.ts b/examples/agents_api/sandboxes/cloudflare/webhook_managed/src/index.tssimilarity index 92%rename from examples/agents_api/sandboxes/webhook_managed/cloudflare/src/index.tsrename to examples/agents_api/sandboxes/cloudflare/webhook_managed/src/index.tsindex 93693a60..63ce3ae7 100644--- a/examples/agents_api/sandboxes/webhook_managed/cloudflare/src/index.ts+++ b/examples/agents_api/sandboxes/cloudflare/webhook_managed/src/index.ts@@ -1,6 +1,7 @@import { DurableObject } from "cloudflare:workers";import { getSandbox, type Sandbox as SandboxType } from "@cloudflare/sandbox";import OpenAI from "openai";+import { startExecutor } from "../../executor";export { Sandbox } from "@cloudflare/sandbox";@@ -116,23 +117,11 @@ export class SessionController extends DurableObject<Env> {if (!(await this.ctx.storage.get("expiresAt")))await this.ctx.storage.put("expiresAt", Date.now() + 30 * 60_000);// A deterministic sandbox ID and an OS lock prevent duplicate executors.- const command = [- "flock",- "-n",- "/tmp/codex-executor.lock",- "codex",- "exec-server",- "--remote",- session.environment.remote_url,- "--environment-id",- session.environment.id,- ]- .map((arg) => `'${arg.replaceAll("'", "'\\''")}'`)- .join(" ");- await sandbox.startProcess(command, {- cwd: "/workspace",- env: { CODEX_API_KEY: this.env.OPENAI_EXECUTOR_API_KEY },- });+ await startExecutor(+ sandbox,+ session.environment,+ this.env.OPENAI_EXECUTOR_API_KEY,+ );console.log(JSON.stringify({ session_id: sessionId, action: "started" }));return true;}diff --git a/examples/agents_api/sandboxes/webhook_managed/cloudflare/wrangler.jsonc b/examples/agents_api/sandboxes/cloudflare/webhook_managed/wrangler.jsoncsimilarity index 79%rename from examples/agents_api/sandboxes/webhook_managed/cloudflare/wrangler.jsoncrename to examples/agents_api/sandboxes/cloudflare/webhook_managed/wrangler.jsoncindex 9dcd9013..2da003cc 100644--- a/examples/agents_api/sandboxes/webhook_managed/cloudflare/wrangler.jsonc+++ b/examples/agents_api/sandboxes/cloudflare/webhook_managed/wrangler.jsonc@@ -1,12 +1,12 @@{- "$schema": "node_modules/wrangler/config-schema.json",+ "$schema": "../node_modules/wrangler/config-schema.json","name": "agents-api-webhook-cloudflare","main": "src/index.ts","compatibility_date": "2026-05-07","compatibility_flags": ["nodejs_compat"],"vars": { "OPENAI_AGENT_ID": "set-your-agent-id" },"containers": [- { "class_name": "Sandbox", "image": "./Dockerfile", "max_instances": 4 },+ { "class_name": "Sandbox", "image": "../Dockerfile", "max_instances": 4 },],"durable_objects": {"bindings": [diff --git a/examples/agents_api/sandboxes/daytona/README.md b/examples/agents_api/sandboxes/daytona/README.mdnew file mode 100644index 00000000..0a8fd494--- /dev/null+++ b/examples/agents_api/sandboxes/daytona/README.md@@ -0,0 +1,12 @@+# Daytona sandboxes++Run Agents API tasks with `codex exec-server` in Daytona sandboxes:++- [Application-managed](application_managed/README.md): create a sandbox, run a task,+ read its output, and clean up the sandbox and session.+- [Webhook-managed](webhook_managed/README.md): deploy a controller that provisions+ workers and restarts stopped workers when a session needs a connection.++Both modes use [sandbox.py](sandbox.py) for executor installation and launch.+Workers receive only the restricted executor key; application credentials stay+in the application or webhook controller.diff --git a/examples/agents_api/sandboxes/application_managed/daytona/README.md b/examples/agents_api/sandboxes/daytona/application_managed/README.mdsimilarity index 89%rename from examples/agents_api/sandboxes/application_managed/daytona/README.mdrename to examples/agents_api/sandboxes/daytona/application_managed/README.mdindex a627d038..a2471e0b 100644--- a/examples/agents_api/sandboxes/application_managed/daytona/README.md+++ b/examples/agents_api/sandboxes/daytona/application_managed/README.md@@ -13,7 +13,7 @@ organization, and project. Only the executor key enters the sandbox.From the Cookbook repository root:```bash-uv run examples/agents_api/sandboxes/application_managed/daytona/main.py+uv run examples/agents_api/sandboxes/daytona/application_managed/main.py```Dependencies are declared inline. The script allows six minutes for setup and@@ -28,4 +28,4 @@ Do not attach a provisioning webhook handler to these sessions.- [Daytona documentation](https://www.daytona.io/docs/)- [Daytona Python SDK](https://www.daytona.io/docs/en/python-sdk/)-- [Webhook-managed example](../../webhook_managed/daytona/README.md)+- [Webhook-managed example](../webhook_managed/README.md)diff --git a/examples/agents_api/sandboxes/application_managed/daytona/main.py b/examples/agents_api/sandboxes/daytona/application_managed/main.pysimilarity index 73%rename from examples/agents_api/sandboxes/application_managed/daytona/main.pyrename to examples/agents_api/sandboxes/daytona/application_managed/main.pyindex 3d19e213..e8c1d0d2 100644--- a/examples/agents_api/sandboxes/application_managed/daytona/main.py+++ b/examples/agents_api/sandboxes/daytona/application_managed/main.py@@ -10,12 +10,15 @@import asyncioimport os-import shlex+import sys+from pathlib import Path-from daytona import AsyncDaytona, CreateSandboxFromSnapshotParams, SessionExecuteRequest+from daytona import AsyncDaytona, CreateSandboxFromSnapshotParamsfrom openai import AsyncOpenAI-WORKSPACE = "/workspace"+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))+from sandbox import WORKSPACE, install_executor, start_executor+BRIEF = "Migrate a synchronous Python service to async without changing its API.\n"@@ -30,13 +33,6 @@ async def main() -> None:print(f"Session: {session.id}", flush=True)try:assert session.environment.type == "self_hosted"- executor_args = [- "exec-server",- "--remote",- session.environment.remote_url,- "--environment-id",- session.environment.id,- ]async with asyncio.timeout(360):sandbox = await daytona.create(CreateSandboxFromSnapshotParams(@@ -49,22 +45,12 @@ async def main() -> None:timeout=90,)print(f"Sandbox: {sandbox.id}", flush=True)- setup = await sandbox.process.exec(- "sudo install -d -o daytona -g daytona /workspace && "- "npm install -g --prefix /home/daytona/.local @openai/codex@alpha",- timeout=180,- )- if setup.exit_code != 0:- raise RuntimeError("Executor installation failed")+ await install_executor(sandbox)await sandbox.fs.upload_file(BRIEF.encode(), f"{WORKSPACE}/brief.txt")- await sandbox.process.create_session("executor")- command = shlex.join(["/home/daytona/.local/bin/codex", *executor_args])- await sandbox.process.execute_session_command(- "executor",- SessionExecuteRequest(- command=f"cd {WORKSPACE} && exec {command}",- run_async=True,- ),+ await start_executor(+ sandbox,+ session.environment.remote_url,+ session.environment.id,)async with client.beta.agents.sessions.stream(diff --git a/examples/agents_api/sandboxes/daytona/sandbox.py b/examples/agents_api/sandboxes/daytona/sandbox.pynew file mode 100644index 00000000..685048a8--- /dev/null+++ b/examples/agents_api/sandboxes/daytona/sandbox.py@@ -0,0 +1,54 @@+"""Executor setup and launch shared by the two Daytona examples."""++import shlex++from daytona import AsyncSandbox, DaytonaNotFoundError, SessionExecuteRequest++WORKSPACE = "/workspace"+CODEX = "/home/daytona/.local/bin/codex"+++async def install_executor(sandbox: AsyncSandbox, *, reconnect: bool = False) -> None:+ install = "npm install -g --prefix /home/daytona/.local @openai/codex@alpha"+ if reconnect:+ install = f"(test -x {CODEX} || {install}) && command -v flock"+ result = await sandbox.process.exec(+ f"sudo install -d -o daytona -g daytona {WORKSPACE} && {install}",+ timeout=180,+ )+ if result.exit_code != 0:+ raise RuntimeError("Executor installation failed")+++async def start_executor(+ sandbox: AsyncSandbox,+ remote_url: str,+ environment_id: str,+ *,+ reconnect: bool = False,+) -> None:+ if reconnect:+ try:+ await sandbox.process.get_session("executor")+ except DaytonaNotFoundError:+ await sandbox.process.create_session("executor")+ else:+ await sandbox.process.create_session("executor")+ args = [+ CODEX,+ "exec-server",+ "--remote",+ remote_url,+ "--environment-id",+ environment_id,+ ]+ if reconnect:+ # flock makes retries safe while an executor is already running.+ args = ["flock", "-n", "/tmp/codex-executor.lock", *args]+ command = f"{shlex.join(args)} >> /tmp/codex-executor.log 2>&1"+ else:+ command = f"exec {shlex.join(args)}"+ await sandbox.process.execute_session_command(+ "executor",+ SessionExecuteRequest(command=f"cd {WORKSPACE} && {command}", run_async=True),+ )diff --git a/examples/agents_api/sandboxes/webhook_managed/daytona/README.md b/examples/agents_api/sandboxes/daytona/webhook_managed/README.mdsimilarity index 88%rename from examples/agents_api/sandboxes/webhook_managed/daytona/README.mdrename to examples/agents_api/sandboxes/daytona/webhook_managed/README.mdindex 958a742a..e8745269 100644--- a/examples/agents_api/sandboxes/webhook_managed/daytona/README.md+++ b/examples/agents_api/sandboxes/daytona/webhook_managed/README.md@@ -9,7 +9,7 @@ the `daytona` user and installs the Codex alpha under that user's `.local` direc## Deploy-Create an agent using the [shared setup](../README.md#set-up-once). Run the+Create an agent using the [shared setup](../../webhook_managed.md#set-up-once). Run thedeployment command below from the Cookbook repository root.Set `OPENAI_AGENT_ID` to the agent ID from the shared setup. Provide it alongside@@ -19,13 +19,18 @@ and user or service account. Optional `DAYTONA_API_URL` and `DAYTONA_TARGET` arepassed to the controller.```bash-uv run examples/agents_api/sandboxes/webhook_managed/daytona/deploy.py+uv run examples/agents_api/sandboxes/daytona/webhook_managed/deploy.py```Register the printed URL in **OpenAI project settings → Webhooks**, subscribing to`agent.session.action_required` and `agent.session.failed`. Set the generated`OPENAI_WEBHOOK_SECRET` locally and run the deployment command again. Use the-[shared client](../README.md#run-and-reconnect) to create sessions and submit work.+[run and reconnect guide](../../webhook_managed.md#run-and-reconnect) with this+provider's client to create sessions and submit work:++```bash+uv run examples/agents_api/sandboxes/daytona/webhook_managed/client.py --agent-id "$OPENAI_AGENT_ID"+```Do not register this URL in Daytona's Webhooks page: that page sends Daytonalifecycle notifications outward, rather than receiving OpenAI events.diff --git a/examples/agents_api/sandboxes/daytona/webhook_managed/client.py b/examples/agents_api/sandboxes/daytona/webhook_managed/client.pynew file mode 100644index 00000000..fb62b24f--- /dev/null+++ b/examples/agents_api/sandboxes/daytona/webhook_managed/client.py@@ -0,0 +1,83 @@+# /// script+# requires-python = ">=3.11"+# dependencies = [+# "openai>=3.13.0",+# ]+# ///++"""Use Agents API without importing a sandbox provider SDK."""++from __future__ import annotations++import argparse+import asyncio+import json++from openai import AsyncOpenAI+++async def main() -> None:+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--create-agent", metavar="NAME")+ parser.add_argument("--agent-id")+ parser.add_argument("--session-id")+ parser.add_argument("--delete", action="store_true")+ parser.add_argument("--model", default="gpt-5.6-sol")+ parser.add_argument("--workspace", default="/workspace")+ parser.add_argument(+ "--input", default="Run a shell command to print hello from the sandbox."+ )+ args = parser.parse_args()++ async with AsyncOpenAI(timeout=600) as client:+ if args.create_agent:+ agent = await client.beta.agents.create(+ model=args.model, name=args.create_agent+ )+ print(json.dumps({"agent_id": agent.id}))+ return+ if args.delete:+ if not args.session_id:+ parser.error(+ "--delete requires --session-id; stop provider compute separately"+ )+ await client.beta.agents.sessions.delete(args.session_id)+ print(json.dumps({"deleted": args.session_id}))+ return+ if args.session_id:+ session = await client.beta.agents.sessions.retrieve(args.session_id)+ else:+ if not args.agent_id:+ parser.error(+ "Pass --agent-id from --create-agent, or an existing --session-id"+ )+ session = await client.beta.agents.sessions.create(+ agent_id=args.agent_id,+ environment={+ "type": "self_hosted",+ "workspace_directory": args.workspace,+ },+ )+ print(json.dumps({"session_id": session.id}), flush=True)+ completed = False+ async with client.beta.agents.sessions.stream(+ session.id, input=args.input+ ) as events:+ async for event in events:+ if event.type in {+ "agent.session.turn.failed",+ "agent.session.turn.cancelled",+ "agent.session.failed",+ }:+ raise RuntimeError(f"Agent failed: {event.type}")+ if event.type == "agent.session.turn.output_text.delta":+ print(event.delta, end="", flush=True)+ if event.type == "agent.session.turn.completed":+ completed = True+ if not completed:+ raise RuntimeError("Stream ended without a completed turn")+ print()+++if __name__ == "__main__":+ asyncio.run(main())diff --git a/examples/agents_api/sandboxes/webhook_managed/daytona/deploy.py b/examples/agents_api/sandboxes/daytona/webhook_managed/deploy.pysimilarity index 83%rename from examples/agents_api/sandboxes/webhook_managed/daytona/deploy.pyrename to examples/agents_api/sandboxes/daytona/webhook_managed/deploy.pyindex 286d9298..64f3d7f2 100644--- a/examples/agents_api/sandboxes/webhook_managed/daytona/deploy.py+++ b/examples/agents_api/sandboxes/daytona/webhook_managed/deploy.py@@ -48,7 +48,9 @@ async def main() -> None:sandbox = await daytona.create(CreateSandboxFromImageParams(name=NAME,- image=Image.base("python:3.12-slim").run_commands("mkdir -p /app"),+ image=Image.base("python:3.12-slim").run_commands(+ "mkdir -p /app/webhook_managed"+ ),os_user="root",public=True,env_vars=values,@@ -63,11 +65,15 @@ async def main() -> None:await sandbox.start(timeout=90)await sandbox.update_env(values)await sandbox.set_ttl(120)+ await sandbox.fs.create_folder("/app/webhook_managed", "755")await sandbox.fs.upload_file(- ROOT.joinpath("handler.py").read_bytes(), "/app/handler.py"+ ROOT.joinpath("handler.py").read_bytes(), "/app/webhook_managed/handler.py"+ )+ await sandbox.fs.upload_file(+ ROOT.parent.joinpath("sandbox.py").read_bytes(), "/app/sandbox.py")install = await sandbox.process.exec(- "python -m pip install uv && uv pip install --system -r /app/handler.py",+ "python -m pip install uv && uv pip install --system -r /app/webhook_managed/handler.py",timeout=180,)if install.exit_code != 0:@@ -82,7 +88,7 @@ async def main() -> None:await sandbox.process.execute_session_command("webhook-controller",SessionExecuteRequest(- command="cd /app && python -m uvicorn handler:app --host 0.0.0.0 --port 8000 >> /app/controller.log 2>&1",+ command="cd /app/webhook_managed && python -m uvicorn handler:app --host 0.0.0.0 --port 8000 >> /app/controller.log 2>&1",run_async=True,),)diff --git a/examples/agents_api/sandboxes/webhook_managed/daytona/handler.py b/examples/agents_api/sandboxes/daytona/webhook_managed/handler.pysimilarity index 82%rename from examples/agents_api/sandboxes/webhook_managed/daytona/handler.pyrename to examples/agents_api/sandboxes/daytona/webhook_managed/handler.pyindex fb84b257..622a438f 100644--- a/examples/agents_api/sandboxes/webhook_managed/daytona/handler.py+++ b/examples/agents_api/sandboxes/daytona/webhook_managed/handler.py@@ -17,23 +17,26 @@ import asyncioimport hashlibimport jsonimport os-import shleximport sqlite3+import sysimport timeimport tracebackfrom collections.abc import AsyncIteratorfrom contextlib import asynccontextmanager+from pathlib import Pathfrom daytona import (AsyncDaytona,CreateSandboxFromSnapshotParams,DaytonaNotFoundError,- SessionExecuteRequest,)from fastapi import FastAPI, Requestfrom fastapi.responses import JSONResponsefrom openai import AsyncOpenAI, InvalidWebhookSignatureError, NotFoundError, OpenAI+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))+from sandbox import install_executor, start_executor+DB_PATH = os.environ.get("QUEUE_PATH", "/app/pending.sqlite3")@@ -82,36 +85,12 @@ async def reconcile(session_id: str) -> None:)elif sandbox.state != "started":await sandbox.start(timeout=90)- setup = await sandbox.process.exec(- "sudo install -d -o daytona -g daytona /workspace && (test -x /home/daytona/.local/bin/codex || npm install -g --prefix /home/daytona/.local @openai/codex@alpha) && command -v flock",- timeout=180,- )- if setup.exit_code != 0:- raise RuntimeError("Executor setup failed")- try:- await sandbox.process.get_session("executor")- except DaytonaNotFoundError:- await sandbox.process.create_session("executor")- command = shlex.join(- [- "flock",- "-n",- "/tmp/codex-executor.lock",- "/home/daytona/.local/bin/codex",- "exec-server",- "--remote",- session.environment.remote_url,- "--environment-id",- session.environment.id,- ]- )- # flock makes repeated or retried provisioning safe while the executor is running.- await sandbox.process.execute_session_command(- "executor",- SessionExecuteRequest(- command=f"cd /workspace && {command} >> /tmp/codex-executor.log 2>&1",- run_async=True,- ),+ await install_executor(sandbox, reconnect=True)+ await start_executor(+ sandbox,+ session.environment.remote_url,+ session.environment.id,+ reconnect=True,)print(json.dumps(diff --git a/examples/agents_api/sandboxes/digitalocean/README.md b/examples/agents_api/sandboxes/digitalocean/README.mdnew file mode 100644index 00000000..35d7cf88--- /dev/null+++ b/examples/agents_api/sandboxes/digitalocean/README.md@@ -0,0 +1,16 @@+# DigitalOcean sandboxes++[DigitalOcean Managed Agents](https://docs.digitalocean.com/products/managed-agents/)+is in public preview. These examples use its Harness Runtime and require PyDo+0.41.0 or later with async support:++- [Application-managed](application_managed/README.md): create a sandbox, run a+ task, download its output, and delete both the sandbox and Agents API session.+- [Webhook-managed](webhook_managed/README.md): run a signed webhook controller+ that provisions sandboxes and resumes them on reconnect.++Both modes use [environment.yaml](environment.yaml). The `codex-agentapi`+template starts the executor, and only the restricted executor key is supplied+to the sandbox.+The webhook controller is separate from sandbox compute and can run locally or+on App Platform.diff --git a/examples/agents_api/sandboxes/application_managed/digitalocean/README.md b/examples/agents_api/sandboxes/digitalocean/application_managed/README.mdsimilarity index 65%rename from examples/agents_api/sandboxes/application_managed/digitalocean/README.mdrename to examples/agents_api/sandboxes/digitalocean/application_managed/README.mdindex 8409537e..1281796e 100644--- a/examples/agents_api/sandboxes/application_managed/digitalocean/README.md+++ b/examples/agents_api/sandboxes/digitalocean/application_managed/README.md@@ -7,8 +7,11 @@ destroys the sandbox, and deletes the session.## Run-You need access to DigitalOcean's Agent Harness Runtime preview and the-`codex-agentapi` template. This example uses the [PyDo beta SDK](https://github.com/digitalocean/pydo/releases/tag/v0.40.0-beta.7).+You need a sandbox-enabled DigitalOcean account with access to the+`codex-agentapi` template. [DigitalOcean Managed Agents](https://docs.digitalocean.com/products/managed-agents/)+is in public preview. Use [PyDo 0.41.0 or later](https://github.com/digitalocean/pydo/releases)+with async support (`pydo[aio]`).+The DigitalOcean CLI is not required for this flow.Set `DIGITALOCEAN_TOKEN`, `OPENAI_API_KEY`, and a separate restricted`OPENAI_EXECUTOR_API_KEY`. The OpenAI keys must have the same owner,@@ -17,10 +20,10 @@ organization, and project. Only the executor key is passed to DigitalOcean.From the Cookbook repository root:```bash-uv run examples/agents_api/sandboxes/application_managed/digitalocean/main.py+uv run examples/agents_api/sandboxes/digitalocean/application_managed/main.py```-Dependencies are declared inline. The script reads the flat [agents.yaml](agents.yaml)+Dependencies are declared inline. The script reads the shared [environment.yaml](../environment.yaml)manifest and supplies the environment ID and executor key at runtime. Do notlog or save the resolved manifest: it contains the executor key.@@ -34,6 +37,6 @@ Do not attach a provisioning webhook handler to these sessions.## References-- [DigitalOcean sandbox setup example](https://github.com/digitalocean/pydo/tree/v0.40.0-beta.7/examples/agents/doc_python_sdk)+- [DigitalOcean sandbox setup example](https://github.com/digitalocean/pydo/tree/main/examples/agents/doc_python_sdk)- [DigitalOcean Python SDK](https://github.com/digitalocean/pydo)-- [Webhook-managed example](../../webhook_managed/digitalocean/README.md)+- [Webhook-managed example](../webhook_managed/README.md)diff --git a/examples/agents_api/sandboxes/application_managed/digitalocean/main.py b/examples/agents_api/sandboxes/digitalocean/application_managed/main.pysimilarity index 95%rename from examples/agents_api/sandboxes/application_managed/digitalocean/main.pyrename to examples/agents_api/sandboxes/digitalocean/application_managed/main.pyindex 9758d408..c03b5ff2 100644--- a/examples/agents_api/sandboxes/application_managed/digitalocean/main.py+++ b/examples/agents_api/sandboxes/digitalocean/application_managed/main.py@@ -2,7 +2,7 @@# requires-python = ">=3.11"# dependencies = [# "openai>=3.13.0",-# "pydo[aio] @ https://github.com/digitalocean/pydo/releases/download/v0.40.0-beta.7/pydo-0.40.0b7-py3-none-any.whl",+# "pydo[aio]>=0.41.0",# ]# ///@@ -16,7 +16,7 @@ from openai import AsyncOpenAIfrom pydo.aio import ClientWORKSPACE = "/workspace"-MANIFEST = Path(__file__).with_name("agents.yaml")+MANIFEST = Path(__file__).resolve().parents[1] / "environment.yaml"async def main() -> None:diff --git a/examples/agents_api/sandboxes/application_managed/digitalocean/agents.yaml b/examples/agents_api/sandboxes/digitalocean/environment.yamlsimilarity index 100%rename from examples/agents_api/sandboxes/application_managed/digitalocean/agents.yamlrename to examples/agents_api/sandboxes/digitalocean/environment.yamldiff --git a/examples/agents_api/sandboxes/digitalocean/webhook_managed/Dockerfile b/examples/agents_api/sandboxes/digitalocean/webhook_managed/Dockerfilenew file mode 100644index 00000000..afe16e2c--- /dev/null+++ b/examples/agents_api/sandboxes/digitalocean/webhook_managed/Dockerfile@@ -0,0 +1,10 @@+FROM python:3.14-slim++WORKDIR /app+COPY examples/agents_api/sandboxes/digitalocean/environment.yaml ./examples/agents_api/sandboxes/digitalocean/environment.yaml+COPY examples/agents_api/sandboxes/digitalocean/webhook_managed/handler.py ./examples/agents_api/sandboxes/digitalocean/webhook_managed/handler.py+RUN python -m pip install --no-cache-dir uv \+ && uv pip install --system -r examples/agents_api/sandboxes/digitalocean/webhook_managed/handler.py++EXPOSE 8080+CMD ["python", "examples/agents_api/sandboxes/digitalocean/webhook_managed/handler.py"]diff --git a/examples/agents_api/sandboxes/webhook_managed/digitalocean/README.md b/examples/agents_api/sandboxes/digitalocean/webhook_managed/README.mdsimilarity index 64%rename from examples/agents_api/sandboxes/webhook_managed/digitalocean/README.mdrename to examples/agents_api/sandboxes/digitalocean/webhook_managed/README.mdindex c36f8c06..b75a2ce8 100644--- a/examples/agents_api/sandboxes/webhook_managed/digitalocean/README.md+++ b/examples/agents_api/sandboxes/digitalocean/webhook_managed/README.md@@ -16,28 +16,36 @@ Idle sandboxes are paused automatically and resumed on reconnect.## Deploy-Use Python 3.11+ and a DigitalOcean account with MARS access. Create the agent-using the [shared setup](../README.md#set-up-once).+Use Python 3.11+ and a sandbox-enabled DigitalOcean account with access to+`codex-agentapi`. [DigitalOcean Managed Agents](https://docs.digitalocean.com/products/managed-agents/)+is in public preview. Create the agent+using the [shared setup](../../webhook_managed.md#set-up-once) with this provider's+`webhook_managed/client.py`.-MARS session support ships in the PyDo beta release. The script's inline-dependencies select its release wheel; the stable `0.40.0` client has no-`agents` resource. To install the beta separately:+Use [PyDo 0.41.0 or later](https://github.com/digitalocean/pydo/releases) with+async support. The script declares this dependency inline.+To install it separately:```bash-pip install "pydo[aio] @ https://github.com/digitalocean/pydo/releases/download/v0.40.0-beta.7/pydo-0.40.0b7-py3-none-any.whl"+pip install "pydo[aio]>=0.41.0"```App Platform deploys from a Git repository. Push a copy of these examplesto your own repository, preserving the `examples/agents_api/` paths. Set`github.repo` in [app.yaml](app.yaml) to it, then create the app. The-[Dockerfile](Dockerfile) builds from the repository root and installs dependencies+[Dockerfile](Dockerfile) packages the handler and shared [environment.yaml](../environment.yaml),+builds from the repository root, and installs dependenciesat build time; credentials are available only at runtime.This recipe uses OpenAI Python SDK `3.13.0` or later with `client.beta.agents`.Do not add API keys or Git tokens to the Dockerfile or build context.+Install [doctl 1.170.0 or later](https://github.com/digitalocean/doctl/releases)+and authenticate with `doctl auth init` to run the deployment and cleanup+commands below. The CLI is not required to run the Python controller locally.+```bash-doctl apps create --spec examples/agents_api/sandboxes/webhook_managed/digitalocean/app.yaml+doctl apps create --spec examples/agents_api/sandboxes/digitalocean/webhook_managed/app.yaml```Configure these variables on the service:@@ -50,20 +58,30 @@ Configure these variables on the service:- `DIGITALOCEAN_TOKEN`: API token that can manage MARS sessions.For the first deployment only, use `pending-webhook-registration` as the signing-value; the receiver rejects it with `503`.+value; the receiver rejects requests until you configure the signing secret.`doctl apps list` prints the deployed URL. The webhook URL is`https://YOUR_APP.ondigitalocean.app/webhook`, and OpenAI must be able to reachit without a login. Register the webhook, enable `agent.session.action_required`and `agent.session.failed`, replace the signing value with the real secret, and-redeploy. Then use the [shared client](../README.md#run-and-reconnect).+redeploy. Then follow [run and reconnect](../../webhook_managed.md#run-and-reconnect):++```bash+uv run examples/agents_api/sandboxes/digitalocean/webhook_managed/client.py --agent-id "$OPENAI_AGENT_ID"+uv run examples/agents_api/sandboxes/digitalocean/webhook_managed/client.py --session-id "$SESSION_ID" --input "Run another shell command."+```Environment-variable changes require a new deployment.+PyDo 0.41.0 can raise `StreamConsumedError` after a successful empty resume+response. If it does, the controller checks for `SESSION_STATUS_READY` within+ten seconds before acknowledging the+webhook. An unconfirmed resume or any other SDK error still fails the delivery.+### Run the controller locally```bash-uv run examples/agents_api/sandboxes/webhook_managed/digitalocean/handler.py+uv run examples/agents_api/sandboxes/digitalocean/webhook_managed/handler.py```Expose port 8080 with a tunnel and register that URL. On macOS python.org@@ -73,7 +91,7 @@ builds, requests to `api.digitalocean.com` can fail with## Configure the sandbox-The manifest in [handler.py](handler.py) is the unit of configuration. Two+The shared [environment.yaml](../environment.yaml) is the unit of configuration. Twofields matter most:- `agent: codex-agentapi` selects the image that runs the executor.diff --git a/examples/agents_api/sandboxes/webhook_managed/digitalocean/app.yaml b/examples/agents_api/sandboxes/digitalocean/webhook_managed/app.yamlsimilarity index 88%rename from examples/agents_api/sandboxes/webhook_managed/digitalocean/app.yamlrename to examples/agents_api/sandboxes/digitalocean/webhook_managed/app.yamlindex 2e4484d7..a4ce29e8 100644--- a/examples/agents_api/sandboxes/webhook_managed/digitalocean/app.yaml+++ b/examples/agents_api/sandboxes/digitalocean/webhook_managed/app.yaml@@ -5,7 +5,7 @@ services:instance_size_slug: apps-s-1vcpu-0.5gbhttp_port: 8080source_dir: /- dockerfile_path: examples/agents_api/sandboxes/webhook_managed/digitalocean/Dockerfile+ dockerfile_path: examples/agents_api/sandboxes/digitalocean/webhook_managed/Dockerfilegithub:repo: <your-org>/<your-repo>branch: maindiff --git a/examples/agents_api/sandboxes/digitalocean/webhook_managed/client.py b/examples/agents_api/sandboxes/digitalocean/webhook_managed/client.pynew file mode 100644index 00000000..fb62b24f--- /dev/null+++ b/examples/agents_api/sandboxes/digitalocean/webhook_managed/client.py@@ -0,0 +1,83 @@+# /// script+# requires-python = ">=3.11"+# dependencies = [+# "openai>=3.13.0",+# ]+# ///++"""Use Agents API without importing a sandbox provider SDK."""++from __future__ import annotations++import argparse+import asyncio+import json++from openai import AsyncOpenAI+++async def main() -> None:+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--create-agent", metavar="NAME")+ parser.add_argument("--agent-id")+ parser.add_argument("--session-id")+ parser.add_argument("--delete", action="store_true")+ parser.add_argument("--model", default="gpt-5.6-sol")+ parser.add_argument("--workspace", default="/workspace")+ parser.add_argument(+ "--input", default="Run a shell command to print hello from the sandbox."+ )+ args = parser.parse_args()++ async with AsyncOpenAI(timeout=600) as client:+ if args.create_agent:+ agent = await client.beta.agents.create(+ model=args.model, name=args.create_agent+ )+ print(json.dumps({"agent_id": agent.id}))+ return+ if args.delete:+ if not args.session_id:+ parser.error(+ "--delete requires --session-id; stop provider compute separately"+ )+ await client.beta.agents.sessions.delete(args.session_id)+ print(json.dumps({"deleted": args.session_id}))+ return+ if args.session_id:+ session = await client.beta.agents.sessions.retrieve(args.session_id)+ else:+ if not args.agent_id:+ parser.error(+ "Pass --agent-id from --create-agent, or an existing --session-id"+ )+ session = await client.beta.agents.sessions.create(+ agent_id=args.agent_id,+ environment={+ "type": "self_hosted",+ "workspace_directory": args.workspace,+ },+ )+ print(json.dumps({"session_id": session.id}), flush=True)+ completed = False+ async with client.beta.agents.sessions.stream(+ session.id, input=args.input+ ) as events:+ async for event in events:+ if event.type in {+ "agent.session.turn.failed",+ "agent.session.turn.cancelled",+ "agent.session.failed",+ }:+ raise RuntimeError(f"Agent failed: {event.type}")+ if event.type == "agent.session.turn.output_text.delta":+ print(event.delta, end="", flush=True)+ if event.type == "agent.session.turn.completed":+ completed = True+ if not completed:+ raise RuntimeError("Stream ended without a completed turn")+ print()+++if __name__ == "__main__":+ asyncio.run(main())diff --git a/examples/agents_api/sandboxes/webhook_managed/digitalocean/handler.py b/examples/agents_api/sandboxes/digitalocean/webhook_managed/handler.pysimilarity index 83%rename from examples/agents_api/sandboxes/webhook_managed/digitalocean/handler.pyrename to examples/agents_api/sandboxes/digitalocean/webhook_managed/handler.pyindex 3db28688..7dd86fe4 100644--- a/examples/agents_api/sandboxes/webhook_managed/digitalocean/handler.py+++ b/examples/agents_api/sandboxes/digitalocean/webhook_managed/handler.py@@ -2,7 +2,7 @@# requires-python = ">=3.11"# dependencies = [# "openai>=3.13.0",-# "pydo[aio] @ https://github.com/digitalocean/pydo/releases/download/v0.40.0-beta.7/pydo-0.40.0b7-py3-none-any.whl",+# "pydo[aio]>=0.41.0",# "fastapi[standard]",# ]# ///@@ -26,34 +26,16 @@ from __future__ import annotationsimport asyncioimport jsonimport os+from pathlib import Pathfrom typing import Any+from azure.core.exceptions import StreamConsumedErrorfrom fastapi import FastAPI, Requestfrom fastapi.responses import JSONResponsefrom openai import APIStatusError, AsyncOpenAI, InvalidWebhookSignatureError, OpenAIfrom pydo.aio import Client as DOClient-# `${ENV_ID}` and `${OPENAI_API_KEY}` are substituted from `variables` below.-# Credentials belong under `secrets:`, not `env:` — the create API rejects a-# credential-shaped `env` value. `config` is passed through to OpenAI verbatim-# and is required even when attaching to an existing session.-MANIFEST = """-name: {name}-agent: codex-agentapi-config:- agent:- model: gpt-5.6-sol- environment:- type: self_hosted- workspace_directory: /workspace-secrets:- CODEX_API_KEY: ${{OPENAI_API_KEY}}-env:- CODEX_ENVIRONMENT_ID: ${{ENV_ID}}-egress:- - api.openai.com- - codex-cloud-environments.chatgpt.com-"""+MANIFEST = Path(__file__).resolve().parents[1] / "environment.yaml"# A session in one of these is gone for good; a new one must be created.TERMINAL_STATUSES = {@@ -120,7 +102,21 @@ async def reconcile(openai_session_id: str) -> None:# idle; otherwise it is starting or already connected, and creating# a second sandbox for one session would be the real failure.if existing.get("status") == "SESSION_STATUS_PAUSED":- await do.agents.sessions.resume(existing["session_id"])+ try:+ await do.agents.sessions.resume(existing["session_id"])+ except StreamConsumedError:+ # PyDo 0.41.0 can fail to parse a successful empty response.+ # Confirm the resume before acknowledging this delivery.+ async with asyncio.timeout(10):+ for attempt in range(5):+ current = await do.agents.sessions.get(+ existing["session_id"]+ )+ if current["session"]["status"] == "SESSION_STATUS_READY":+ break+ if attempt == 4:+ raise+ await asyncio.sleep(1)_log(openai_session_id, name, "resumed")return@@ -130,10 +126,10 @@ async def reconcile(openai_session_id: str) -> None:response = await do.agents.create_session(params={"openai_session_id": openai_session_id},body={- "manifest": MANIFEST.format(name=name),+ "manifest": MANIFEST.read_text().replace("{name}", name),"variables": {- "ENV_ID": environment.id,- "OPENAI_API_KEY": os.environ["OPENAI_EXECUTOR_API_KEY"],+ "ENVIRONMENT_ID": environment.id,+ "EXECUTOR_API_KEY": os.environ["OPENAI_EXECUTOR_API_KEY"],},},)diff --git a/examples/agents_api/sandboxes/docker/README.md b/examples/agents_api/sandboxes/docker/README.mdnew file mode 100644index 00000000..47453826--- /dev/null+++ b/examples/agents_api/sandboxes/docker/README.md@@ -0,0 +1,6 @@+# Docker sandbox++[Run the application-managed example](application_managed/README.md) to build a+local executor image, run a task, and clean up the container and API session.++This example requires Docker. It does not include a webhook controller.diff --git a/examples/agents_api/sandboxes/application_managed/docker/Dockerfile b/examples/agents_api/sandboxes/docker/application_managed/Dockerfilesimilarity index 100%rename from examples/agents_api/sandboxes/application_managed/docker/Dockerfilerename to examples/agents_api/sandboxes/docker/application_managed/Dockerfilediff --git a/examples/agents_api/sandboxes/application_managed/docker/README.md b/examples/agents_api/sandboxes/docker/application_managed/README.mdsimilarity index 83%rename from examples/agents_api/sandboxes/application_managed/docker/README.mdrename to examples/agents_api/sandboxes/docker/application_managed/README.mdindex 16de84dc..3e188ee4 100644--- a/examples/agents_api/sandboxes/application_managed/docker/README.md+++ b/examples/agents_api/sandboxes/docker/application_managed/README.md@@ -10,11 +10,11 @@ Start Docker and set `OPENAI_API_KEY` and a separate restrictedFrom the Cookbook repository root:```bash-uv run examples/agents_api/sandboxes/application_managed/docker/main.py+uv run examples/agents_api/sandboxes/docker/application_managed/main.py```The [Dockerfile](Dockerfile) installs Codex and copies the sample into `/workspace`.This is a local development example, not a hardened multi-tenant sandbox.To manage cloud compute through OpenAI webhooks, use the-[webhook-managed examples](../../webhook_managed/README.md).+[webhook-managed examples](../../webhook_managed.md).diff --git a/examples/agents_api/sandboxes/application_managed/docker/__init__.py b/examples/agents_api/sandboxes/docker/application_managed/__init__.pysimilarity index 100%rename from examples/agents_api/sandboxes/application_managed/docker/__init__.pyrename to examples/agents_api/sandboxes/docker/application_managed/__init__.pydiff --git a/examples/agents_api/sandboxes/application_managed/docker/main.py b/examples/agents_api/sandboxes/docker/application_managed/main.pysimilarity index 100%rename from examples/agents_api/sandboxes/application_managed/docker/main.pyrename to examples/agents_api/sandboxes/docker/application_managed/main.pyindex 9c5419ef..d9eae23e 100644--- a/examples/agents_api/sandboxes/application_managed/docker/main.py+++ b/examples/agents_api/sandboxes/docker/application_managed/main.py@@ -5,10 +5,10 @@# ]# ///-from __future__ import annotations-"""Self-hosted Agents API example using a local Docker container."""+from __future__ import annotations+import asyncioimport osimport rediff --git a/examples/agents_api/sandboxes/application_managed/docker/sample_report.txt b/examples/agents_api/sandboxes/docker/application_managed/sample_report.txtsimilarity index 100%rename from examples/agents_api/sandboxes/application_managed/docker/sample_report.txtrename to examples/agents_api/sandboxes/docker/application_managed/sample_report.txtdiff --git a/examples/agents_api/sandboxes/e2b/README.md b/examples/agents_api/sandboxes/e2b/README.mdnew file mode 100644index 00000000..c7d1e64e--- /dev/null+++ b/examples/agents_api/sandboxes/e2b/README.md@@ -0,0 +1,12 @@+# E2B sandboxes++Run Agents API tasks with `codex exec-server` in E2B sandboxes:++- [Application-managed](application_managed/README.md): create a sandbox, run a task,+ read its output, and clean up the sandbox and session.+- [Webhook-managed](webhook_managed/README.md): deploy a controller that provisions+ workers and resumes paused workers when a session needs a connection.++Both modes use [sandbox.py](sandbox.py) for executor installation and launch.+Workers receive only the restricted executor key; application credentials stay+in the application or webhook controller.diff --git a/examples/agents_api/sandboxes/application_managed/e2b/README.md b/examples/agents_api/sandboxes/e2b/application_managed/README.mdsimilarity index 89%rename from examples/agents_api/sandboxes/application_managed/e2b/README.mdrename to examples/agents_api/sandboxes/e2b/application_managed/README.mdindex cff63f79..738b46e8 100644--- a/examples/agents_api/sandboxes/application_managed/e2b/README.md+++ b/examples/agents_api/sandboxes/e2b/application_managed/README.md@@ -13,7 +13,7 @@ organization, and project. Only the executor key enters the sandbox.From the Cookbook repository root:```bash-uv run examples/agents_api/sandboxes/application_managed/e2b/main.py+uv run examples/agents_api/sandboxes/e2b/application_managed/main.py```Dependencies are declared inline. The script allows six minutes for setup and@@ -28,4 +28,4 @@ Do not attach a provisioning webhook handler to these sessions.- [E2B documentation](https://e2b.dev/docs)- [E2B SDK reference](https://e2b.dev/docs/sdk-reference)-- [Webhook-managed example](../../webhook_managed/e2b/README.md)+- [Webhook-managed example](../webhook_managed/README.md)diff --git a/examples/agents_api/sandboxes/application_managed/e2b/main.py b/examples/agents_api/sandboxes/e2b/application_managed/main.pysimilarity index 78%rename from examples/agents_api/sandboxes/application_managed/e2b/main.pyrename to examples/agents_api/sandboxes/e2b/application_managed/main.pyindex 7766b0eb..7be17b90 100644--- a/examples/agents_api/sandboxes/application_managed/e2b/main.py+++ b/examples/agents_api/sandboxes/e2b/application_managed/main.py@@ -10,12 +10,15 @@import asyncioimport os-import shlex+import sys+from pathlib import Pathfrom e2b import AsyncSandboxfrom openai import AsyncOpenAI-WORKSPACE = "/workspace"+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))+from sandbox import WORKSPACE, install_executor, start_executor+BRIEF = "Migrate a synchronous Python service to async without changing its API.\n"@@ -30,13 +33,6 @@ async def main() -> None:print(f"Session: {session.id}", flush=True)try:assert session.environment.type == "self_hosted"- executor_args = [- "exec-server",- "--remote",- session.environment.remote_url,- "--environment-id",- session.environment.id,- ]async with asyncio.timeout(360):sandbox = await AsyncSandbox.create(timeout=600,@@ -44,19 +40,13 @@ async def main() -> None:network={"allow_public_traffic": False},)print(f"Sandbox: {sandbox.sandbox_id}", flush=True)- await sandbox.commands.run(- "mkdir -p /workspace && npm install -g @openai/codex@alpha",- user="root",- timeout=180,- )+ await install_executor(sandbox)await sandbox.files.write(f"{WORKSPACE}/brief.txt", BRIEF, user="root")- await sandbox.commands.run(- shlex.join(["codex", *executor_args]),- envs={"CODEX_API_KEY": executor_key},- user="root",- cwd=WORKSPACE,- background=True,- timeout=0,+ await start_executor(+ sandbox,+ session.environment.remote_url,+ session.environment.id,+ executor_key=executor_key,)async with client.beta.agents.sessions.stream(diff --git a/examples/agents_api/sandboxes/e2b/sandbox.py b/examples/agents_api/sandboxes/e2b/sandbox.pynew file mode 100644index 00000000..efcdcf67--- /dev/null+++ b/examples/agents_api/sandboxes/e2b/sandbox.py@@ -0,0 +1,49 @@+"""Executor setup and launch shared by the two E2B examples."""++import shlex++from e2b import AsyncSandbox++WORKSPACE = "/workspace"+++async def install_executor(sandbox: AsyncSandbox, *, reconnect: bool = False) -> None:+ install = "npm install -g @openai/codex@alpha"+ if reconnect:+ install = f"(command -v codex || {install}) && command -v flock"+ await sandbox.commands.run(+ f"mkdir -p {WORKSPACE} && {install}", user="root", timeout=180+ )+++async def start_executor(+ sandbox: AsyncSandbox,+ remote_url: str,+ environment_id: str,+ *,+ executor_key: str | None = None,+ reconnect: bool = False,+) -> None:+ args = [+ "codex",+ "exec-server",+ "--remote",+ remote_url,+ "--environment-id",+ environment_id,+ ]+ if reconnect:+ args = ["flock", "-n", "/tmp/codex-executor.lock", *args]+ command = shlex.join(args)+ if reconnect:+ command += " >> /tmp/codex-executor.log 2>&1"+ # Webhook workers inherit the restricted key from sandbox creation.+ envs = {"CODEX_API_KEY": executor_key} if executor_key is not None else None+ await sandbox.commands.run(+ command,+ envs=envs,+ user="root",+ cwd=WORKSPACE,+ background=True,+ timeout=0,+ )diff --git a/examples/agents_api/sandboxes/webhook_managed/e2b/README.md b/examples/agents_api/sandboxes/e2b/webhook_managed/README.mdsimilarity index 89%rename from examples/agents_api/sandboxes/webhook_managed/e2b/README.mdrename to examples/agents_api/sandboxes/e2b/webhook_managed/README.mdindex d022af15..ff39b281 100644--- a/examples/agents_api/sandboxes/webhook_managed/e2b/README.md+++ b/examples/agents_api/sandboxes/e2b/webhook_managed/README.md@@ -6,7 +6,7 @@ Agent commands run only in the worker sandbox.## Deploy-Create an agent using the [shared setup](../README.md#set-up-once). Run the+Create an agent using the [shared setup](../../webhook_managed.md#set-up-once). Run thedeployment command below from the Cookbook repository root.Set `OPENAI_AGENT_ID` to the agent ID from the shared setup. Provide it alongside@@ -15,7 +15,7 @@ manager. The two OpenAI keys must match the session owner's organization, projecand user or service account.```bash-uv run examples/agents_api/sandboxes/webhook_managed/e2b/deploy.py+uv run examples/agents_api/sandboxes/e2b/webhook_managed/deploy.py```The deployment saves the controller ID in the ignored `.controller.json` beside@@ -26,7 +26,12 @@ URL changes, so update the OpenAI webhook too.Register the printed URL in **OpenAI project settings → Webhooks**, subscribing to`agent.session.action_required` and `agent.session.failed`. Set the generated`OPENAI_WEBHOOK_SECRET` locally and redeploy. Then use the-[shared client](../README.md#run-and-reconnect).+[run and reconnect guide](../../webhook_managed.md#run-and-reconnect) with this+provider's client:++```bash+uv run examples/agents_api/sandboxes/e2b/webhook_managed/client.py --agent-id "$OPENAI_AGENT_ID"+```E2B's Webhooks page is for outgoing sandbox lifecycle notifications; it is notwhere you register this OpenAI receiver.diff --git a/examples/agents_api/sandboxes/e2b/webhook_managed/client.py b/examples/agents_api/sandboxes/e2b/webhook_managed/client.pynew file mode 100644index 00000000..fb62b24f--- /dev/null+++ b/examples/agents_api/sandboxes/e2b/webhook_managed/client.py@@ -0,0 +1,83 @@+# /// script+# requires-python = ">=3.11"+# dependencies = [+# "openai>=3.13.0",+# ]+# ///++"""Use Agents API without importing a sandbox provider SDK."""++from __future__ import annotations++import argparse+import asyncio+import json++from openai import AsyncOpenAI+++async def main() -> None:+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--create-agent", metavar="NAME")+ parser.add_argument("--agent-id")+ parser.add_argument("--session-id")+ parser.add_argument("--delete", action="store_true")+ parser.add_argument("--model", default="gpt-5.6-sol")+ parser.add_argument("--workspace", default="/workspace")+ parser.add_argument(+ "--input", default="Run a shell command to print hello from the sandbox."+ )+ args = parser.parse_args()++ async with AsyncOpenAI(timeout=600) as client:+ if args.create_agent:+ agent = await client.beta.agents.create(+ model=args.model, name=args.create_agent+ )+ print(json.dumps({"agent_id": agent.id}))+ return+ if args.delete:+ if not args.session_id:+ parser.error(+ "--delete requires --session-id; stop provider compute separately"+ )+ await client.beta.agents.sessions.delete(args.session_id)+ print(json.dumps({"deleted": args.session_id}))+ return+ if args.session_id:+ session = await client.beta.agents.sessions.retrieve(args.session_id)+ else:+ if not args.agent_id:+ parser.error(+ "Pass --agent-id from --create-agent, or an existing --session-id"+ )+ session = await client.beta.agents.sessions.create(+ agent_id=args.agent_id,+ environment={+ "type": "self_hosted",+ "workspace_directory": args.workspace,+ },+ )+ print(json.dumps({"session_id": session.id}), flush=True)+ completed = False+ async with client.beta.agents.sessions.stream(+ session.id, input=args.input+ ) as events:+ async for event in events:+ if event.type in {+ "agent.session.turn.failed",+ "agent.session.turn.cancelled",+ "agent.session.failed",+ }:+ raise RuntimeError(f"Agent failed: {event.type}")+ if event.type == "agent.session.turn.output_text.delta":+ print(event.delta, end="", flush=True)+ if event.type == "agent.session.turn.completed":+ completed = True+ if not completed:+ raise RuntimeError("Stream ended without a completed turn")+ print()+++if __name__ == "__main__":+ asyncio.run(main())diff --git a/examples/agents_api/sandboxes/webhook_managed/e2b/deploy.py b/examples/agents_api/sandboxes/e2b/webhook_managed/deploy.pysimilarity index 82%rename from examples/agents_api/sandboxes/webhook_managed/e2b/deploy.pyrename to examples/agents_api/sandboxes/e2b/webhook_managed/deploy.pyindex 1729567f..ec890fa6 100644--- a/examples/agents_api/sandboxes/webhook_managed/e2b/deploy.py+++ b/examples/agents_api/sandboxes/e2b/webhook_managed/deploy.py@@ -44,12 +44,17 @@ async def main() -> None:network={"allow_public_traffic": True},)STATE.write_text(json.dumps({"sandbox_id": sandbox.sandbox_id}) + "\n")- await sandbox.commands.run("mkdir -p /app", user="root")+ await sandbox.commands.run("mkdir -p /app/webhook_managed", user="root")await sandbox.files.write(- "/app/handler.py", ROOT.joinpath("handler.py").read_text(), user="root"+ "/app/webhook_managed/handler.py",+ ROOT.joinpath("handler.py").read_text(),+ user="root",+ )+ await sandbox.files.write(+ "/app/sandbox.py", ROOT.parent.joinpath("sandbox.py").read_text(), user="root")await sandbox.commands.run(- "python -m venv /opt/controller && /opt/controller/bin/pip install uv && /opt/controller/bin/uv pip install --python /opt/controller/bin/python -r /app/handler.py",+ "python -m venv /opt/controller && /opt/controller/bin/pip install uv && /opt/controller/bin/uv pip install --python /opt/controller/bin/python -r /app/webhook_managed/handler.py",user="root",timeout=180,)@@ -59,7 +64,7 @@ async def main() -> None:)await sandbox.commands.run("exec /opt/controller/bin/python -m uvicorn handler:app --host 0.0.0.0 --port 8000 >> /app/controller.log 2>&1",- cwd="/app",+ cwd="/app/webhook_managed",user="root",envs=values,background=True,diff --git a/examples/agents_api/sandboxes/webhook_managed/e2b/handler.py b/examples/agents_api/sandboxes/e2b/webhook_managed/handler.pysimilarity index 89%rename from examples/agents_api/sandboxes/webhook_managed/e2b/handler.pyrename to examples/agents_api/sandboxes/e2b/webhook_managed/handler.pyindex fd404985..1bdda367 100644--- a/examples/agents_api/sandboxes/webhook_managed/e2b/handler.py+++ b/examples/agents_api/sandboxes/e2b/webhook_managed/handler.py@@ -16,18 +16,22 @@ from __future__ import annotationsimport asyncioimport jsonimport os-import shleximport sqlite3+import sysimport timeimport tracebackfrom collections.abc import AsyncIteratorfrom contextlib import asynccontextmanager+from pathlib import Pathfrom e2b import AsyncSandbox, SandboxQuery, SandboxStatefrom fastapi import FastAPI, Requestfrom fastapi.responses import JSONResponsefrom openai import AsyncOpenAI, InvalidWebhookSignatureError, NotFoundError, OpenAI+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))+from sandbox import install_executor, start_executor+DB_PATH = os.environ.get("QUEUE_PATH", "/app/pending.sqlite3")@@ -74,30 +78,12 @@ async def reconcile(session_id: str) -> None:)else:sandbox = await AsyncSandbox.connect(sandbox_id, timeout=1800)- await sandbox.commands.run(- "mkdir -p /workspace && (command -v codex || npm install -g @openai/codex@alpha) && command -v flock",- user="root",- timeout=180,- )- command = shlex.join(- [- "flock",- "-n",- "/tmp/codex-executor.lock",- "codex",- "exec-server",- "--remote",- session.environment.remote_url,- "--environment-id",- session.environment.id,- ]- )- await sandbox.commands.run(- f"{command} >> /tmp/codex-executor.log 2>&1",- user="root",- cwd="/workspace",- background=True,- timeout=0,+ await install_executor(sandbox, reconnect=True)+ await start_executor(+ sandbox,+ session.environment.remote_url,+ session.environment.id,+ reconnect=True,)print(json.dumps(diff --git a/examples/agents_api/sandboxes/modal/README.md b/examples/agents_api/sandboxes/modal/README.mdnew file mode 100644index 00000000..ef7a42ce--- /dev/null+++ b/examples/agents_api/sandboxes/modal/README.md@@ -0,0 +1,13 @@+# Modal sandboxes++Choose who provisions and cleans up the sandbox:++- [Application-managed](application_managed/README.md): run a report task with a+ sample file, then terminate the sandbox and delete the Agents API session.+- [Webhook-managed](webhook_managed/README.md): deploy a signed webhook receiver+ and reconnect sessions through named Modal sandboxes.++Both modes use [modal_executor.py](modal_executor.py) for the base image and+executor command. The application adds its report tools and sample file on top;+the webhook controller packages the shared Python source in its deployment.+Only the restricted executor key reaches the sandbox.diff --git a/examples/agents_api/sandboxes/application_managed/modal/README.md b/examples/agents_api/sandboxes/modal/application_managed/README.mdsimilarity index 85%rename from examples/agents_api/sandboxes/application_managed/modal/README.mdrename to examples/agents_api/sandboxes/modal/application_managed/README.mdindex 85efe75f..0906accc 100644--- a/examples/agents_api/sandboxes/application_managed/modal/README.md+++ b/examples/agents_api/sandboxes/modal/application_managed/README.md@@ -10,7 +10,7 @@ with the same owner, organization, and project. From the Cookbook repository roo```bashuv tool run --from 'modal[api-proxy-support]>=1.3.4,<2' modal setup-uv run examples/agents_api/sandboxes/application_managed/modal/main.py+uv run examples/agents_api/sandboxes/modal/application_managed/main.py```The Modal SDK uses the active profile in `~/.modal.toml`; `MODAL_TOKEN_ID` and@@ -18,4 +18,4 @@ The Modal SDK uses the active profile in `~/.modal.toml`; `MODAL_TOKEN_ID` andlifetime and no inbound port: `codex exec-server` connects outbound to OpenAI.For a Modal-hosted handler that provisions compute from OpenAI webhooks, use the-[webhook-managed Modal example](../../webhook_managed/modal/README.md).+[webhook-managed Modal example](../webhook_managed/README.md).diff --git a/examples/agents_api/sandboxes/application_managed/modal/__init__.py b/examples/agents_api/sandboxes/modal/application_managed/__init__.pysimilarity index 100%rename from examples/agents_api/sandboxes/application_managed/modal/__init__.pyrename to examples/agents_api/sandboxes/modal/application_managed/__init__.pydiff --git a/examples/agents_api/sandboxes/application_managed/modal/main.py b/examples/agents_api/sandboxes/modal/application_managed/main.pysimilarity index 96%rename from examples/agents_api/sandboxes/application_managed/modal/main.pyrename to examples/agents_api/sandboxes/modal/application_managed/main.pyindex ae583862..57848f87 100644--- a/examples/agents_api/sandboxes/application_managed/modal/main.py+++ b/examples/agents_api/sandboxes/modal/application_managed/main.py@@ -6,10 +6,10 @@# ]# ///-from __future__ import annotations-"""Self-hosted Agents API example using a Modal Sandbox."""+from __future__ import annotations+import asyncioimport osimport shlex@@ -22,10 +22,13 @@ from typing import TYPE_CHECKINGfrom openai import AsyncOpenAIfrom openai.types.beta import AgentSession, AgentSessionEvent+# Keep direct `uv run main.py` working from this directory.+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))+from modal_executor import WORKSPACE, exec_server_command, executor_image # noqa: E402+if TYPE_CHECKING:import modal-WORKSPACE = "/workspace"REPORT_PATH = f"{WORKSPACE}/sample_report.txt"DEFAULT_MODAL_APP_NAME = "agents-api-self-hosted-example"MODAL_SANDBOX_TIMEOUT_SECONDS = 15 * 60@@ -192,25 +195,20 @@ async def start_modal_sandbox(except ImportError as exc:raise RuntimeError("The Modal example dependency is not installed. "- "Run: uv run examples/agents_api/sandboxes/application_managed/modal/main.py"+ "Run: uv run examples/agents_api/sandboxes/modal/application_managed/main.py") from excapp = await modal.App.lookup.aio(DEFAULT_MODAL_APP_NAME, create_if_missing=True)image = (- modal.Image.debian_slim(python_version="3.14")+ executor_image(python_version="3.14").apt_install("ca-certificates","curl","file",- "git",- "nodejs",- "npm","poppler-utils",- "ripgrep",).run_commands("mkdir -p /workspace /codex-home",- "npm install --global @openai/codex@alpha",).env({"CODEX_HOME": "/codex-home"}).workdir(WORKSPACE)@@ -236,17 +234,6 @@ async def start_modal_sandbox(return sandbox-def exec_server_command(environment_id: str, remote_url: str) -> list[str]:- return [- "codex",- "exec-server",- "--remote",- remote_url,- "--environment-id",- environment_id,- ]--async def stream_agent_output(client: AsyncOpenAI,session: AgentSession,diff --git a/examples/agents_api/sandboxes/application_managed/modal/sample_report.txt b/examples/agents_api/sandboxes/modal/application_managed/sample_report.txtsimilarity index 100%rename from examples/agents_api/sandboxes/application_managed/modal/sample_report.txtrename to examples/agents_api/sandboxes/modal/application_managed/sample_report.txtdiff --git a/examples/agents_api/sandboxes/modal/modal_executor.py b/examples/agents_api/sandboxes/modal/modal_executor.pynew file mode 100644index 00000000..2fac3bff--- /dev/null+++ b/examples/agents_api/sandboxes/modal/modal_executor.py@@ -0,0 +1,25 @@+"""Base image and executor command shared by the two Modal examples."""++import modal++WORKSPACE = "/workspace"+++def executor_image(python_version: str = "3.12") -> modal.Image:+ return (+ modal.Image.debian_slim(python_version=python_version)+ .apt_install("nodejs", "npm", "git", "ripgrep")+ .run_commands("npm install -g @openai/codex@alpha", f"mkdir -p {WORKSPACE}")+ .workdir(WORKSPACE)+ )+++def exec_server_command(environment_id: str, remote_url: str) -> list[str]:+ return [+ "codex",+ "exec-server",+ "--remote",+ remote_url,+ "--environment-id",+ environment_id,+ ]diff --git a/examples/agents_api/sandboxes/webhook_managed/modal/README.md b/examples/agents_api/sandboxes/modal/webhook_managed/README.mdsimilarity index 72%rename from examples/agents_api/sandboxes/webhook_managed/modal/README.mdrename to examples/agents_api/sandboxes/modal/webhook_managed/README.mdindex 8a7ce67b..6fc0d274 100644--- a/examples/agents_api/sandboxes/webhook_managed/modal/README.md+++ b/examples/agents_api/sandboxes/modal/webhook_managed/README.md@@ -11,7 +11,8 @@ From the Cookbook repository root:uvx modal setup```-Create the agent using the [shared setup](../README.md#set-up-once), then create+Create the agent using the [shared setup](../../webhook_managed.md#set-up-once)+with this provider's `webhook_managed/client.py`, then createthese secrets in Modal's dashboard:| Secret name | Variables |@@ -24,12 +25,20 @@ Use `pending-webhook-registration` for the signing value only while obtaining thendpoint URL. The handler explicitly rejects this placeholder. Never put realcredentials in source files.+Keep [modal_executor.py](../modal_executor.py) beside the mode directories; the+controller image includes this module for remote imports.+```bash-uv run examples/agents_api/sandboxes/webhook_managed/modal/handler.py+uv run examples/agents_api/sandboxes/modal/webhook_managed/handler.py```Register the printed URL with OpenAI, store the generated signing secret, and run-the deployment command again. Then use the [shared client](../README.md#run-and-reconnect).+the deployment command again. Then follow [run and reconnect](../../webhook_managed.md#run-and-reconnect):++```bash+uv run examples/agents_api/sandboxes/modal/webhook_managed/client.py --agent-id "$OPENAI_AGENT_ID"+uv run examples/agents_api/sandboxes/modal/webhook_managed/client.py --session-id "$SESSION_ID" --input "Run another shell command."+```When rotating keys, edit the existing secrets and redeploy. With the CLI, use`uvx modal secret create --force` to replace values; the Python API'sdiff --git a/examples/agents_api/sandboxes/modal/webhook_managed/client.py b/examples/agents_api/sandboxes/modal/webhook_managed/client.pynew file mode 100644index 00000000..fb62b24f--- /dev/null+++ b/examples/agents_api/sandboxes/modal/webhook_managed/client.py@@ -0,0 +1,83 @@+# /// script+# requires-python = ">=3.11"+# dependencies = [+# "openai>=3.13.0",+# ]+# ///++"""Use Agents API without importing a sandbox provider SDK."""++from __future__ import annotations++import argparse+import asyncio+import json++from openai import AsyncOpenAI+++async def main() -> None:+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--create-agent", metavar="NAME")+ parser.add_argument("--agent-id")+ parser.add_argument("--session-id")+ parser.add_argument("--delete", action="store_true")+ parser.add_argument("--model", default="gpt-5.6-sol")+ parser.add_argument("--workspace", default="/workspace")+ parser.add_argument(+ "--input", default="Run a shell command to print hello from the sandbox."+ )+ args = parser.parse_args()++ async with AsyncOpenAI(timeout=600) as client:+ if args.create_agent:+ agent = await client.beta.agents.create(+ model=args.model, name=args.create_agent+ )+ print(json.dumps({"agent_id": agent.id}))+ return+ if args.delete:+ if not args.session_id:+ parser.error(+ "--delete requires --session-id; stop provider compute separately"+ )+ await client.beta.agents.sessions.delete(args.session_id)+ print(json.dumps({"deleted": args.session_id}))+ return+ if args.session_id:+ session = await client.beta.agents.sessions.retrieve(args.session_id)+ else:+ if not args.agent_id:+ parser.error(+ "Pass --agent-id from --create-agent, or an existing --session-id"+ )+ session = await client.beta.agents.sessions.create(+ agent_id=args.agent_id,+ environment={+ "type": "self_hosted",+ "workspace_directory": args.workspace,+ },+ )+ print(json.dumps({"session_id": session.id}), flush=True)+ completed = False+ async with client.beta.agents.sessions.stream(+ session.id, input=args.input+ ) as events:+ async for event in events:+ if event.type in {+ "agent.session.turn.failed",+ "agent.session.turn.cancelled",+ "agent.session.failed",+ }:+ raise RuntimeError(f"Agent failed: {event.type}")+ if event.type == "agent.session.turn.output_text.delta":+ print(event.delta, end="", flush=True)+ if event.type == "agent.session.turn.completed":+ completed = True+ if not completed:+ raise RuntimeError("Stream ended without a completed turn")+ print()+++if __name__ == "__main__":+ asyncio.run(main())diff --git a/examples/agents_api/sandboxes/webhook_managed/modal/handler.py b/examples/agents_api/sandboxes/modal/webhook_managed/handler.pysimilarity index 83%rename from examples/agents_api/sandboxes/webhook_managed/modal/handler.pyrename to examples/agents_api/sandboxes/modal/webhook_managed/handler.pyindex fdbfa88a..0d106720 100644--- a/examples/agents_api/sandboxes/webhook_managed/modal/handler.py+++ b/examples/agents_api/sandboxes/modal/webhook_managed/handler.py@@ -7,28 +7,31 @@# ]# ///-"""Deploy with: uv run examples/agents_api/sandboxes/webhook_managed/modal/handler.py."""+"""Deploy with: uv run examples/agents_api/sandboxes/modal/webhook_managed/handler.py."""from __future__ import annotationsimport jsonimport os+import sys+from pathlib import Pathimport modalfrom fastapi import Requestfrom fastapi.responses import JSONResponsefrom openai import APIStatusError, AsyncOpenAI, InvalidWebhookSignatureError, OpenAI+# The controller image packages this provider-local module for remote imports.+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))+from modal_executor import WORKSPACE, exec_server_command # noqa: E402+from modal_executor import executor_image as base_image # noqa: E402+APP_NAME = "agents-api-webhook-modal"-WORKSPACE = "/workspace"app = modal.App(APP_NAME)-executor_image = (- modal.Image.debian_slim(python_version="3.12")- .apt_install("nodejs", "npm", "git", "ripgrep")- .run_commands("npm install -g @openai/codex@alpha", f"mkdir -p {WORKSPACE}")- .workdir(WORKSPACE)-)-controller_image = executor_image.pip_install("fastapi[standard]", "openai>=3.13.0")+executor_image = base_image()+controller_image = executor_image.pip_install(+ "fastapi[standard]", "openai>=3.13.0"+).add_local_python_source("modal_executor")@app.function(@@ -69,12 +72,7 @@ async def reconcile(session_id: str) -> None:if sandbox is not None:return # Already starting or connected; never create a duplicate.sandbox = await modal.Sandbox.create.aio(- "codex",- "exec-server",- "--remote",- environment.remote_url,- "--environment-id",- environment.id,+ *exec_server_command(environment.id, environment.remote_url),app=app,name=session_id,image=executor_image,diff --git a/examples/agents_api/sandboxes/oci/README.md b/examples/agents_api/sandboxes/oci/README.mdnew file mode 100644index 00000000..ef80e5ea--- /dev/null+++ b/examples/agents_api/sandboxes/oci/README.md@@ -0,0 +1,6 @@+# OCI sandbox++[Run the application-managed example](application_managed/README.md) with an+OCI GenAI Sandbox project and Oracle's beta Python SDK.++This example does not include a webhook controller.diff --git a/examples/agents_api/sandboxes/application_managed/oci/README.md b/examples/agents_api/sandboxes/oci/application_managed/README.mdsimilarity index 98%rename from examples/agents_api/sandboxes/application_managed/oci/README.mdrename to examples/agents_api/sandboxes/oci/application_managed/README.mdindex ea6f3641..348d7e22 100644--- a/examples/agents_api/sandboxes/application_managed/oci/README.md+++ b/examples/agents_api/sandboxes/oci/application_managed/README.md@@ -63,7 +63,7 @@ instructions. The runtime must include npm or support installing it.From the Cookbook repository root, run with [uv](https://docs.astral.sh/uv/):```bash-uv run --with "$OCI_SANDBOX_SDK_WHEEL" examples/agents_api/sandboxes/application_managed/oci/main.py+uv run --with "$OCI_SANDBOX_SDK_WHEEL" examples/agents_api/sandboxes/oci/application_managed/main.py```The script declares the Agents API dependency inline and loads Oracle's beta SDKdiff --git a/examples/agents_api/sandboxes/application_managed/oci/__init__.py b/examples/agents_api/sandboxes/oci/application_managed/__init__.pysimilarity index 100%rename from examples/agents_api/sandboxes/application_managed/oci/__init__.pyrename to examples/agents_api/sandboxes/oci/application_managed/__init__.pydiff --git a/examples/agents_api/sandboxes/application_managed/oci/main.py b/examples/agents_api/sandboxes/oci/application_managed/main.pysimilarity index 100%rename from examples/agents_api/sandboxes/application_managed/oci/main.pyrename to examples/agents_api/sandboxes/oci/application_managed/main.pydiff --git a/examples/agents_api/sandboxes/runloop/README.md b/examples/agents_api/sandboxes/runloop/README.mdnew file mode 100644index 00000000..29325eb0--- /dev/null+++ b/examples/agents_api/sandboxes/runloop/README.md@@ -0,0 +1,14 @@+# Runloop sandboxes++Run Agents API tasks in Runloop devboxes with either provisioning model:++- [Application-managed](application_managed/README.md): the application creates+ a devbox, runs a task, and cleans up the devbox and API session.+- [Webhook-managed](webhook_managed/README.md): a signed webhook controller+ creates or resumes a worker devbox for each session.++Both modes use [sandbox.py](sandbox.py) to install and launch `codex exec-server`.+Application-managed tasks use `/home/user/workspace` and pass the restricted+executor key as an environment variable. Webhook-managed workers use `/workspace`+and a Runloop secret reference; the controller's main API key stays behind a+Runloop gateway.diff --git a/examples/agents_api/sandboxes/application_managed/runloop/README.md b/examples/agents_api/sandboxes/runloop/application_managed/README.mdsimilarity index 95%rename from examples/agents_api/sandboxes/application_managed/runloop/README.mdrename to examples/agents_api/sandboxes/runloop/application_managed/README.mdindex ba106b33..338dec24 100644--- a/examples/agents_api/sandboxes/application_managed/runloop/README.md+++ b/examples/agents_api/sandboxes/runloop/application_managed/README.md@@ -14,7 +14,7 @@ organization, and project. Only the executor key enters the devbox. SeeFrom the Cookbook repository root, run with [uv](https://docs.astral.sh/uv/):```bash-uv run examples/agents_api/sandboxes/application_managed/runloop/main.py+uv run examples/agents_api/sandboxes/runloop/application_managed/main.py```The script declares its dependencies inline, including the Agents API SDK.diff --git a/examples/agents_api/sandboxes/application_managed/runloop/main.py b/examples/agents_api/sandboxes/runloop/application_managed/main.pysimilarity index 76%rename from examples/agents_api/sandboxes/application_managed/runloop/main.pyrename to examples/agents_api/sandboxes/runloop/application_managed/main.pyindex 2fe542f5..11e21b66 100644--- a/examples/agents_api/sandboxes/application_managed/runloop/main.py+++ b/examples/agents_api/sandboxes/runloop/application_managed/main.py@@ -10,13 +10,16 @@import asyncioimport os-import shlex+import sys+from pathlib import Pathfrom openai import AsyncOpenAIfrom runloop_api_client import AsyncRunloopSDK+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))+from sandbox import install_executor, start_executor+WORKSPACE = "/home/user/workspace"-CODEX = "/home/user/.codex-runtime/node_modules/.bin/codex"async def main() -> None:@@ -37,30 +40,19 @@ async def main() -> None:launch_parameters={"keep_alive_time_seconds": 600},)print(f"Devbox: {devbox.id}", flush=True)- setup = await devbox.cmd.exec(- f"mkdir -p {WORKSPACE} && "- "npm install --prefix /home/user/.codex-runtime @openai/codex@alpha"- )+ setup = await devbox.cmd.exec(f"mkdir -p {WORKSPACE}")if setup.exit_code != 0:- raise RuntimeError(- f"Executor installation failed: {await setup.stderr()}"- )+ raise RuntimeError("Workspace setup failed")+ await install_executor(devbox)await devbox.file.write(file_path=f"{WORKSPACE}/brief.txt",contents="Migrate a synchronous Python service to async without changing its API.\n",)- await devbox.cmd.exec_async(- f"cd {WORKSPACE} && exec "- + shlex.join(- [- CODEX,- "exec-server",- "--remote",- session.environment.remote_url,- "--environment-id",- session.environment.id,- ]- )+ await start_executor(+ devbox,+ workspace=WORKSPACE,+ remote_url=session.environment.remote_url,+ environment_id=session.environment.id,)async with client.beta.agents.sessions.stream(diff --git a/examples/agents_api/sandboxes/runloop/sandbox.py b/examples/agents_api/sandboxes/runloop/sandbox.pynew file mode 100644index 00000000..b1a81d06--- /dev/null+++ b/examples/agents_api/sandboxes/runloop/sandbox.py@@ -0,0 +1,49 @@+"""Executor installation and launch shared by the Runloop examples."""++import shlex++from runloop_api_client.lib.polling import PollingConfig+from runloop_api_client.sdk.async_devbox import AsyncDevbox+from runloop_api_client.sdk.async_execution import AsyncExecution++CODEX = "/home/user/.codex-runtime/node_modules/.bin/codex"+LOCK_BUSY_EXIT_CODE = 75+++async def install_executor(devbox: AsyncDevbox) -> None:+ setup = await devbox.cmd.exec(+ "mkdir -p /home/user/.codex-runtime && "+ f"(test -x {CODEX} || "+ "npm install --prefix /home/user/.codex-runtime @openai/codex@alpha)",+ polling_config=PollingConfig(timeout_seconds=180),+ )+ if setup.exit_code != 0:+ raise RuntimeError("Executor installation failed")+++async def start_executor(+ devbox: AsyncDevbox,+ *,+ workspace: str,+ remote_url: str,+ environment_id: str,+ locked: bool = False,+) -> AsyncExecution:+ command = shlex.join(+ [+ CODEX,+ "exec-server",+ "--remote",+ remote_url,+ "--environment-id",+ environment_id,+ ]+ )+ if locked:+ command = (+ f"flock -n -E {LOCK_BUSY_EXIT_CODE} /tmp/codex-executor.lock {command} "+ ">> /tmp/codex-executor.log 2>&1"+ )+ else:+ command = f"exec {command}"+ return await devbox.cmd.exec_async(f"cd {shlex.quote(workspace)} && {command}")diff --git a/examples/agents_api/sandboxes/webhook_managed/runloop/README.md b/examples/agents_api/sandboxes/runloop/webhook_managed/README.mdsimilarity index 81%rename from examples/agents_api/sandboxes/webhook_managed/runloop/README.mdrename to examples/agents_api/sandboxes/runloop/webhook_managed/README.mdindex 647911f8..318b7a46 100644--- a/examples/agents_api/sandboxes/webhook_managed/runloop/README.md+++ b/examples/agents_api/sandboxes/runloop/webhook_managed/README.md@@ -6,7 +6,8 @@ API session. Agent commands run only in the worker.## Deploy-Create an agent using the [shared setup](../README.md#set-up-once). Set+Create an agent using the [shared setup](../../webhook_managed.md#set-up-once)+and this folder's `client.py`. Set`OPENAI_AGENT_ID`, `OPENAI_API_KEY`, `OPENAI_EXECUTOR_API_KEY`, and `RUNLOOP_API_KEY`locally. Use an[environment key](https://developers.openai.com/api/docs/guides/agents-api/environments/self-hosted#authentication)@@ -15,23 +16,30 @@ for `OPENAI_EXECUTOR_API_KEY`.Run from the Cookbook repository root:```bash-uv run examples/agents_api/sandboxes/webhook_managed/runloop/deploy.py+uv run examples/agents_api/sandboxes/runloop/webhook_managed/deploy.py```Register the printed URL in **OpenAI project settings → Webhooks**, subscribing to`agent.session.action_required` and `agent.session.failed`. Set the generated`OPENAI_WEBHOOK_SECRET` locally and deploy again. **Update the webhook URL to thenewly printed address**, keeping its signing secret. Then use the-[shared client](../README.md#run-and-reconnect).+[run-and-reconnect steps](../../webhook_managed.md#run-and-reconnect) with the+provider-local client:++```bash+uv run examples/agents_api/sandboxes/runloop/webhook_managed/client.py \+ --agent-id "$OPENAI_AGENT_ID"+```Deployment stores credentials in Runloop secrets with the `agents_api_webhook_`prefix. The controller accesses OpenAI through a Runloop gateway; workers receiveonly the environment key as `CODEX_API_KEY` and connect directly to OpenAI.The endpoint rejects deliveries until configured and verifies every signature.-The controller ID is saved in `.controller.json`. Changing the handler, agent ID,-Runloop key, or signing secret replaces the controller and changes its URL.-Otherwise deployment reuses it.+The controller ID is saved in `.controller.json`. Changing the handler, shared+`sandbox.py`, agent ID, Runloop key, or signing secret replaces the controller+and changes its URL. Otherwise deployment reuses it. The deploy script uploads+both Python files, preserving their layout.## Lifecyclediff --git a/examples/agents_api/sandboxes/runloop/webhook_managed/client.py b/examples/agents_api/sandboxes/runloop/webhook_managed/client.pynew file mode 100644index 00000000..fb62b24f--- /dev/null+++ b/examples/agents_api/sandboxes/runloop/webhook_managed/client.py@@ -0,0 +1,83 @@+# /// script+# requires-python = ">=3.11"+# dependencies = [+# "openai>=3.13.0",+# ]+# ///++"""Use Agents API without importing a sandbox provider SDK."""++from __future__ import annotations++import argparse+import asyncio+import json++from openai import AsyncOpenAI+++async def main() -> None:+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--create-agent", metavar="NAME")+ parser.add_argument("--agent-id")+ parser.add_argument("--session-id")+ parser.add_argument("--delete", action="store_true")+ parser.add_argument("--model", default="gpt-5.6-sol")+ parser.add_argument("--workspace", default="/workspace")+ parser.add_argument(+ "--input", default="Run a shell command to print hello from the sandbox."+ )+ args = parser.parse_args()++ async with AsyncOpenAI(timeout=600) as client:+ if args.create_agent:+ agent = await client.beta.agents.create(+ model=args.model, name=args.create_agent+ )+ print(json.dumps({"agent_id": agent.id}))+ return+ if args.delete:+ if not args.session_id:+ parser.error(+ "--delete requires --session-id; stop provider compute separately"+ )+ await client.beta.agents.sessions.delete(args.session_id)+ print(json.dumps({"deleted": args.session_id}))+ return+ if args.session_id:+ session = await client.beta.agents.sessions.retrieve(args.session_id)+ else:+ if not args.agent_id:+ parser.error(+ "Pass --agent-id from --create-agent, or an existing --session-id"+ )+ session = await client.beta.agents.sessions.create(+ agent_id=args.agent_id,+ environment={+ "type": "self_hosted",+ "workspace_directory": args.workspace,+ },+ )+ print(json.dumps({"session_id": session.id}), flush=True)+ completed = False+ async with client.beta.agents.sessions.stream(+ session.id, input=args.input+ ) as events:+ async for event in events:+ if event.type in {+ "agent.session.turn.failed",+ "agent.session.turn.cancelled",+ "agent.session.failed",+ }:+ raise RuntimeError(f"Agent failed: {event.type}")+ if event.type == "agent.session.turn.output_text.delta":+ print(event.delta, end="", flush=True)+ if event.type == "agent.session.turn.completed":+ completed = True+ if not completed:+ raise RuntimeError("Stream ended without a completed turn")+ print()+++if __name__ == "__main__":+ asyncio.run(main())diff --git a/examples/agents_api/sandboxes/webhook_managed/runloop/deploy.py b/examples/agents_api/sandboxes/runloop/webhook_managed/deploy.pysimilarity index 93%rename from examples/agents_api/sandboxes/webhook_managed/runloop/deploy.pyrename to examples/agents_api/sandboxes/runloop/webhook_managed/deploy.pyindex 190eda63..b0d0cbc3 100644--- a/examples/agents_api/sandboxes/webhook_managed/runloop/deploy.py+++ b/examples/agents_api/sandboxes/runloop/webhook_managed/deploy.py@@ -88,6 +88,7 @@ async def reuse_saved_controller(async def main() -> None:handler = ROOT.joinpath("handler.py").read_text()+ sandbox = ROOT.parent.joinpath("sandbox.py").read_text()agent_id = os.environ["OPENAI_AGENT_ID"]values = {OPENAI_SECRET_NAME: os.environ["OPENAI_API_KEY"],@@ -112,6 +113,7 @@ async def main() -> None:values[WEBHOOK_SECRET_NAME],agent_id,handler,+ sandbox,gateway_id,]).encode()@@ -132,8 +134,13 @@ async def main() -> None:"secret": OPENAI_SECRET_NAME,}},- file_mounts={"/home/user/controller/handler.py": handler},- entrypoint="cd /home/user/controller && exec uv run handler.py",+ file_mounts={+ "/home/user/controller/webhook_managed/handler.py": handler,+ "/home/user/controller/sandbox.py": sandbox,+ },+ entrypoint=(+ "cd /home/user/controller/webhook_managed && exec uv run handler.py"+ ),tunnel={"auth_mode": "open"},launch_parameters={"launch_commands": [diff --git a/examples/agents_api/sandboxes/webhook_managed/runloop/handler.py b/examples/agents_api/sandboxes/runloop/webhook_managed/handler.pysimilarity index 88%rename from examples/agents_api/sandboxes/webhook_managed/runloop/handler.pyrename to examples/agents_api/sandboxes/runloop/webhook_managed/handler.pyindex 9fcd9306..24c66678 100644--- a/examples/agents_api/sandboxes/webhook_managed/runloop/handler.py+++ b/examples/agents_api/sandboxes/runloop/webhook_managed/handler.py@@ -15,26 +15,27 @@ from __future__ import annotationsimport asyncioimport jsonimport os-import shleximport sqlite3+import sysimport timeimport tracebackfrom collections.abc import AsyncIteratorfrom contextlib import asynccontextmanager+from pathlib import Pathfrom fastapi import FastAPI, Requestfrom fastapi.responses import JSONResponsefrom openai import AsyncOpenAI, InvalidWebhookSignatureError, NotFoundError, OpenAIfrom runloop_api_client import AsyncRunloopSDK-from runloop_api_client.lib.polling import PollingConfigfrom runloop_api_client.sdk.async_devbox import AsyncDevboxfrom runloop_api_client.sdk.async_execution import AsyncExecution+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))+from sandbox import LOCK_BUSY_EXIT_CODE, install_executor, start_executor+DB_PATH = os.environ.get("QUEUE_PATH", "/home/user/pending.sqlite3")OPENAI_EXECUTOR_SECRET_NAME = "agents_api_webhook_openai_executor_api_key"-CODEX = "/home/user/.codex-runtime/node_modules/.bin/codex"EXECUTOR_CONNECT_TIMEOUT = 60-LOCK_BUSY_EXIT_CODE = 75def log(**fields: object) -> None:@@ -115,23 +116,17 @@ async def reconcile(session_id: str) -> None:elif status != "running":await devbox.await_running()setup = await devbox.cmd.exec(- "sudo install -d -o user -g user /workspace && "- "mkdir -p /home/user/.codex-runtime && "- f"(test -x {CODEX} || "- "npm install --prefix /home/user/.codex-runtime @openai/codex@alpha) && "- "command -v flock",- polling_config=PollingConfig(timeout_seconds=180),+ "sudo install -d -o user -g user /workspace && command -v flock")if setup.exit_code != 0:- raise RuntimeError("Executor installation failed")- environment_id = shlex.quote(session.environment.id)- remote_url = shlex.quote(session.environment.remote_url)- execution = await devbox.cmd.exec_async(- f"cd /workspace && flock -n -E {LOCK_BUSY_EXIT_CODE} /tmp/codex-executor.lock "- f"{CODEX} exec-server "- f"--remote {remote_url} "- f"--environment-id {environment_id} "- ">> /tmp/codex-executor.log 2>&1"+ raise RuntimeError("Workspace setup failed")+ await install_executor(devbox)+ execution = await start_executor(+ devbox,+ workspace="/workspace",+ remote_url=session.environment.remote_url,+ environment_id=session.environment.id,+ locked=True,)await wait_for_executor(client, session_id, execution)log(session_id=session_id, devbox_id=devbox.id, action="connected")diff --git a/examples/agents_api/sandboxes/vercel/README.md b/examples/agents_api/sandboxes/vercel/README.mdnew file mode 100644index 00000000..65fe28d4--- /dev/null+++ b/examples/agents_api/sandboxes/vercel/README.md@@ -0,0 +1,18 @@+# Vercel sandboxes++Choose who starts and reconnects the executor:++- [Application-managed](application_managed/README.md): a Python application+ creates a non-persistent sandbox, reads the output, and cleans up both resources.+- [Webhook-managed](webhook_managed/README.md): TypeScript functions verify+ webhooks and use Vercel Queues to provision named sandboxes.++The modes use different provider SDKs and keep their implementations separate.+Both run `codex exec-server` with a restricted `OPENAI_EXECUTOR_API_KEY`; the+application/session-read key stays outside the sandbox. The two OpenAI keys must+have the same owner, organization, and project.++Use a dedicated Vercel project with Sandbox access. The webhook mode also needs+Queues access. Test deployments should use a separate project, not overwrite an+existing application. Each mode's README covers credentials, execution limits,+and cleanup.diff --git a/examples/agents_api/sandboxes/application_managed/vercel/README.md b/examples/agents_api/sandboxes/vercel/application_managed/README.mdsimilarity index 81%rename from examples/agents_api/sandboxes/application_managed/vercel/README.mdrename to examples/agents_api/sandboxes/vercel/application_managed/README.mdindex 7effb7c8..b63d078f 100644--- a/examples/agents_api/sandboxes/application_managed/vercel/README.md+++ b/examples/agents_api/sandboxes/vercel/application_managed/README.md@@ -6,6 +6,7 @@ It prints the plan, destroys the sandbox, and deletes the session.## Run+Use the [provider prerequisites](../README.md) and a dedicated Vercel project.Set `VERCEL_TOKEN`, `VERCEL_TEAM_ID`, `VERCEL_PROJECT_ID`, `OPENAI_API_KEY`, anda separate restricted `OPENAI_EXECUTOR_API_KEY`. The OpenAI keys must have thesame owner, organization, and project. Only the executor key enters the sandbox.@@ -13,7 +14,7 @@ same owner, organization, and project. Only the executor key enters the sandbox.From the Cookbook repository root:```bash-uv run examples/agents_api/sandboxes/application_managed/vercel/main.py+uv run examples/agents_api/sandboxes/vercel/application_managed/main.py```Dependencies are declared inline. The script allows six minutes for setup and@@ -29,4 +30,5 @@ Do not attach a provisioning webhook handler to these sessions.- [Vercel Sandbox documentation](https://vercel.com/docs/sandbox)- [Vercel Sandbox SDK reference](https://vercel.com/docs/sandbox/sdk-reference)-- [Webhook-managed example](../../webhook_managed/vercel/README.md)+- [Webhook-managed example](../webhook_managed/README.md)+- [Webhook setup and lifecycle](../../webhook_managed.md#set-up-once)diff --git a/examples/agents_api/sandboxes/application_managed/vercel/main.py b/examples/agents_api/sandboxes/vercel/application_managed/main.pysimilarity index 100%rename from examples/agents_api/sandboxes/application_managed/vercel/main.pyrename to examples/agents_api/sandboxes/vercel/application_managed/main.pydiff --git a/examples/agents_api/sandboxes/webhook_managed/vercel/README.md b/examples/agents_api/sandboxes/vercel/webhook_managed/README.mdsimilarity index 77%rename from examples/agents_api/sandboxes/webhook_managed/vercel/README.mdrename to examples/agents_api/sandboxes/vercel/webhook_managed/README.mdindex 9d656537..630706e9 100644--- a/examples/agents_api/sandboxes/webhook_managed/vercel/README.md+++ b/examples/agents_api/sandboxes/vercel/webhook_managed/README.md@@ -7,12 +7,14 @@ prevent concurrent jobs from installing twice or starting duplicate executors.## DeployUse Node.js 24+ and a dedicated Vercel project with Sandbox and Queues access.-Create the agent using the [shared setup](../README.md#set-up-once), then run from+See the [provider overview](../README.md). Create the agent using the+[shared setup](../../webhook_managed.md#set-up-once), then run fromthis directory:```bashnpm cinpx vercel link+uv run client.py --create-agent vercel-webhook-example```In the project's production environment variables, configure:@@ -35,7 +37,13 @@ configure deployment protection so OpenAI can reach the receiver. The webhooksignature authenticates requests, and Vercel's queue trigger invokes the consumer.Register the webhook, replace the signing value with the real secret, and redeploy.-Then use the [shared client](../README.md#run-and-reconnect).+Then use the [client and reconnect flow](../../webhook_managed.md#run-and-reconnect)+with this directory's client:++```bash+uv run client.py --agent-id "$OPENAI_AGENT_ID"+uv run client.py --session-id "$SESSION_ID" --input "Run another shell command."+```Environment-variable changes require a new deployment.@@ -50,3 +58,5 @@ Named sandboxes preserve files between runs; processes must be restarted.The executor is installed on first use. For regular use, bake it into a sandboxsnapshot to reduce connection latency. Remove the OpenAI webhook before deleting theexample project.++See the [application-managed mode](../application_managed/README.md) for direct provisioning.diff --git a/examples/agents_api/sandboxes/webhook_managed/vercel/api/provision.ts b/examples/agents_api/sandboxes/vercel/webhook_managed/api/provision.tssimilarity index 100%rename from examples/agents_api/sandboxes/webhook_managed/vercel/api/provision.tsrename to examples/agents_api/sandboxes/vercel/webhook_managed/api/provision.tsdiff --git a/examples/agents_api/sandboxes/webhook_managed/vercel/api/webhook.ts b/examples/agents_api/sandboxes/vercel/webhook_managed/api/webhook.tssimilarity index 100%rename from examples/agents_api/sandboxes/webhook_managed/vercel/api/webhook.tsrename to examples/agents_api/sandboxes/vercel/webhook_managed/api/webhook.tsdiff --git a/examples/agents_api/sandboxes/vercel/webhook_managed/client.py b/examples/agents_api/sandboxes/vercel/webhook_managed/client.pynew file mode 100644index 00000000..fb62b24f--- /dev/null+++ b/examples/agents_api/sandboxes/vercel/webhook_managed/client.py@@ -0,0 +1,83 @@+# /// script+# requires-python = ">=3.11"+# dependencies = [+# "openai>=3.13.0",+# ]+# ///++"""Use Agents API without importing a sandbox provider SDK."""++from __future__ import annotations++import argparse+import asyncio+import json++from openai import AsyncOpenAI+++async def main() -> None:+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--create-agent", metavar="NAME")+ parser.add_argument("--agent-id")+ parser.add_argument("--session-id")+ parser.add_argument("--delete", action="store_true")+ parser.add_argument("--model", default="gpt-5.6-sol")+ parser.add_argument("--workspace", default="/workspace")+ parser.add_argument(+ "--input", default="Run a shell command to print hello from the sandbox."+ )+ args = parser.parse_args()++ async with AsyncOpenAI(timeout=600) as client:+ if args.create_agent:+ agent = await client.beta.agents.create(+ model=args.model, name=args.create_agent+ )+ print(json.dumps({"agent_id": agent.id}))+ return+ if args.delete:+ if not args.session_id:+ parser.error(+ "--delete requires --session-id; stop provider compute separately"+ )+ await client.beta.agents.sessions.delete(args.session_id)+ print(json.dumps({"deleted": args.session_id}))+ return+ if args.session_id:+ session = await client.beta.agents.sessions.retrieve(args.session_id)+ else:+ if not args.agent_id:+ parser.error(+ "Pass --agent-id from --create-agent, or an existing --session-id"+ )+ session = await client.beta.agents.sessions.create(+ agent_id=args.agent_id,+ environment={+ "type": "self_hosted",+ "workspace_directory": args.workspace,+ },+ )+ print(json.dumps({"session_id": session.id}), flush=True)+ completed = False+ async with client.beta.agents.sessions.stream(+ session.id, input=args.input+ ) as events:+ async for event in events:+ if event.type in {+ "agent.session.turn.failed",+ "agent.session.turn.cancelled",+ "agent.session.failed",+ }:+ raise RuntimeError(f"Agent failed: {event.type}")+ if event.type == "agent.session.turn.output_text.delta":+ print(event.delta, end="", flush=True)+ if event.type == "agent.session.turn.completed":+ completed = True+ if not completed:+ raise RuntimeError("Stream ended without a completed turn")+ print()+++if __name__ == "__main__":+ asyncio.run(main())diff --git a/examples/agents_api/sandboxes/webhook_managed/vercel/package-lock.json b/examples/agents_api/sandboxes/vercel/webhook_managed/package-lock.jsonsimilarity index 100%rename from examples/agents_api/sandboxes/webhook_managed/vercel/package-lock.jsonrename to examples/agents_api/sandboxes/vercel/webhook_managed/package-lock.jsondiff --git a/examples/agents_api/sandboxes/webhook_managed/vercel/package.json b/examples/agents_api/sandboxes/vercel/webhook_managed/package.jsonsimilarity index 100%rename from examples/agents_api/sandboxes/webhook_managed/vercel/package.jsonrename to examples/agents_api/sandboxes/vercel/webhook_managed/package.jsondiff --git a/examples/agents_api/sandboxes/webhook_managed/vercel/tsconfig.json b/examples/agents_api/sandboxes/vercel/webhook_managed/tsconfig.jsonsimilarity index 100%rename from examples/agents_api/sandboxes/webhook_managed/vercel/tsconfig.jsonrename to examples/agents_api/sandboxes/vercel/webhook_managed/tsconfig.jsondiff --git a/examples/agents_api/sandboxes/webhook_managed/vercel/vercel.json b/examples/agents_api/sandboxes/vercel/webhook_managed/vercel.jsonsimilarity index 100%rename from examples/agents_api/sandboxes/webhook_managed/vercel/vercel.jsonrename to examples/agents_api/sandboxes/vercel/webhook_managed/vercel.jsondiff --git a/examples/agents_api/sandboxes/webhook_managed/README.md b/examples/agents_api/sandboxes/webhook_managed.mdsimilarity index 75%rename from examples/agents_api/sandboxes/webhook_managed/README.mdrename to examples/agents_api/sandboxes/webhook_managed.mdindex 13a6c52d..632a2aa3 100644--- a/examples/agents_api/sandboxes/webhook_managed/README.md+++ b/examples/agents_api/sandboxes/webhook_managed.md@@ -5,8 +5,8 @@ provider account start and reconnect its sandbox.## How it works-- **Application:** [client.py](client.py) creates sessions, sends input, and streams- results. The same client works with every provider below; it imports no provider SDK.+- **Application:** each provider's `webhook_managed/client.py` creates sessions,+ sends input, and streams results. It imports no provider SDK.- **Provider handler:** deployed once, it receives OpenAI webhooks and starts orreconnects the sandbox executor when an environment connection is required.@@ -14,28 +14,34 @@ provider account start and reconnect its sandbox.| Provider | Handler code | Setup || --- | --- | --- |-| Modal | [handler.py](modal/handler.py) | [Deploy](modal/README.md) |-| Vercel | [api/webhook.ts](vercel/api/webhook.ts) and [api/provision.ts](vercel/api/provision.ts) | [Deploy](vercel/README.md) |-| Cloudflare | [src/index.ts](cloudflare/src/index.ts) | [Deploy](cloudflare/README.md) |-| Blaxel | [handler.py](blaxel/handler.py) | [Deploy](blaxel/README.md) |-| Daytona | [handler.py](daytona/handler.py) | [Deploy](daytona/README.md) |-| E2B | [handler.py](e2b/handler.py) | [Deploy](e2b/README.md) |-| Runloop | [handler.py](runloop/handler.py) | [Deploy](runloop/README.md) |-| DigitalOcean | [handler.py](digitalocean/handler.py) | [Deploy](digitalocean/README.md) |--Complete the setup below, deploy one provider's handler, then run the shared+| Modal | [handler.py](modal/webhook_managed/handler.py) | [Deploy](modal/webhook_managed/README.md) |+| Vercel | [api/webhook.ts](vercel/webhook_managed/api/webhook.ts) and [api/provision.ts](vercel/webhook_managed/api/provision.ts) | [Deploy](vercel/webhook_managed/README.md) |+| Cloudflare | [src/index.ts](cloudflare/webhook_managed/src/index.ts) | [Deploy](cloudflare/webhook_managed/README.md) |+| Blaxel | [handler.py](blaxel/webhook_managed/handler.py) | [Deploy](blaxel/webhook_managed/README.md) |+| Daytona | [handler.py](daytona/webhook_managed/handler.py) | [Deploy](daytona/webhook_managed/README.md) |+| E2B | [handler.py](e2b/webhook_managed/handler.py) | [Deploy](e2b/webhook_managed/README.md) |+| Runloop | [handler.py](runloop/webhook_managed/handler.py) | [Deploy](runloop/webhook_managed/README.md) |+| DigitalOcean | [handler.py](digitalocean/webhook_managed/handler.py) | [Deploy](digitalocean/webhook_managed/README.md) |++Complete the setup below, deploy one provider's handler, then run itsclient. For direct provisioning from your application, use-[application-managed sandboxes](../application_managed/README.md).+[application-managed sandboxes](README.md).## Set up once-1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/) and run the- commands below from the Cookbook repository root. Each Python script declares its- dependencies inline; `uv run` installs them automatically.+1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/) and choose+ your provider folder. For example, from the Cookbook repository root:++ ```bash+ cd examples/agents_api/sandboxes/modal/webhook_managed+ ```++ Run the client commands below from that folder. Each Python script declares+ its dependencies inline; `uv run` installs them automatically.2. Set your application's `OPENAI_API_KEY`, then create an agent:```bash- uv run examples/agents_api/sandboxes/webhook_managed/client.py --create-agent sandbox-demo+ uv run client.py --create-agent sandbox-demo```Example output:@@ -79,7 +85,7 @@ but a different user or service account cannot register the session's executor.## Run and reconnect```bash-uv run examples/agents_api/sandboxes/webhook_managed/client.py \+uv run client.py \--agent-id "$OPENAI_AGENT_ID" \--input "Use the shell to write hello to /workspace/hello.txt, then read it."```@@ -88,7 +94,7 @@ The client prints the session ID; save it as `SESSION_ID` for follow-up input.To reconnect after stopping or pausing the sandbox, keep the API session and run:```bash-uv run examples/agents_api/sandboxes/webhook_managed/client.py \+uv run client.py \--session-id "$SESSION_ID" \--input "Run a shell command to print hello again."```@@ -125,7 +131,7 @@ jobs that exhaust their retries.When finished, stop/delete provider compute **and** delete the API session:```bash-uv run examples/agents_api/sandboxes/webhook_managed/client.py --session-id "$SESSION_ID" --delete+uv run client.py --session-id "$SESSION_ID" --delete```Stop new input before cleanup. There is no session-deletion webhook, so removingdiff --git a/examples/agents_api/sandboxes/webhook_managed/cloudflare/Dockerfile b/examples/agents_api/sandboxes/webhook_managed/cloudflare/Dockerfiledeleted file mode 100644index 26fb19a0..00000000--- a/examples/agents_api/sandboxes/webhook_managed/cloudflare/Dockerfile+++ /dev/null@@ -1,4 +0,0 @@-FROM docker.io/cloudflare/sandbox:0.12.8-RUN apt-get update && apt-get install -y --no-install-recommends ripgrep util-linux \- && npm install -g @openai/codex@alpha \- && rm -rf /var/lib/apt/lists/*diff --git a/examples/agents_api/sandboxes/webhook_managed/cloudflare/README.md b/examples/agents_api/sandboxes/webhook_managed/cloudflare/README.mddeleted file mode 100644index a39ba5e1..00000000--- a/examples/agents_api/sandboxes/webhook_managed/cloudflare/README.md+++ /dev/null@@ -1,57 +0,0 @@-# Cloudflare webhook-managed sandbox--The Worker verifies the signature and persists a wakeup in a per-session Durable-Object. Its alarm starts the Sandbox executor. Durable storage handles retries;-the session ID identifies the sandbox, and an OS lock prevents duplicate executors.--## Deploy--Use a Cloudflare account with Workers and Containers access, Node.js, and Docker.-Create the agent using the [shared setup](../README.md#set-up-once). In this directory:--```bash-npm ci-npx wrangler login-```--Set `OPENAI_AGENT_ID` in `wrangler.jsonc` to the agent ID from the shared setup.-Add secrets using the CLI's prompts:--```bash-npx wrangler secret put OPENAI_API_KEY-npx wrangler secret put OPENAI_EXECUTOR_API_KEY-npx wrangler secret put OPENAI_WEBHOOK_SECRET-npx wrangler secret put SANDBOX_CONTROL_TOKEN-npm run deploy-```--Use a separate random control token for the cleanup endpoint. For the first-deployment only, the signing value may be `pending-webhook-registration`; the-receiver rejects it. The SDK and Dockerfile use matching Sandbox versions.--Register `https://YOUR_WORKER.workers.dev/webhook` with OpenAI. Set the real signing-secret using `wrangler secret put OPENAI_WEBHOOK_SECRET`, then deploy again.-Run the [shared client](../README.md#run-and-reconnect).--Keep `OPENAI_AGENT_ID` set when redeploying; sessions for other agents are ignored.--## Stop or clean up--Call the authenticated cleanup endpoint after a turn finishes:--```python-import os-import httpx--response = httpx.delete(- f"{os.environ['WORKER_URL']}/sandboxes/{os.environ['SESSION_ID']}",- headers={"Authorization": f"Bearer {os.environ['SANDBOX_CONTROL_TOKEN']}"},- timeout=60,-)-response.raise_for_status()-```--A following input triggers a new connection. Final cleanup also requires deleting-the API session. The controller schedules a maximum-lifetime cleanup alarm because-the executor keeps the container alive. Replacement containers have a fresh filesystem.-Remove the OpenAI webhook before deleting the Worker and its containers.diff --git a/examples/agents_api/sandboxes/webhook_managed/cloudflare/package-lock.json b/examples/agents_api/sandboxes/webhook_managed/cloudflare/package-lock.jsondeleted file mode 100644index 94c28d52..00000000--- a/examples/agents_api/sandboxes/webhook_managed/cloudflare/package-lock.json+++ /dev/null@@ -1,1568 +0,0 @@-{- "name": "agents-api-webhook-cloudflare",- "lockfileVersion": 3,- "requires": true,- "packages": {- "": {- "name": "agents-api-webhook-cloudflare",- "dependencies": {- "@cloudflare/sandbox": ">=0.12.8",- "openai": ">=7.5.0"- },- "devDependencies": {- "@cloudflare/workers-types": ">=4.20260702.1",- "typescript": "^5.9",- "wrangler": ">=4.90.0"- }- },- "node_modules/@cloudflare/containers": {- "version": "0.3.7",- "integrity": "sha512-DM9dm3FnIBSyiSJ1FLavKwl/lk3oAmTaynCzZQ9pZR0ncRPquSxkxd8Nu2MFILxmDDsPkxKsSNEh9mHHMty4Fw==",- "license": "MIT OR Apache-2.0"- },- "node_modules/@cloudflare/kv-asset-handler": {- "version": "0.5.0",- "integrity": "sha512-jxQYkj8dSIzc0cD6cMMNdOc1UVjqSqu8BZdor5s8cGjW2I8BjODt/kWPVdY+u9zj3ms75Q5qaZgnxUad83+eAg==",- "dev": true,- "license": "MIT OR Apache-2.0",- "engines": {- "node": ">=22.0.0"- }- },- "node_modules/@cloudflare/sandbox": {- "version": "0.12.8",- "integrity": "sha512-xrmVqqfCBN6jNIRthICs/AwF2uUL9eH4yavjXHr9cFWpKalcPFsZY85CGddAG58Anx5WcEWTKHcM9w7Imf1eKA==",- "license": "Apache-2.0",- "dependencies": {- "@cloudflare/containers": "^0.3.5",- "aws4fetch": "^1.0.20",- "capnweb": "^0.8.0",- "hono": "^4.13.0"- },- "peerDependencies": {- "@openai/agents": "^0.3.3",- "@opencode-ai/sdk": "^1.1.40",- "@xterm/xterm": ">=5.0.0"- },- "peerDependenciesMeta": {- "@openai/agents": {- "optional": true- },- "@opencode-ai/sdk": {- "optional": true- },- "@xterm/xterm": {- "optional": true- }- }- },- "node_modules/@cloudflare/unenv-preset": {- "version": "2.16.1",- "integrity": "sha512-ECxObrMfyTl5bhQf/lZCXwo5G6xX9IAUo+nDMKK4SZ8m4Jvvxp52vilxyySSWh2YTZz8+HQ07qGH/2rEom1vDw==",- "dev": true,- "license": "MIT OR Apache-2.0",- "peerDependencies": {- "unenv": "2.0.0-rc.24",- "workerd": ">1.20260305.0 <2.0.0-0"- },- "peerDependenciesMeta": {- "workerd": {- "optional": true- }- }- },- "node_modules/@cloudflare/workerd-darwin-64": {- "version": "1.20260507.1",- "integrity": "sha512-S85aMwcaPJUjKWDiG6iMMnioKWtPLACa6m0j/EhHR1GYfVpnxb974cBc6d25L+sf7jHWHJI2u5hGp0UTJ7MtXQ==",- "cpu": [- "x64"- ],- "dev": true,- "license": "Apache-2.0",- "optional": true,- "os": [- "darwin"- ],- "engines": {- "node": ">=16"- }- },- "node_modules/@cloudflare/workerd-darwin-arm64": {- "version": "1.20260507.1",- "integrity": "sha512-GMEBu8Zp9Q97HLnf7bWJN4KjWpN5MxpeqdvHjBGWNl8UYprJI0k+Jkp89+Wh5S8vIon+HoVbDfOzPa7VwgL6Eg==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "Apache-2.0",- "optional": true,- "os": [- "darwin"- ],- "engines": {- "node": ">=16"- }- },- "node_modules/@cloudflare/workerd-linux-64": {- "version": "1.20260507.1",- "integrity": "sha512-QlrKEBdgA3uVc0Ok0Q3+0/CW0CTjgj5ySir1i1YY5FXVv0X6GpwtnB5umjunjF2MFprss+L+iFGZzxcSvMC1nA==",- "cpu": [- "x64"- ],- "dev": true,- "license": "Apache-2.0",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": ">=16"- }- },- "node_modules/@cloudflare/workerd-linux-arm64": {- "version": "1.20260507.1",- "integrity": "sha512-eGbbupEtK2nh9V9Dhcx3vv3GTKeXqSVNgAEYVCCN0NGS9tl9HbMoHRX/4JL181FKXROMigWBCQVL//qPhsAzBQ==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "Apache-2.0",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": ">=16"- }- },- "node_modules/@cloudflare/workerd-windows-64": {- "version": "1.20260507.1",- "integrity": "sha512-dmClJ/E0BAcuDetQIZFqbeAXejWrG5pysGRMQ6T83Y0IW/7IAamY2zFEkAJ10I5xwZsdHuYsZtzlOxpEXpJs7A==",- "cpu": [- "x64"- ],- "dev": true,- "license": "Apache-2.0",- "optional": true,- "os": [- "win32"- ],- "engines": {- "node": ">=16"- }- },- "node_modules/@cloudflare/workers-types": {- "version": "4.20260702.1",- "integrity": "sha512-mOhf5TUEB1m2vPrxtqoIGfz0fUC9xyxRDx5gWHy5s+OCo6dcV+g7wI1R7gYCMFohhqF/2y2xeKVwMwCJjfn/WA==",- "dev": true,- "license": "MIT OR Apache-2.0"- },- "node_modules/@cspotcode/source-map-support": {- "version": "0.8.1",- "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",- "dev": true,- "license": "MIT",- "dependencies": {- "@jridgewell/trace-mapping": "0.3.9"- },- "engines": {- "node": ">=12"- }- },- "node_modules/@emnapi/runtime": {- "version": "1.11.3",- "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==",- "dev": true,- "license": "MIT",- "optional": true,- "dependencies": {- "tslib": "^2.4.0"- }- },- "node_modules/@esbuild/aix-ppc64": {- "version": "0.27.3",- "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==",- "cpu": [- "ppc64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "aix"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/android-arm": {- "version": "0.27.3",- "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==",- "cpu": [- "arm"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "android"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/android-arm64": {- "version": "0.27.3",- "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "android"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/android-x64": {- "version": "0.27.3",- "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==",- "cpu": [- "x64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "android"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/darwin-arm64": {- "version": "0.27.3",- "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "darwin"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/darwin-x64": {- "version": "0.27.3",- "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==",- "cpu": [- "x64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "darwin"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/freebsd-arm64": {- "version": "0.27.3",- "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "freebsd"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/freebsd-x64": {- "version": "0.27.3",- "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==",- "cpu": [- "x64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "freebsd"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/linux-arm": {- "version": "0.27.3",- "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==",- "cpu": [- "arm"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/linux-arm64": {- "version": "0.27.3",- "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/linux-ia32": {- "version": "0.27.3",- "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==",- "cpu": [- "ia32"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/linux-loong64": {- "version": "0.27.3",- "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==",- "cpu": [- "loong64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/linux-mips64el": {- "version": "0.27.3",- "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==",- "cpu": [- "mips64el"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/linux-ppc64": {- "version": "0.27.3",- "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==",- "cpu": [- "ppc64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/linux-riscv64": {- "version": "0.27.3",- "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==",- "cpu": [- "riscv64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/linux-s390x": {- "version": "0.27.3",- "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==",- "cpu": [- "s390x"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/linux-x64": {- "version": "0.27.3",- "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==",- "cpu": [- "x64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/netbsd-arm64": {- "version": "0.27.3",- "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "netbsd"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/netbsd-x64": {- "version": "0.27.3",- "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==",- "cpu": [- "x64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "netbsd"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/openbsd-arm64": {- "version": "0.27.3",- "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "openbsd"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/openbsd-x64": {- "version": "0.27.3",- "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==",- "cpu": [- "x64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "openbsd"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/openharmony-arm64": {- "version": "0.27.3",- "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "openharmony"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/sunos-x64": {- "version": "0.27.3",- "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==",- "cpu": [- "x64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "sunos"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/win32-arm64": {- "version": "0.27.3",- "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "win32"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/win32-ia32": {- "version": "0.27.3",- "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==",- "cpu": [- "ia32"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "win32"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@esbuild/win32-x64": {- "version": "0.27.3",- "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==",- "cpu": [- "x64"- ],- "dev": true,- "license": "MIT",- "optional": true,- "os": [- "win32"- ],- "engines": {- "node": ">=18"- }- },- "node_modules/@img/colour": {- "version": "1.1.0",- "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==",- "dev": true,- "license": "MIT",- "engines": {- "node": ">=18"- }- },- "node_modules/@img/sharp-darwin-arm64": {- "version": "0.34.5",- "integrity": "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "Apache-2.0",- "optional": true,- "os": [- "darwin"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- },- "optionalDependencies": {- "@img/sharp-libvips-darwin-arm64": "1.2.4"- }- },- "node_modules/@img/sharp-darwin-x64": {- "version": "0.34.5",- "integrity": "sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==",- "cpu": [- "x64"- ],- "dev": true,- "license": "Apache-2.0",- "optional": true,- "os": [- "darwin"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- },- "optionalDependencies": {- "@img/sharp-libvips-darwin-x64": "1.2.4"- }- },- "node_modules/@img/sharp-libvips-darwin-arm64": {- "version": "1.2.4",- "integrity": "sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "LGPL-3.0-or-later",- "optional": true,- "os": [- "darwin"- ],- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-libvips-darwin-x64": {- "version": "1.2.4",- "integrity": "sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==",- "cpu": [- "x64"- ],- "dev": true,- "license": "LGPL-3.0-or-later",- "optional": true,- "os": [- "darwin"- ],- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-libvips-linux-arm": {- "version": "1.2.4",- "integrity": "sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==",- "cpu": [- "arm"- ],- "dev": true,- "libc": [- "glibc"- ],- "license": "LGPL-3.0-or-later",- "optional": true,- "os": [- "linux"- ],- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-libvips-linux-arm64": {- "version": "1.2.4",- "integrity": "sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==",- "cpu": [- "arm64"- ],- "dev": true,- "libc": [- "glibc"- ],- "license": "LGPL-3.0-or-later",- "optional": true,- "os": [- "linux"- ],- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-libvips-linux-ppc64": {- "version": "1.2.4",- "integrity": "sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==",- "cpu": [- "ppc64"- ],- "dev": true,- "libc": [- "glibc"- ],- "license": "LGPL-3.0-or-later",- "optional": true,- "os": [- "linux"- ],- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-libvips-linux-riscv64": {- "version": "1.2.4",- "integrity": "sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==",- "cpu": [- "riscv64"- ],- "dev": true,- "libc": [- "glibc"- ],- "license": "LGPL-3.0-or-later",- "optional": true,- "os": [- "linux"- ],- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-libvips-linux-s390x": {- "version": "1.2.4",- "integrity": "sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==",- "cpu": [- "s390x"- ],- "dev": true,- "libc": [- "glibc"- ],- "license": "LGPL-3.0-or-later",- "optional": true,- "os": [- "linux"- ],- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-libvips-linux-x64": {- "version": "1.2.4",- "integrity": "sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==",- "cpu": [- "x64"- ],- "dev": true,- "libc": [- "glibc"- ],- "license": "LGPL-3.0-or-later",- "optional": true,- "os": [- "linux"- ],- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-libvips-linuxmusl-arm64": {- "version": "1.2.4",- "integrity": "sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==",- "cpu": [- "arm64"- ],- "dev": true,- "libc": [- "musl"- ],- "license": "LGPL-3.0-or-later",- "optional": true,- "os": [- "linux"- ],- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-libvips-linuxmusl-x64": {- "version": "1.2.4",- "integrity": "sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==",- "cpu": [- "x64"- ],- "dev": true,- "libc": [- "musl"- ],- "license": "LGPL-3.0-or-later",- "optional": true,- "os": [- "linux"- ],- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-linux-arm": {- "version": "0.34.5",- "integrity": "sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==",- "cpu": [- "arm"- ],- "dev": true,- "libc": [- "glibc"- ],- "license": "Apache-2.0",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- },- "optionalDependencies": {- "@img/sharp-libvips-linux-arm": "1.2.4"- }- },- "node_modules/@img/sharp-linux-arm64": {- "version": "0.34.5",- "integrity": "sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==",- "cpu": [- "arm64"- ],- "dev": true,- "libc": [- "glibc"- ],- "license": "Apache-2.0",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- },- "optionalDependencies": {- "@img/sharp-libvips-linux-arm64": "1.2.4"- }- },- "node_modules/@img/sharp-linux-ppc64": {- "version": "0.34.5",- "integrity": "sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==",- "cpu": [- "ppc64"- ],- "dev": true,- "libc": [- "glibc"- ],- "license": "Apache-2.0",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- },- "optionalDependencies": {- "@img/sharp-libvips-linux-ppc64": "1.2.4"- }- },- "node_modules/@img/sharp-linux-riscv64": {- "version": "0.34.5",- "integrity": "sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==",- "cpu": [- "riscv64"- ],- "dev": true,- "libc": [- "glibc"- ],- "license": "Apache-2.0",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- },- "optionalDependencies": {- "@img/sharp-libvips-linux-riscv64": "1.2.4"- }- },- "node_modules/@img/sharp-linux-s390x": {- "version": "0.34.5",- "integrity": "sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==",- "cpu": [- "s390x"- ],- "dev": true,- "libc": [- "glibc"- ],- "license": "Apache-2.0",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- },- "optionalDependencies": {- "@img/sharp-libvips-linux-s390x": "1.2.4"- }- },- "node_modules/@img/sharp-linux-x64": {- "version": "0.34.5",- "integrity": "sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==",- "cpu": [- "x64"- ],- "dev": true,- "libc": [- "glibc"- ],- "license": "Apache-2.0",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- },- "optionalDependencies": {- "@img/sharp-libvips-linux-x64": "1.2.4"- }- },- "node_modules/@img/sharp-linuxmusl-arm64": {- "version": "0.34.5",- "integrity": "sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==",- "cpu": [- "arm64"- ],- "dev": true,- "libc": [- "musl"- ],- "license": "Apache-2.0",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- },- "optionalDependencies": {- "@img/sharp-libvips-linuxmusl-arm64": "1.2.4"- }- },- "node_modules/@img/sharp-linuxmusl-x64": {- "version": "0.34.5",- "integrity": "sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==",- "cpu": [- "x64"- ],- "dev": true,- "libc": [- "musl"- ],- "license": "Apache-2.0",- "optional": true,- "os": [- "linux"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- },- "optionalDependencies": {- "@img/sharp-libvips-linuxmusl-x64": "1.2.4"- }- },- "node_modules/@img/sharp-wasm32": {- "version": "0.34.5",- "integrity": "sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==",- "cpu": [- "wasm32"- ],- "dev": true,- "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT",- "optional": true,- "dependencies": {- "@emnapi/runtime": "^1.7.0"- },- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-win32-arm64": {- "version": "0.34.5",- "integrity": "sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==",- "cpu": [- "arm64"- ],- "dev": true,- "license": "Apache-2.0 AND LGPL-3.0-or-later",- "optional": true,- "os": [- "win32"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-win32-ia32": {- "version": "0.34.5",- "integrity": "sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==",- "cpu": [- "ia32"- ],- "dev": true,- "license": "Apache-2.0 AND LGPL-3.0-or-later",- "optional": true,- "os": [- "win32"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@img/sharp-win32-x64": {- "version": "0.34.5",- "integrity": "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==",- "cpu": [- "x64"- ],- "dev": true,- "license": "Apache-2.0 AND LGPL-3.0-or-later",- "optional": true,- "os": [- "win32"- ],- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- }- },- "node_modules/@jridgewell/resolve-uri": {- "version": "3.1.2",- "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",- "dev": true,- "license": "MIT",- "engines": {- "node": ">=6.0.0"- }- },- "node_modules/@jridgewell/sourcemap-codec": {- "version": "1.5.5",- "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",- "dev": true,- "license": "MIT"- },- "node_modules/@jridgewell/trace-mapping": {- "version": "0.3.9",- "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",- "dev": true,- "license": "MIT",- "dependencies": {- "@jridgewell/resolve-uri": "^3.0.3",- "@jridgewell/sourcemap-codec": "^1.4.10"- }- },- "node_modules/@poppinss/colors": {- "version": "4.1.6",- "integrity": "sha512-H9xkIdFswbS8n1d6vmRd8+c10t2Qe+rZITbbDHHkQixH5+2x1FDGmi/0K+WgWiqQFKPSlIYB7jlH6Kpfn6Fleg==",- "dev": true,- "license": "MIT",- "dependencies": {- "kleur": "^4.1.5"- }- },- "node_modules/@poppinss/dumper": {- "version": "0.6.5",- "integrity": "sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw==",- "dev": true,- "license": "MIT",- "dependencies": {- "@poppinss/colors": "^4.1.5",- "@sindresorhus/is": "^7.0.2",- "supports-color": "^10.0.0"- }- },- "node_modules/@poppinss/exception": {- "version": "1.2.3",- "integrity": "sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw==",- "dev": true,- "license": "MIT"- },- "node_modules/@sindresorhus/is": {- "version": "7.2.0",- "integrity": "sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw==",- "dev": true,- "license": "MIT",- "engines": {- "node": ">=18"- },- "funding": {- "url": "https://github.com/sindresorhus/is?sponsor=1"- }- },- "node_modules/@speed-highlight/core": {- "version": "1.2.24",- "integrity": "sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw==",- "dev": true,- "license": "CC0-1.0"- },- "node_modules/aws4fetch": {- "version": "1.0.20",- "integrity": "sha512-/djoAN709iY65ETD6LKCtyyEI04XIBP5xVvfmNxsEP0uJB5tyaGBztSryRr4HqMStr9R06PisQE7m9zDTXKu6g==",- "license": "MIT"- },- "node_modules/blake3-wasm": {- "version": "2.1.5",- "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==",- "dev": true,- "license": "MIT"- },- "node_modules/capnweb": {- "version": "0.8.0",- "integrity": "sha512-BK/TuXUiyfLSKsmjojn70yN7oYG/JJzoURZ3tckjg5Zj2KcygPm0A5jyOlswK7SYB4f0Gh9tt+RZ132b80iLfA==",- "license": "MIT"- },- "node_modules/cookie": {- "version": "1.1.1",- "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==",- "dev": true,- "license": "MIT",- "engines": {- "node": ">=18"- },- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/express"- }- },- "node_modules/detect-libc": {- "version": "2.1.2",- "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",- "dev": true,- "license": "Apache-2.0",- "engines": {- "node": ">=8"- }- },- "node_modules/error-stack-parser-es": {- "version": "1.0.5",- "integrity": "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==",- "dev": true,- "license": "MIT",- "funding": {- "url": "https://github.com/sponsors/antfu"- }- },- "node_modules/esbuild": {- "version": "0.27.3",- "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==",- "dev": true,- "hasInstallScript": true,- "license": "MIT",- "bin": {- "esbuild": "bin/esbuild"- },- "engines": {- "node": ">=18"- },- "optionalDependencies": {- "@esbuild/aix-ppc64": "0.27.3",- "@esbuild/android-arm": "0.27.3",- "@esbuild/android-arm64": "0.27.3",- "@esbuild/android-x64": "0.27.3",- "@esbuild/darwin-arm64": "0.27.3",- "@esbuild/darwin-x64": "0.27.3",- "@esbuild/freebsd-arm64": "0.27.3",- "@esbuild/freebsd-x64": "0.27.3",- "@esbuild/linux-arm": "0.27.3",- "@esbuild/linux-arm64": "0.27.3",- "@esbuild/linux-ia32": "0.27.3",- "@esbuild/linux-loong64": "0.27.3",- "@esbuild/linux-mips64el": "0.27.3",- "@esbuild/linux-ppc64": "0.27.3",- "@esbuild/linux-riscv64": "0.27.3",- "@esbuild/linux-s390x": "0.27.3",- "@esbuild/linux-x64": "0.27.3",- "@esbuild/netbsd-arm64": "0.27.3",- "@esbuild/netbsd-x64": "0.27.3",- "@esbuild/openbsd-arm64": "0.27.3",- "@esbuild/openbsd-x64": "0.27.3",- "@esbuild/openharmony-arm64": "0.27.3",- "@esbuild/sunos-x64": "0.27.3",- "@esbuild/win32-arm64": "0.27.3",- "@esbuild/win32-ia32": "0.27.3",- "@esbuild/win32-x64": "0.27.3"- }- },- "node_modules/fsevents": {- "version": "2.3.3",- "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",- "dev": true,- "hasInstallScript": true,- "license": "MIT",- "optional": true,- "os": [- "darwin"- ],- "engines": {- "node": "^8.16.0 || ^10.6.0 || >=11.0.0"- }- },- "node_modules/hono": {- "version": "4.13.4",- "integrity": "sha512-AGEwKIyRMHRv1t8Wjwa3LHxQ61X5CqrdFT+4BRNTpqS5aJNnpl5WLjADb7vFlJzI/8uK7T5QLVApCMQKNa3LgQ==",- "license": "MIT",- "engines": {- "node": ">=16.9.0"- }- },- "node_modules/kleur": {- "version": "4.1.5",- "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==",- "dev": true,- "license": "MIT",- "engines": {- "node": ">=6"- }- },- "node_modules/miniflare": {- "version": "4.20260507.1",- "integrity": "sha512-PSXBiLExTdZ4UGO/raKCHQauUpYL7F880ZRB7j0+78Rv8h7TsdN2E/iEDK9sK2Y+SPQ5wJSeAa+rDeVKoZZoEw==",- "dev": true,- "license": "MIT",- "dependencies": {- "@cspotcode/source-map-support": "0.8.1",- "sharp": "^0.34.5",- "undici": "7.24.8",- "workerd": "1.20260507.1",- "ws": "8.18.0",- "youch": "4.1.0-beta.10"- },- "bin": {- "miniflare": "bootstrap.js"- },- "engines": {- "node": ">=22.0.0"- }- },- "node_modules/openai": {- "version": "7.5.0",- "integrity": "sha512-ZbDBz8FSB8Mv8fFYIUvzTFMdV5vl93/octp1MdtK2lfYepSpfv/ewmeugpKz/cwGtFSx+YuUM4NwpZ2P55YiPA==",- "license": "Apache-2.0",- "engines": {- "node": ">=22.0.0"- },- "peerDependencies": {- "@aws-sdk/credential-provider-node": ">=3.972.0 <4",- "@smithy/hash-node": ">=4.3.0 <5",- "@smithy/signature-v4": ">=5.4.0 <6",- "ws": "^8.18.0",- "zod": "^3.25 || ^4.0"- },- "peerDependenciesMeta": {- "@aws-sdk/credential-provider-node": {- "optional": true- },- "@smithy/hash-node": {- "optional": true- },- "@smithy/signature-v4": {- "optional": true- },- "ws": {- "optional": true- },- "zod": {- "optional": true- }- }- },- "node_modules/path-to-regexp": {- "version": "6.3.0",- "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==",- "dev": true,- "license": "MIT"- },- "node_modules/pathe": {- "version": "2.0.3",- "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",- "dev": true,- "license": "MIT"- },- "node_modules/semver": {- "version": "7.8.5",- "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",- "dev": true,- "license": "ISC",- "bin": {- "semver": "bin/semver.js"- },- "engines": {- "node": ">=10"- }- },- "node_modules/sharp": {- "version": "0.34.5",- "integrity": "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==",- "dev": true,- "hasInstallScript": true,- "license": "Apache-2.0",- "dependencies": {- "@img/colour": "^1.0.0",- "detect-libc": "^2.1.2",- "semver": "^7.7.3"- },- "engines": {- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"- },- "funding": {- "url": "https://opencollective.com/libvips"- },- "optionalDependencies": {- "@img/sharp-darwin-arm64": "0.34.5",- "@img/sharp-darwin-x64": "0.34.5",- "@img/sharp-libvips-darwin-arm64": "1.2.4",- "@img/sharp-libvips-darwin-x64": "1.2.4",- "@img/sharp-libvips-linux-arm": "1.2.4",- "@img/sharp-libvips-linux-arm64": "1.2.4",- "@img/sharp-libvips-linux-ppc64": "1.2.4",- "@img/sharp-libvips-linux-riscv64": "1.2.4",- "@img/sharp-libvips-linux-s390x": "1.2.4",- "@img/sharp-libvips-linux-x64": "1.2.4",- "@img/sharp-libvips-linuxmusl-arm64": "1.2.4",- "@img/sharp-libvips-linuxmusl-x64": "1.2.4",- "@img/sharp-linux-arm": "0.34.5",- "@img/sharp-linux-arm64": "0.34.5",- "@img/sharp-linux-ppc64": "0.34.5",- "@img/sharp-linux-riscv64": "0.34.5",- "@img/sharp-linux-s390x": "0.34.5",- "@img/sharp-linux-x64": "0.34.5",- "@img/sharp-linuxmusl-arm64": "0.34.5",- "@img/sharp-linuxmusl-x64": "0.34.5",- "@img/sharp-wasm32": "0.34.5",- "@img/sharp-win32-arm64": "0.34.5",- "@img/sharp-win32-ia32": "0.34.5",- "@img/sharp-win32-x64": "0.34.5"- }- },- "node_modules/supports-color": {- "version": "10.2.2",- "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==",- "dev": true,- "license": "MIT",- "engines": {- "node": ">=18"- },- "funding": {- "url": "https://github.com/chalk/supports-color?sponsor=1"- }- },- "node_modules/tslib": {- "version": "2.8.1",- "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",- "dev": true,- "license": "0BSD",- "optional": true- },- "node_modules/typescript": {- "version": "5.9.3",- "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",- "dev": true,- "license": "Apache-2.0",- "bin": {- "tsc": "bin/tsc",- "tsserver": "bin/tsserver"- },- "engines": {- "node": ">=14.17"- }- },- "node_modules/undici": {- "version": "7.24.8",- "integrity": "sha512-6KQ/+QxK49Z/p3HO6E5ZCZWNnCasyZLa5ExaVYyvPxUwKtbCPMKELJOqh7EqOle0t9cH/7d2TaaTRRa6Nhs4YQ==",- "dev": true,- "license": "MIT",- "engines": {- "node": ">=20.18.1"- }- },- "node_modules/unenv": {- "version": "2.0.0-rc.24",- "integrity": "sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw==",- "dev": true,- "license": "MIT",- "dependencies": {- "pathe": "^2.0.3"- }- },- "node_modules/workerd": {- "version": "1.20260507.1",- "integrity": "sha512-z7JhsFSe6+X1b5fUHaVpo15VM1IRMJiLofEkq8iKdCo+Veqc+FUg5lIsuz8NwePxuSKrXtO4ZQpGkQLbPVXFhg==",- "dev": true,- "hasInstallScript": true,- "license": "Apache-2.0",- "bin": {- "workerd": "bin/workerd"- },- "engines": {- "node": ">=16"- },- "optionalDependencies": {- "@cloudflare/workerd-darwin-64": "1.20260507.1",- "@cloudflare/workerd-darwin-arm64": "1.20260507.1",- "@cloudflare/workerd-linux-64": "1.20260507.1",- "@cloudflare/workerd-linux-arm64": "1.20260507.1",- "@cloudflare/workerd-windows-64": "1.20260507.1"- }- },- "node_modules/wrangler": {- "version": "4.90.0",- "integrity": "sha512-bmNIykl59TfCUn5xQgU7IWylSsPx3LQaPLMSAq2VQHt89CBrcj9qXQ0eYfjBCWA5XTBVgten391evt7xxtXwcA==",- "dev": true,- "license": "MIT OR Apache-2.0",- "dependencies": {- "@cloudflare/kv-asset-handler": "0.5.0",- "@cloudflare/unenv-preset": "2.16.1",- "blake3-wasm": "2.1.5",- "esbuild": "0.27.3",- "miniflare": "4.20260507.1",- "path-to-regexp": "6.3.0",- "unenv": "2.0.0-rc.24",- "workerd": "1.20260507.1"- },- "bin": {- "wrangler": "bin/wrangler.js",- "wrangler2": "bin/wrangler.js"- },- "engines": {- "node": ">=22.0.0"- },- "optionalDependencies": {- "fsevents": "~2.3.2"- },- "peerDependencies": {- "@cloudflare/workers-types": "^4.20260507.1"- },- "peerDependenciesMeta": {- "@cloudflare/workers-types": {- "optional": true- }- }- },- "node_modules/ws": {- "version": "8.18.0",- "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",- "devOptional": true,- "license": "MIT",- "engines": {- "node": ">=10.0.0"- },- "peerDependencies": {- "bufferutil": "^4.0.1",- "utf-8-validate": ">=5.0.2"- },- "peerDependenciesMeta": {- "bufferutil": {- "optional": true- },- "utf-8-validate": {- "optional": true- }- }- },- "node_modules/youch": {- "version": "4.1.0-beta.10",- "integrity": "sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ==",- "dev": true,- "license": "MIT",- "dependencies": {- "@poppinss/colors": "^4.1.5",- "@poppinss/dumper": "^0.6.4",- "@speed-highlight/core": "^1.2.7",- "cookie": "^1.0.2",- "youch-core": "^0.3.3"- }- },- "node_modules/youch-core": {- "version": "0.3.3",- "integrity": "sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA==",- "dev": true,- "license": "MIT",- "dependencies": {- "@poppinss/exception": "^1.2.2",- "error-stack-parser-es": "^1.0.5"- }- }- }-}diff --git a/examples/agents_api/sandboxes/webhook_managed/cloudflare/package.json b/examples/agents_api/sandboxes/webhook_managed/cloudflare/package.jsondeleted file mode 100644index 6473fc28..00000000--- a/examples/agents_api/sandboxes/webhook_managed/cloudflare/package.json+++ /dev/null@@ -1,18 +0,0 @@-{- "name": "agents-api-webhook-cloudflare",- "private": true,- "type": "module",- "scripts": {- "check": "tsc --noEmit",- "deploy": "wrangler deploy"- },- "dependencies": {- "@cloudflare/sandbox": ">=0.12.8",- "openai": ">=7.5.0"- },- "devDependencies": {- "@cloudflare/workers-types": ">=4.20260702.1",- "typescript": "^5.9",- "wrangler": ">=4.90.0"- }-}diff --git a/examples/agents_api/sandboxes/webhook_managed/cloudflare/tsconfig.json b/examples/agents_api/sandboxes/webhook_managed/cloudflare/tsconfig.jsondeleted file mode 100644index 1d566bd4..00000000--- a/examples/agents_api/sandboxes/webhook_managed/cloudflare/tsconfig.json+++ /dev/null@@ -1,13 +0,0 @@-{- "compilerOptions": {- "target": "ES2022",- "module": "ESNext",- "moduleResolution": "Bundler",- "strict": true,- "skipLibCheck": true,- "noEmit": true,- "types": ["@cloudflare/workers-types"],- "lib": ["ES2022"]- },- "include": ["src/**/*.ts"]-}diff --git a/examples/agents_api/sandboxes/webhook_managed/digitalocean/Dockerfile b/examples/agents_api/sandboxes/webhook_managed/digitalocean/Dockerfiledeleted file mode 100644index c97ee796..00000000--- a/examples/agents_api/sandboxes/webhook_managed/digitalocean/Dockerfile+++ /dev/null@@ -1,9 +0,0 @@-FROM python:3.14-slim--WORKDIR /app-COPY examples/agents_api/sandboxes/webhook_managed/digitalocean/handler.py ./examples/agents_api/sandboxes/webhook_managed/digitalocean/handler.py-RUN python -m pip install --no-cache-dir uv \- && uv pip install --system -r examples/agents_api/sandboxes/webhook_managed/digitalocean/handler.py--EXPOSE 8080-CMD ["python", "examples/agents_api/sandboxes/webhook_managed/digitalocean/handler.py"]