Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(cua-sandbox): add signed service URLs (#3508)

r33drichards8ab33c739f74
diff --git a/.github/scripts/tests/test_cua_fleet_release_wiring.py b/.github/scripts/tests/test_cua_fleet_release_wiring.py
index 3b4dcafd13..d73f413639 100644
--- a/.github/scripts/tests/test_cua_fleet_release_wiring.py
+++ b/.github/scripts/tests/test_cua_fleet_release_wiring.py
@@ -12,11 +12,11 @@ class TestCuaFleetReleaseWiring(unittest.TestCase):
def test_publisher_promotes_cua_fleet_0_1_14(self) -> None:
workflow = (REPO_ROOT / ".github/workflows/cd-py-fleet.yml").read_text()
expected_sources = {
- "cua_fleet-0.1.14-py3-none-manylinux_2_34_x86_64.whl": "2dc70e98b3e8c691bf0fff0494b0a85d2405e872f1ca99dbfa2680473cea565b",
- "cua_fleet-0.1.14-py3-none-manylinux_2_34_aarch64.whl": "d6ea25902cf9ffc89779530b6ae7cff5413383ea7dc3c632a4fb47e00699a6d4",
- "cua_fleet-0.1.14-py3-none-macosx_10_12_x86_64.whl": "d370f83773574da8edcca080e9d86aec8eb7ed758d6c551b900482a8575f6810",
- "cua_fleet-0.1.14-py3-none-macosx_11_0_arm64.whl": "e19784c0ce8aa2d9a77bf096fc6ff10e990842f05c67bdfb96a16ecd5e7123e2",
- "cua_fleet-0.1.14-py3-none-win_amd64.whl": "3e73327b7c99dc95a4b4194628d3575a8707cab77d6929ed1bf34a82192a4464",
+ "cua_fleet-0.1.16-py3-none-manylinux_2_34_x86_64.whl": "6d1b2b2095b5cb629a303cdc314b8223c1205a49b0647a0d50a966f9a572131e",
+ "cua_fleet-0.1.16-py3-none-manylinux_2_34_aarch64.whl": "d29cc4cc2768ce2e9b48df9180ab1e544c5b659416f9d130af99f002fa9dd2f2",
+ "cua_fleet-0.1.16-py3-none-macosx_10_12_x86_64.whl": "27a8621170df2a14d4af8912f902266a0cc32c1ed91ebb592f6ddb3bcf600bb1",
+ "cua_fleet-0.1.16-py3-none-macosx_11_0_arm64.whl": "31d0373884f2d04dac8c3a88d06da7669491e5cb0c9d7c47ec839f8e42dc4e76",
+ "cua_fleet-0.1.16-py3-none-win_amd64.whl": "ccd088f6a3d167a48f106518d24d3c601e3190d946f663f4c4ccec160b33ac8e",
}
self.assertIn("https://wheels.cua.ai/simple/cua-fleet/$WHEEL", workflow)
diff --git a/.github/scripts/tests/test_periodic_cua_sandbox_live.py b/.github/scripts/tests/test_periodic_cua_sandbox_live.py
index c2dbd6947e..456c8f7e2e 100644
--- a/.github/scripts/tests/test_periodic_cua_sandbox_live.py
+++ b/.github/scripts/tests/test_periodic_cua_sandbox_live.py
@@ -142,7 +142,7 @@ class TestPeriodicCuaSandboxLive(unittest.TestCase):
"Write controlled failure diagnostics",
"persistent reconciled resources",
"claim-only cleanup",
- "cua-live-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}",
+ "cua-live-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && github.run_id || github.event_name }}",
"periodic-cua-sandbox-live-${{ github.event_name }}-${{ matrix.lane }}-${{ matrix.suite }}",
"cua-live-pool-warm-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}",
"cua-live-pool-cold-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}",
@@ -211,9 +211,10 @@ class TestPeriodicCuaSandboxLive(unittest.TestCase):
)
self.assertEqual(live["env"]["CUA_LIVE_E2E_EVENT"], "${{ github.event_name }}")
self.assertEqual(live["env"]["CUA_LIVE_E2E_SUITE"], "${{ matrix.suite }}")
+ self.assertEqual(live["env"]["CUA_LIVE_E2E_SIGNED_URLS"], "true")
self.assertEqual(
live["env"]["CUA_LIVE_E2E_NAMESPACE"],
- "cua-live-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}",
+ "cua-live-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && github.run_id || github.event_name }}",
)
self.assertEqual(
live["env"]["CUA_LIVE_E2E_POOL_WARM_NAMESPACE"],
@@ -223,12 +224,17 @@ class TestPeriodicCuaSandboxLive(unittest.TestCase):
live["env"]["CUA_LIVE_E2E_POOL_COLD_NAMESPACE"],
"cua-live-pool-cold-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}",
)
+ self.assertIn("github.run_id", live["env"]["CUA_LIVE_E2E_NAMESPACE"])
for namespace_env in (
- "CUA_LIVE_E2E_NAMESPACE",
"CUA_LIVE_E2E_POOL_WARM_NAMESPACE",
"CUA_LIVE_E2E_POOL_COLD_NAMESPACE",
):
self.assertNotIn("github.run_id", live["env"][namespace_env])
+ for namespace_env in (
+ "CUA_LIVE_E2E_NAMESPACE",
+ "CUA_LIVE_E2E_POOL_WARM_NAMESPACE",
+ "CUA_LIVE_E2E_POOL_COLD_NAMESPACE",
+ ):
self.assertNotIn("github.run_attempt", live["env"][namespace_env])
step_names = [step["name"] for step in live["steps"]]
diff --git a/.github/workflows/cd-py-fleet.yml b/.github/workflows/cd-py-fleet.yml
index 936f230c79..c5e8bc9b17 100644
--- a/.github/workflows/cd-py-fleet.yml
+++ b/.github/workflows/cd-py-fleet.yml
@@ -9,7 +9,7 @@ on:
version:
description: "Canonical cua-fleet version to publish"
required: true
- default: "0.1.14"
+ default: "0.1.16"
workflow_call:
inputs:
version:
@@ -49,8 +49,8 @@ jobs:
exit 1
fi
- if [[ "$VERSION" != "0.1.14" ]]; then
- echo "::error::This workflow promotes the hash-pinned cua-fleet 0.1.14 wheel set, not $VERSION."
+ if [[ "$VERSION" != "0.1.16" ]]; then
+ echo "::error::This workflow promotes the hash-pinned cua-fleet 0.1.16 wheel set, not $VERSION."
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
@@ -65,32 +65,32 @@ jobs:
include:
- platform: linux-x86_64
runner: ubuntu-22.04
- wheel: cua_fleet-0.1.14-py3-none-manylinux_2_34_x86_64.whl
- sha256: 2dc70e98b3e8c691bf0fff0494b0a85d2405e872f1ca99dbfa2680473cea565b
+ wheel: cua_fleet-0.1.16-py3-none-manylinux_2_34_x86_64.whl
+ sha256: 6d1b2b2095b5cb629a303cdc314b8223c1205a49b0647a0d50a966f9a572131e
native_library: libcyclops_sdk.so
audit: auditwheel
- platform: linux-aarch64
runner: ubuntu-24.04-arm
- wheel: cua_fleet-0.1.14-py3-none-manylinux_2_34_aarch64.whl
- sha256: d6ea25902cf9ffc89779530b6ae7cff5413383ea7dc3c632a4fb47e00699a6d4
+ wheel: cua_fleet-0.1.16-py3-none-manylinux_2_34_aarch64.whl
+ sha256: d29cc4cc2768ce2e9b48df9180ab1e544c5b659416f9d130af99f002fa9dd2f2
native_library: libcyclops_sdk.so
audit: auditwheel
- platform: macos-x86_64
runner: macos-15-intel
- wheel: cua_fleet-0.1.14-py3-none-macosx_10_12_x86_64.whl
- sha256: d370f83773574da8edcca080e9d86aec8eb7ed758d6c551b900482a8575f6810
+ wheel: cua_fleet-0.1.16-py3-none-macosx_10_12_x86_64.whl
+ sha256: 27a8621170df2a14d4af8912f902266a0cc32c1ed91ebb592f6ddb3bcf600bb1
native_library: libcyclops_sdk.dylib
audit: delocate
- platform: macos-arm64
runner: macos-14
- wheel: cua_fleet-0.1.14-py3-none-macosx_11_0_arm64.whl
- sha256: e19784c0ce8aa2d9a77bf096fc6ff10e990842f05c67bdfb96a16ecd5e7123e2
+ wheel: cua_fleet-0.1.16-py3-none-macosx_11_0_arm64.whl
+ sha256: 31d0373884f2d04dac8c3a88d06da7669491e5cb0c9d7c47ec839f8e42dc4e76
native_library: libcyclops_sdk.dylib
audit: delocate
- platform: windows-x86_64
runner: windows-latest
- wheel: cua_fleet-0.1.14-py3-none-win_amd64.whl
- sha256: 3e73327b7c99dc95a4b4194628d3575a8707cab77d6929ed1bf34a82192a4464
+ wheel: cua_fleet-0.1.16-py3-none-win_amd64.whl
+ sha256: ccd088f6a3d167a48f106518d24d3c601e3190d946f663f4c4ccec160b33ac8e
native_library: cyclops_sdk.dll
audit: none
steps:
@@ -246,11 +246,11 @@ jobs:
version, dist_directory = sys.argv[1:]
expected = {
- f"cua_fleet-{version}-py3-none-manylinux_2_34_x86_64.whl": "2dc70e98b3e8c691bf0fff0494b0a85d2405e872f1ca99dbfa2680473cea565b",
- f"cua_fleet-{version}-py3-none-manylinux_2_34_aarch64.whl": "d6ea25902cf9ffc89779530b6ae7cff5413383ea7dc3c632a4fb47e00699a6d4",
- f"cua_fleet-{version}-py3-none-macosx_10_12_x86_64.whl": "d370f83773574da8edcca080e9d86aec8eb7ed758d6c551b900482a8575f6810",
- f"cua_fleet-{version}-py3-none-macosx_11_0_arm64.whl": "e19784c0ce8aa2d9a77bf096fc6ff10e990842f05c67bdfb96a16ecd5e7123e2",
- f"cua_fleet-{version}-py3-none-win_amd64.whl": "3e73327b7c99dc95a4b4194628d3575a8707cab77d6929ed1bf34a82192a4464",
+ f"cua_fleet-{version}-py3-none-manylinux_2_34_x86_64.whl": "6d1b2b2095b5cb629a303cdc314b8223c1205a49b0647a0d50a966f9a572131e",
+ f"cua_fleet-{version}-py3-none-manylinux_2_34_aarch64.whl": "d29cc4cc2768ce2e9b48df9180ab1e544c5b659416f9d130af99f002fa9dd2f2",
+ f"cua_fleet-{version}-py3-none-macosx_10_12_x86_64.whl": "27a8621170df2a14d4af8912f902266a0cc32c1ed91ebb592f6ddb3bcf600bb1",
+ f"cua_fleet-{version}-py3-none-macosx_11_0_arm64.whl": "31d0373884f2d04dac8c3a88d06da7669491e5cb0c9d7c47ec839f8e42dc4e76",
+ f"cua_fleet-{version}-py3-none-win_amd64.whl": "ccd088f6a3d167a48f106518d24d3c601e3190d946f663f4c4ccec160b33ac8e",
}
wheels = {wheel.name: wheel for wheel in Path(dist_directory).glob("*.whl")}
assert set(wheels) == set(expected), (set(wheels), set(expected))
diff --git a/.github/workflows/periodic-cua-sandbox-live.yml b/.github/workflows/periodic-cua-sandbox-live.yml
index e23ea05839..ab7d41b47b 100644
--- a/.github/workflows/periodic-cua-sandbox-live.yml
+++ b/.github/workflows/periodic-cua-sandbox-live.yml
@@ -85,11 +85,12 @@ jobs:
CUA_LIVE_E2E_LANE: ${{ matrix.lane }}
CUA_LIVE_E2E_SUITE: ${{ matrix.suite }}
CUA_LIVE_E2E_EVENT: ${{ github.event_name }}
- CUA_LIVE_E2E_NAMESPACE: cua-live-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}
+ CUA_LIVE_E2E_NAMESPACE: cua-live-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && github.run_id || github.event_name }}
CUA_LIVE_E2E_POOL_WARM_NAMESPACE: cua-live-pool-warm-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}
CUA_LIVE_E2E_POOL_COLD_NAMESPACE: cua-live-pool-cold-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}
CUA_LIVE_E2E_ARTIFACT_DIR: /tmp/cua-live-e2e
CUA_TELEMETRY_ENABLED: "false"
+ CUA_LIVE_E2E_SIGNED_URLS: "true"
steps:
- name: Check Fleet OAuth credentials
env:
diff --git a/docs/content/docs/how-to-guides/sandbox/create-pool-with-typescript.mdx b/docs/content/docs/how-to-guides/sandbox/create-pool-with-typescript.mdx
index f19d254862..634840545b 100644
--- a/docs/content/docs/how-to-guides/sandbox/create-pool-with-typescript.mdx
+++ b/docs/content/docs/how-to-guides/sandbox/create-pool-with-typescript.mdx
@@ -125,12 +125,13 @@ const client = CyclopsClient.connect(configuration, new FetchHttpClient()) as Cy
let claim: Claim | undefined;
try {
- const service = new SandboxServiceBuilder().name('server').targetPort(8000).build();
+ const serverService = new SandboxServiceBuilder().name('server').targetPort(8000).build();
+ const mcpService = new SandboxServiceBuilder().name('mcp').targetPort(3000).build();
const vm = new VmTemplateBuilder()
.containerDiskImage(IMAGE)
.cpuCores(4)
.memory('4Gi')
- .services([service])
+ .services([serverService, mcpService])
.build();
const templateSpec = new OsGymSandboxTemplateSpecBuilder().vmTemplate(vm).build();
const templateRef = new SandboxTemplateRefBuilder().name(TEMPLATE_NAME).build();
@@ -188,7 +189,9 @@ npx tsx create-pool.ts
The script writes `sandbox.png` in the current directory. The Fleet client
creates and waits for the claim, routes `POST /cmd` through the authenticated
-`server` service proxy, and deletes the claim before closing.
+`server` service proxy, and deletes the claim before closing. The template also
+declares the Cua Driver MCP endpoint as the `mcp` service on port `3000`, so the
+same pool works with the signed-service URL guide.
</Tab>
<Tab value="Browser">
@@ -307,12 +310,13 @@ const client = CyclopsClient.connect(configuration, new FetchHttpClient()) as Cy
let claim: Claim | undefined;
try {
- const service = new SandboxServiceBuilder().name('server').targetPort(8000).build();
+ const serverService = new SandboxServiceBuilder().name('server').targetPort(8000).build();
+ const mcpService = new SandboxServiceBuilder().name('mcp').targetPort(3000).build();
const vm = new VmTemplateBuilder()
.containerDiskImage(IMAGE)
.cpuCores(4)
.memory('4Gi')
- .services([service])
+ .services([serverService, mcpService])
.build();
const templateSpec = new OsGymSandboxTemplateSpecBuilder().vmTemplate(vm).build();
const templateRef = new SandboxTemplateRefBuilder().name(TEMPLATE_NAME).build();
@@ -388,7 +392,9 @@ npm run dev
The browser SDK authenticates the Fleet API request, routes `POST /cmd` through
the named `server` service, decodes the computer-server event-stream response,
-and displays the PNG.
+and displays the PNG. The pool also exposes the Cua Driver MCP endpoint as the
+`mcp` service on port `3000`, matching the service used by the signed-service
+URL guide.
</Tab>
</Tabs>
diff --git a/docs/content/docs/how-to-guides/sandbox/meta.json b/docs/content/docs/how-to-guides/sandbox/meta.json
index 2beefcacb0..fcae338297 100644
--- a/docs/content/docs/how-to-guides/sandbox/meta.json
+++ b/docs/content/docs/how-to-guides/sandbox/meta.json
@@ -11,6 +11,7 @@
"secrets",
"scale-out",
"tunneling",
+ "share-service-with-signed-url",
"images",
"interactive-shell",
"minecraft"
diff --git a/docs/content/docs/how-to-guides/sandbox/share-service-with-signed-url.mdx b/docs/content/docs/how-to-guides/sandbox/share-service-with-signed-url.mdx
new file mode 100644
index 0000000000..7dd6bc1d48
--- /dev/null
+++ b/docs/content/docs/how-to-guides/sandbox/share-service-with-signed-url.mdx
@@ -0,0 +1,267 @@
+---
+title: Share a sandbox service with a signed URL
+description: Create, list, and revoke time-limited public URLs for sandbox services with Python or TypeScript.
+---
+
+import { Callout } from 'fumadocs-ui/components/callout';
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+Use a signed service URL when a person or external system needs temporary
+access to a service running inside a Fleet sandbox. The URL is public,
+time-limited, and revocable. Requests still route only to the named service on
+the bound sandbox.
+
+<Callout type="warn">
+ A signed service URL is a bearer credential. Anyone who has it can access the service until the
+ URL expires or is revoked. Do not put signed URLs in source control, logs, analytics events, or
+ public chat channels.
+</Callout>
+
+## Prerequisites
+
+- A Fleet pool whose template exposes the service you want to share.
+- A bound sandbox claim. The signed URL does not create or keep a claim alive.
+- OAuth client credentials with permission to manage the claim.
+- A Cua Sandbox or Fleet SDK release that includes signed service URL support.
+
+If you do not have a pool yet, create one with
+[Python](/how-to-guides/sandbox/create-pool-with-python) or
+[TypeScript](/how-to-guides/sandbox/create-pool-with-typescript). The service
+name passed to the signed URL API must match a service declared on that pool's
+template.
+
+Signed URLs accept expiration times from 60 seconds through 24 hours. The
+optional label is useful for recording why a link was created and is limited to
+120 UTF-8 bytes.
+
+## Authenticate
+
+Both SDKs connect to `https://run.cua.ai` by default. Set OAuth client
+credentials before running either example:
+
+```bash
+export CUA_CLIENT_ID="<your-client-id>"
+export CUA_CLIENT_SECRET="<your-client-secret>"
+export CUA_POOL_NAME="my-team-pool"
+export CUA_CLAIM_NAME="signed-url-demo"
+```
+
+Set `CUA_FLEET_BASE_URL` or `CUA_TOKEN_URL` only when you use non-default Fleet
+or OAuth endpoints.
+
+## Create and revoke a signed URL
+
+The examples claim a sandbox from an existing pool, create a one-hour URL for
+the `mcp` service, wait while you use the URL, and then revoke it before
+releasing the claim.
+
+<Tabs groupId="signed-service-url-language" persist items={['Python', 'TypeScript']}>
+ <Tab value="Python">
+
+This example uses [`uv`](https://docs.astral.sh/uv/) and the same self-contained
+script setup as the Python pool guide. `uv` installs `cua-sandbox` in an
+isolated environment when you run the script.
+
+Save the following script as `share_service.py`:
+
+```python title="share_service.py"
+# /// script
+# requires-python = ">=3.11,<3.14"
+# dependencies = [
+# "cua-sandbox",
+# ]
+# ///
+
+import asyncio
+import os
+
+from cua_sandbox import Pool
+
+
+POOL_NAME = os.environ["CUA_POOL_NAME"]
+CLAIM_NAME = os.environ.get("CUA_CLAIM_NAME", "signed-url-demo")
+SERVICE_NAME = "mcp"
+
+
+async def main() -> None:
+ pool = await Pool.get(POOL_NAME)
+
+ async with pool.claim(
+ name=CLAIM_NAME,
+ service=SERVICE_NAME,
+ time_to_start=900,
+ ) as sandbox:
+ signed_url = await sandbox.services.create_signed_url(
+ SERVICE_NAME,
+ label="Customer demo",
+ expires_in_seconds=3600,
+ )
+
+ try:
+ print(f"Share this URL: {signed_url.url}")
+
+ urls = await sandbox.services.list_signed_urls()
+ for item in urls:
+ state = "revoked" if item.revoked_at else "available"
+ print(f"{item.label or item.id}: {state}, expires {item.expires_at}")
+
+ await asyncio.to_thread(input, "Press Enter to revoke the URL... ")
+ finally:
+ await sandbox.services.revoke_signed_url(signed_url)
+
+
+asyncio.run(main())
+```
+
+Run it:
+
+```bash
+uv run share_service.py
+```
+
+`pool.claim()` keeps the claim bound for the duration of the context manager.
+The `finally` block revokes the URL even when the work inside the block raises
+an exception. Exiting the context then releases the claim while leaving the
+pool warm.
+
+ </Tab>
+ <Tab value="TypeScript">
+
+Install the Fleet SDK and a TypeScript runner:
+
+```bash
+npm install @trycua/fleet@^0.1.1
+npm install --save-dev tsx typescript
+npm pkg set type=module
+```
+
+Save the following script as `share-service.ts`:
+
+```ts title="share-service.ts"
+import { createInterface } from 'node:readline/promises';
+import {
+ CreateClaimRequestBuilder,
+ CyclopsClient,
+ CyclopsCredentials,
+ FetchHttpClient,
+ type Claim,
+ type CyclopsConfiguration,
+ type SignedServiceUrl,
+ uniffiInitAsync,
+} from '@trycua/fleet/node';
+
+const BASE_URL = process.env.CUA_FLEET_BASE_URL ?? 'https://run.cua.ai';
+const TOKEN_URL =
+ process.env.CUA_TOKEN_URL ??
+ 'https://auth.cua.ai/realms/cyclops-cs/protocol/openid-connect/token';
+const CLIENT_ID = requiredEnv('CUA_CLIENT_ID');
+const CLIENT_SECRET = requiredEnv('CUA_CLIENT_SECRET');
+const POOL_NAME = requiredEnv('CUA_POOL_NAME');
+const CLAIM_NAME = process.env.CUA_CLAIM_NAME ?? 'signed-url-demo';
+const SERVICE_NAME = 'mcp';
+
+function requiredEnv(name: string): string {
+ const value = process.env[name];
+ if (!value) throw new Error(`Missing environment variable: ${name}`);
+ return value;
+}
+
+await uniffiInitAsync();
+
+const configuration: CyclopsConfiguration = {
+ baseUrl: BASE_URL,
+ tokenUrl: TOKEN_URL,
+ credentials: new CyclopsCredentials(CLIENT_ID, CLIENT_SECRET),
+ poolPollIntervalMs: 5_000n,
+ poolPollLimit: 120,
+ claimPollIntervalMs: 5_000n,
+ claimPollLimit: 120,
+};
+const client = CyclopsClient.connect(configuration, new FetchHttpClient()) as CyclopsClient;
+
+let claim: Claim | undefined;
+let signedUrl: SignedServiceUrl | undefined;
+
+try {
+ const pool = await client.getPool(POOL_NAME);
+ claim = await client.createClaim(
+ new CreateClaimRequestBuilder().pool(pool).name(CLAIM_NAME).build()
+ );
+ const sandbox = await client.waitClaim(claim);
+
+ signedUrl = await client.createSignedServiceUrl({
+ sandbox,
+ service: SERVICE_NAME,
+ label: 'Customer demo',
+ expiresInSeconds: 3600,
+ });
+
+ console.log(`Share this URL: ${signedUrl.url}`);
+
+ const urls = await client.listSignedServiceUrls(sandbox);
+ for (const item of urls) {
+ const state = item.revokedAt ? 'revoked' : 'available';
+ console.log(`${item.label ?? item.id}: ${state}, expires ${item.expiresAt}`);
+ }
+
+ const readline = createInterface({ input: process.stdin, output: process.stdout });
+ await readline.question('Press Enter to revoke the URL... ');
+ readline.close();
+} finally {
+ try {
+ if (signedUrl) await client.revokeSignedServiceUrl(signedUrl);
+ } finally {
+ try {
+ if (claim) await client.deleteClaim(claim);
+ } finally {
+ client.uniffiDestroy();
+ }
+ }
+}
+```
+
+Run it:
+
+```bash
+npx tsx share-service.ts
+```
+
+The Fleet client manages signed URLs directly. Keep the returned
+`SignedServiceUrl` record because `revokeSignedServiceUrl()` uses it to identify
+the URL and namespace. The nested cleanup blocks revoke the URL, release the
+claim, and destroy the native client in that order.
+
+ </Tab>
+</Tabs>
+
+## Use the URL safely
+
+- Keep the claim bound while clients use the URL. Releasing or deleting the
+ claim can remove the backing service before the URL expires.
+- Choose the shortest practical expiration time. Create a new URL instead of
+ extending access through a long-lived link.
+- Use labels that identify the recipient or purpose without including secrets
+ or personal data.
+- Revoke the URL immediately when sharing is complete. Expiration is a fallback,
+ not a substitute for revocation.
+- Treat a `503` response from URL management operations as signed URLs being
+ unavailable in the current Fleet environment.
+
+## Troubleshoot
+
+### The SDK reports an unknown service
+
+The service name must be present in the bound sandbox's service list. Reconcile
+the pool template with the service and target port, then create a new claim.
+
+### The URL stops working before its expiration time
+
+Confirm that the claim is still bound and that the backing service still
+exists. A signed URL grants access to a service; it does not extend the claim's
+lifecycle.
+
+### The SDK says signed service URLs are unavailable
+
+Confirm that your installed Cua Sandbox or Fleet SDK includes signed service
+URL support and that the Fleet environment has the feature configured. Older
+SDK bindings do not expose the create, list, or revoke operations.
diff --git a/docs/superpowers/plans/2026-08-09-periodic-cua-sandbox-live-e2e.md b/docs/superpowers/plans/2026-08-09-periodic-cua-sandbox-live-e2e.md
index b8b3d58e51..b41757cf04 100644
--- a/docs/superpowers/plans/2026-08-09-periodic-cua-sandbox-live-e2e.md
+++ b/docs/superpowers/plans/2026-08-09-periodic-cua-sandbox-live-e2e.md
@@ -13,7 +13,7 @@
- Schedule must remain `7/15 * * * *`, running at `:07`, `:22`, `:37`, and `:52` UTC.
- Scheduled runs execute both `main-source` and `published-package`; relevant pushes to `main` execute only `main-source`.
- Manual dispatch accepts `both`, `main-source`, or `published-package`; only manual dispatch may set `force_failure=true`.
-- Use image `public.ecr.aws/k5j5w0x5/cua-ubuntu-24.04@sha256:82702ebdd32d1f8fc05f2ea409a7c67d0ba9f8f8e4e9f1a89ce40989d5f4475d`.
+- Use image `public.ecr.aws/k5j5w0x5/cua-ubuntu-24.04@sha256:80fff8a40f217a460cef7a60161adb3899eabd02c3451f18926b84d1f81b8da2`.
- Provision with `cpu=4`, `memory_mb=4096`, `server_port=8000`, `time_to_start=900`, `request_timeout=60`, and `telemetry_enabled=False`.
- Authenticate only with `CUA_CLIENT_ID`, `CUA_CLIENT_SECRET`, `CUA_FLEET_BASE_URL=https://run.cua.ai`, and the default Cyclops token endpoint.
- Do not use `CUA_API_KEY`, legacy `/api/keys`, namespace-scoped key creation, repository-private SDK helpers, or mutable image tags.
@@ -387,7 +387,7 @@ from tests.live.fleet_e2e_support import (
IMAGE = (
"public.ecr.aws/k5j5w0x5/cua-ubuntu-24.04"
- "@sha256:82702ebdd32d1f8fc05f2ea409a7c67d0ba9f8f8e4e9f1a89ce40989d5f4475d"
+ "@sha256:80fff8a40f217a460cef7a60161adb3899eabd02c3451f18926b84d1f81b8da2"
)
@@ -880,14 +880,14 @@ Update the merged PR or implementation issue with workflow run links, observed v
## Live Evidence Remediation
-The monitor uses reusable, dedicated namespaces instead of per-run namespaces.
+The monitor uses reusable namespaces for scheduled and push runs, while manual ephemeral runs use per-run namespaces to avoid stale ownership collisions.
Each lane has one DNS-safe namespace for each event class:
- `cua-live-<lane>-schedule` for scheduled runs
- `cua-live-<lane>-push` for pushes
-- `cua-live-<lane>-manual` for `workflow_dispatch`
+- `cua-live-<lane>-<run-id>` for `workflow_dispatch`
-The event-and-lane concurrency group serializes use of each deterministic claim;
+The event-and-lane concurrency group serializes reusable scheduled and push claims;
only scheduled runs cancel an older scheduled run in the same lane. Fleet
reconciliation preserves the namespace, pool, and template, all named after the
namespace. `Sandbox.ephemeral()` is verified with claim-only cleanup: after
@@ -898,7 +898,7 @@ that fails before yielding a sandbox. It never explicitly deletes a namespace,
pool, or template.
-Workflow namespace expression: `cua-live-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}`.
+Workflow namespace expression: `cua-live-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && github.run_id || github.event_name }}`.
persistent reconciled resources are intentionally retained between runs; only deterministic claims are ephemeral.
diff --git a/docs/superpowers/specs/2026-08-09-periodic-cua-sandbox-live-e2e-design.md b/docs/superpowers/specs/2026-08-09-periodic-cua-sandbox-live-e2e-design.md
index 6062fbe043..b0b838dfb4 100644
--- a/docs/superpowers/specs/2026-08-09-periodic-cua-sandbox-live-e2e-design.md
+++ b/docs/superpowers/specs/2026-08-09-periodic-cua-sandbox-live-e2e-design.md
@@ -123,14 +123,14 @@ Place the stable scenario in
opt-in and skips unless the OAuth environment is configured, keeping ordinary
local and pull request test runs credential-free.
-Each lane and event class uses a reusable DNS-safe namespace. The workflow sets
-`cua-live-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && 'manual' || github.event_name }}`, yielding `schedule`, `push`, or `manual` namespaces.
+Scheduled and push lanes use reusable DNS-safe namespaces; manual ephemeral runs use a run-unique namespace. The workflow sets
+`cua-live-${{ matrix.lane }}-${{ github.event_name == 'workflow_dispatch' && github.run_id || github.event_name }}`, yielding `schedule`, `push`, or `manual` namespaces.
Event-and-lane concurrency serializes each deterministic claim.
Provision with the exact certified image:
```text
-public.ecr.aws/k5j5w0x5/cua-ubuntu-24.04@sha256:82702ebdd32d1f8fc05f2ea409a7c67d0ba9f8f8e4e9f1a89ce40989d5f4475d
+public.ecr.aws/k5j5w0x5/cua-ubuntu-24.04@sha256:80fff8a40f217a460cef7a60161adb3899eabd02c3451f18926b84d1f81b8da2
```
Use the public SDK with:
@@ -306,12 +306,12 @@ Scripts CI installs `pyyaml` and runs this contract when the workflow changes.
## Live Evidence Remediation
-The monitor uses reusable, dedicated namespaces instead of per-run namespaces.
+The monitor uses reusable namespaces for scheduled and push runs, while manual ephemeral runs use per-run namespaces to avoid stale ownership collisions.
Each lane has one DNS-safe namespace for each event class:
- `cua-live-<lane>-schedule` for scheduled runs
- `cua-live-<lane>-push` for pushes
-- `cua-live-<lane>-manual` for `workflow_dispatch`
+- `cua-live-<lane>-<run-id>` for `workflow_dispatch`
The persistent pool suite adds `cua-live-pool-warm-<lane>-<event-class>` and
`cua-live-pool-cold-<lane>-<event-class>` namespaces whose pools and templates
diff --git a/libs/python/cua-sandbox/README.md b/libs/python/cua-sandbox/README.md
index 6767c154c4..577ac4bd9e 100644
--- a/libs/python/cua-sandbox/README.md
+++ b/libs/python/cua-sandbox/README.md
@@ -96,6 +96,22 @@ Fleet is the OAuth cloud backend. Configure OAuth credentials once; Fleet uses `
Fleet does not support snapshots or custom disks, and currently supports only `us-east-1`. `await sb.tunnel.forward(3000)` returns the authenticated Fleet service URL for an exposed port; it does not open a local SSH tunnel.
+Fleet sandboxes can also create time-limited, revocable public URLs for an
+exposed service. Treat each URL as a bearer credential and revoke it as soon as
+the recipient no longer needs access.
+
+```python
+signed_url = await sb.services.create_signed_url(
+ "mcp",
+ label="Customer demo",
+ expires_in_seconds=3600,
+)
+print(signed_url.url)
+
+active_urls = await sb.services.list_signed_urls()
+await sb.services.revoke_signed_url(signed_url)
+```
+
## Fleet pools and durable claims
For production workloads, claim from an existing pool. Supplying `pool=` never changes its configuration; `name=` names the claim, while `sb.name` is the separately bound sandbox resource.
diff --git a/libs/python/cua-sandbox/cua_sandbox/__init__.py b/libs/python/cua-sandbox/cua_sandbox/__init__.py
index bafa360eb5..f69c263bc4 100644
--- a/libs/python/cua-sandbox/cua_sandbox/__init__.py
+++ b/libs/python/cua-sandbox/cua_sandbox/__init__.py
@@ -22,6 +22,7 @@ from cua_sandbox._auth import login, whoami
from cua_sandbox._config import configure
from cua_sandbox.generated.image_models import ImageFileReference
from cua_sandbox.image import Image
+from cua_sandbox.interfaces import SignedServiceURL
from cua_sandbox.localhost import Localhost, localhost
from cua_sandbox.pool import Pool, Template
from cua_sandbox.runtime.compat import (
@@ -87,6 +88,7 @@ __all__ = [
"SandboxService",
"SandboxServiceBuilder",
"ServiceProtocol",
+ "SignedServiceURL",
"Firmware",
"Sandbox",
"SandboxInfo",
diff --git a/libs/python/cua-sandbox/cua_sandbox/interfaces/__init__.py b/libs/python/cua-sandbox/cua_sandbox/interfaces/__init__.py
index 0774fb8ae8..f68552ecf1 100644
--- a/libs/python/cua-sandbox/cua_sandbox/interfaces/__init__.py
+++ b/libs/python/cua-sandbox/cua_sandbox/interfaces/__init__.py
@@ -5,7 +5,7 @@ from cua_sandbox.interfaces.keyboard import Keyboard
from cua_sandbox.interfaces.mobile import Mobile
from cua_sandbox.interfaces.mouse import Mouse
from cua_sandbox.interfaces.screen import Screen
-from cua_sandbox.interfaces.services import Services
+from cua_sandbox.interfaces.services import Services, SignedServiceURL
from cua_sandbox.interfaces.shell import Shell
from cua_sandbox.interfaces.terminal import Terminal
from cua_sandbox.interfaces.tunnel import Tunnel, TunnelInfo
@@ -21,6 +21,7 @@ __all__ = [
"Mouse",
"Screen",
"Services",
+ "SignedServiceURL",
"Shell",
"Terminal",
"Tunnel",
diff --git a/libs/python/cua-sandbox/cua_sandbox/interfaces/services.py b/libs/python/cua-sandbox/cua_sandbox/interfaces/services.py
index 5e800c5054..ac4adb224c 100644
--- a/libs/python/cua-sandbox/cua_sandbox/interfaces/services.py
+++ b/libs/python/cua-sandbox/cua_sandbox/interfaces/services.py
@@ -2,11 +2,43 @@
from __future__ import annotations
+from dataclasses import dataclass
from typing import Any
from cua_sandbox.transport.base import Transport
+@dataclass(frozen=True)
+class SignedServiceURL:
+ """A revocable public URL for one sandbox service."""
+
+ id: str
+ namespace: str
+ claim: str
+ sandbox: str
+ service: str
+ label: str | None
+ url: str
+ created_at: str
+ expires_at: str
+ revoked_at: str | None
+
+ @classmethod
+ def from_resource(cls, resource: Any) -> "SignedServiceURL":
+ return cls(
+ id=resource.id,
+ namespace=resource.namespace,
+ claim=resource.claim,
+ sandbox=resource.sandbox,
+ service=resource.service,
+ label=resource.label,
+ url=resource.url,
+ created_at=resource.created_at,
+ expires_at=resource.expires_at,
+ revoked_at=resource.revoked_at,
+ )
+
+
class Services:
"""Request a named service exposed by the active sandbox connection."""
@@ -31,3 +63,27 @@ class Services:
return await self._transport.request_service(
name, method=method, path=path, json_body=json, headers=headers
)
+
+ async def create_signed_url(
+ self,
+ name: str,
+ *,
+ expires_in_seconds: int,
+ label: str | None = None,
+ ) -> SignedServiceURL:
+ """Create a revocable public URL for a named Fleet service."""
+ resource = await self._transport.create_signed_service_url(
+ name,
+ label=label,
+ expires_in_seconds=expires_in_seconds,
+ )
+ return SignedServiceURL.from_resource(resource)
+
+ async def list_signed_urls(self) -> list[SignedServiceURL]:
+ """List signed service URLs created for this Fleet sandbox claim."""
+ resources = await self._transport.list_signed_service_urls()
+ return [SignedServiceURL.from_resource(resource) for resource in resources]
+
+ async def revoke_signed_url(self, signed_url: SignedServiceURL) -> None:
+ """Revoke a previously created signed service URL."""
+ await self._transport.revoke_signed_service_url(signed_url)
diff --git a/libs/python/cua-sandbox/cua_sandbox/transport/base.py b/libs/python/cua-sandbox/cua_sandbox/transport/base.py
index d5ee49a656..19bf78994f 100644
--- a/libs/python/cua-sandbox/cua_sandbox/transport/base.py
+++ b/libs/python/cua-sandbox/cua_sandbox/transport/base.py
@@ -78,6 +78,21 @@ class Transport(ABC):
"""Request an auxiliary named service exposed by this sandbox."""
raise NotImplementedError(f"{type(self).__name__} does not support named service requests.")
+ async def create_signed_service_url(
+ self,
+ name: str,
+ *,
+ label: str | None,
+ expires_in_seconds: int,
+ ) -> Any:
+ raise NotImplementedError(f"{type(self).__name__} does not support signed service URLs.")
+
+ async def list_signed_service_urls(self) -> list[Any]:
+ raise NotImplementedError(f"{type(self).__name__} does not support signed service URLs.")
+
+ async def revoke_signed_service_url(self, signed_service_url: Any) -> None:
+ raise NotImplementedError(f"{type(self).__name__} does not support signed service URLs.")
+
async def forward_tunnel(self, sandbox_port: int | str) -> "TunnelInfo":
"""Forward *sandbox_port* to an available host port and return info.
diff --git a/libs/python/cua-sandbox/cua_sandbox/transport/fleet.py b/libs/python/cua-sandbox/cua_sandbox/transport/fleet.py
index 754ff78033..a7004d895a 100644
--- a/libs/python/cua-sandbox/cua_sandbox/transport/fleet.py
+++ b/libs/python/cua-sandbox/cua_sandbox/transport/fleet.py
@@ -98,6 +98,29 @@ class FleetTransport(Transport):
method, path, json_body=json_body, service_name=name, extra_headers=headers
)
+ async def create_signed_service_url(
+ self,
+ name: str,
+ *,
+ label: str | None,
+ expires_in_seconds: int,
+ ) -> Any:
+ assert self._connected, "Transport not connected"
+ return await self._sdk.create_signed_service_url(
+ self._bound,
+ name,
+ label=label,
+ expires_in_seconds=expires_in_seconds,
+ )
+
+ async def list_signed_service_urls(self) -> list[Any]:
+ assert self._connected, "Transport not connected"
+ return await self._sdk.list_signed_service_urls(self._bound)
+
+ async def revoke_signed_service_url(self, signed_service_url: Any) -> None:
+ assert self._connected, "Transport not connected"
+ await self._sdk.revoke_signed_service_url(signed_service_url)
+
async def _request(
self,
method: str,
diff --git a/libs/python/cua-sandbox/cua_sandbox/transport/fleet_cloud.py b/libs/python/cua-sandbox/cua_sandbox/transport/fleet_cloud.py
index d8504393b3..eb88fdb9c8 100644
--- a/libs/python/cua-sandbox/cua_sandbox/transport/fleet_cloud.py
+++ b/libs/python/cua-sandbox/cua_sandbox/transport/fleet_cloud.py
@@ -337,6 +337,72 @@ class _FleetClient:
) -> Any:
return await self._client.service_request(sandbox, service, path, request)
+ async def create_signed_service_url(
+ self,
+ sandbox: Any,
+ service: str,
+ *,
+ label: str | None,
+ expires_in_seconds: int,
+ ) -> Any:
+ try:
+ from fleet_sdk import CreateSignedServiceUrlRequestBuilder
+ except ImportError as error:
+ raise RuntimeError(
+ "Signed service URLs require a cua-fleet release with signed URL support"
+ ) from error
+
+ builder = (
+ CreateSignedServiceUrlRequestBuilder()
+ .sandbox(sandbox)
+ .service(service)
+ .expires_in_seconds(expires_in_seconds)
+ )
+ if label is not None:
+ builder = builder.label(label)
+ method = getattr(self._client, "create_signed_service_url", None)
+ if method is None:
+ raise RuntimeError(
+ "Signed service URLs require a cua-fleet release with signed URL support"
+ )
+ return await method(builder.build())
+
+ async def list_signed_service_urls(self, sandbox: Any) -> list[Any]:
+ method = getattr(self._client, "list_signed_service_urls", None)
+ if method is None:
+ raise RuntimeError(
+ "Signed service URLs require a cua-fleet release with signed URL support"
+ )
+ return await method(sandbox)
+
+ async def revoke_signed_service_url(self, signed_service_url: Any) -> None:
+ try:
+ from fleet_sdk import SignedServiceUrl
+ except ImportError as error:
+ raise RuntimeError(
+ "Signed service URLs require a cua-fleet release with signed URL support"
+ ) from error
+
+ method = getattr(self._client, "revoke_signed_service_url", None)
+ if method is None:
+ raise RuntimeError(
+ "Signed service URLs require a cua-fleet release with signed URL support"
+ )
+ await method(
+ SignedServiceUrl(
+ id=signed_service_url.id,
+ namespace=signed_service_url.namespace,
+ claim=signed_service_url.claim,
+ sandbox=signed_service_url.sandbox,
+ service=signed_service_url.service,
+ label=signed_service_url.label,
+ url=signed_service_url.url,
+ created_at=signed_service_url.created_at,
+ expires_at=signed_service_url.expires_at,
+ revoked_at=signed_service_url.revoked_at,
+ )
+ )
+
async def get_pool(self, name: str) -> Any:
return await self._client.get_pool(name)
diff --git a/libs/python/cua-sandbox/pyproject.toml b/libs/python/cua-sandbox/pyproject.toml
index 32bdedc5fd..dc7219c240 100644
--- a/libs/python/cua-sandbox/pyproject.toml
+++ b/libs/python/cua-sandbox/pyproject.toml
@@ -29,7 +29,7 @@ requires-python = ">=3.11,<3.14"
dependencies = [
"cua-core>=0.3.0,<0.4.0",
"cua-auto>=0.1.2",
- "cua-fleet==0.1.14",
+ "cua-fleet==0.1.16",
"pydantic>=2.11,<3.0",
"jsonschema>=4.23,<5.0",
"websockets>=12.0",
diff --git a/libs/python/cua-sandbox/tests/live/fleet_e2e_support.py b/libs/python/cua-sandbox/tests/live/fleet_e2e_support.py
index b2b730eae9..01eab09315 100644
--- a/libs/python/cua-sandbox/tests/live/fleet_e2e_support.py
+++ b/libs/python/cua-sandbox/tests/live/fleet_e2e_support.py
@@ -136,7 +136,7 @@ async def collect_resource_inventory(client: CyclopsClient, name: str) -> dict[s
pools = await client.list_pools(name)
claims = await client.list_claims(name)
except Exception as error:
- if is_not_found_error(error):
+ if is_pool_missing_error(error):
return {"templates": [], "pools": [], "claims": []}
raise
return {
diff --git a/libs/python/cua-sandbox/tests/live/test_fleet_ephemeral.py b/libs/python/cua-sandbox/tests/live/test_fleet_ephemeral.py
index aeac86809f..4bba74885a 100644
--- a/libs/python/cua-sandbox/tests/live/test_fleet_ephemeral.py
+++ b/libs/python/cua-sandbox/tests/live/test_fleet_ephemeral.py
@@ -1,5 +1,6 @@
from __future__ import annotations
+import asyncio
import os
import re
import time
@@ -21,7 +22,7 @@ from tests.live.fleet_e2e_support import (
IMAGE = (
"public.ecr.aws/k5j5w0x5/cua-ubuntu-24.04"
- "@sha256:82702ebdd32d1f8fc05f2ea409a7c67d0ba9f8f8e4e9f1a89ce40989d5f4475d"
+ "@sha256:80fff8a40f217a460cef7a60161adb3899eabd02c3451f18926b84d1f81b8da2"
)
@@ -137,6 +138,37 @@ async def run_fleet_ephemeral_live() -> None:
}
assert result.success
assert result.stdout.strip() == "Linux"
+
+ if os.environ.get("CUA_LIVE_E2E_SIGNED_URLS") == "true":
+ signed_url = await sandbox.services.create_signed_url(
+ "server",
+ label="periodic-live-e2e",
+ expires_in_seconds=300,
+ )
+ assert signed_url.namespace == pool_name
+ assert signed_url.service == "server"
+ assert signed_url.label == "periodic-live-e2e"
+ assert signed_url.revoked_at is None
+
+ try:
+ listed_signed_urls = await sandbox.services.list_signed_urls()
+ listed_signed_url = next(
+ item for item in listed_signed_urls if item.id == signed_url.id
+ )
+ assert listed_signed_url.revoked_at is None
+ finally:
+ await sandbox.services.revoke_signed_url(signed_url)
+
+ revoked_signed_urls = await sandbox.services.list_signed_urls()
+ revoked_signed_url = next(
+ item for item in revoked_signed_urls if item.id == signed_url.id
+ )
+ assert revoked_signed_url.revoked_at is not None
+ summary["signed_service_url"] = {
+ "created": True,
+ "listed": True,
+ "revoked": True,
+ }
except BaseException as error:
primary_error = error
summary["error"] = {"type": type(error).__name__}
@@ -162,7 +194,16 @@ async def run_fleet_ephemeral_live() -> None:
except BaseException as error:
record_cleanup_error(error)
try:
+ expected_inventory = {"templates": [], "pools": [], "claims": []}
inventory = await collect_resource_inventory(fleet, resource_namespace)
+ if claims_absent is True and primary_error is None:
+ inventory_deadline = time.monotonic() + 180.0
+ while (
+ inventory != expected_inventory
+ and time.monotonic() < inventory_deadline
+ ):
+ await asyncio.sleep(5.0)
+ inventory = await collect_resource_inventory(fleet, resource_namespace)
summary["persistent_resources"] = inventory
except BaseException as error:
record_cleanup_error(error)
@@ -174,7 +215,6 @@ async def run_fleet_ephemeral_live() -> None:
except BaseException as error:
record_cleanup_error(error)
if sandbox_yielded and inventory is not None:
- expected_inventory = {"templates": [], "pools": [], "claims": []}
if inventory != expected_inventory:
try:
summary["unexpected_inventory"] = True
diff --git a/libs/python/cua-sandbox/tests/live/test_fleet_pool_persistent.py b/libs/python/cua-sandbox/tests/live/test_fleet_pool_persistent.py
index 6c63803ac9..de76a6b0f1 100644
--- a/libs/python/cua-sandbox/tests/live/test_fleet_pool_persistent.py
+++ b/libs/python/cua-sandbox/tests/live/test_fleet_pool_persistent.py
@@ -23,7 +23,7 @@ from tests.live.fleet_e2e_support import (
IMAGE = (
"public.ecr.aws/k5j5w0x5/cua-ubuntu-24.04"
- "@sha256:82702ebdd32d1f8fc05f2ea409a7c67d0ba9f8f8e4e9f1a89ce40989d5f4475d"
+ "@sha256:80fff8a40f217a460cef7a60161adb3899eabd02c3451f18926b84d1f81b8da2"
)
POOL_CPU = 4
diff --git a/libs/python/cua-sandbox/tests/test_fleet_sdk_distribution.py b/libs/python/cua-sandbox/tests/test_fleet_sdk_distribution.py
index 313dce7042..e97964ae9a 100644
--- a/libs/python/cua-sandbox/tests/test_fleet_sdk_distribution.py
+++ b/libs/python/cua-sandbox/tests/test_fleet_sdk_distribution.py
@@ -10,6 +10,6 @@ def test_fleet_sdk_is_provided_by_published_fleet_distribution():
distribution_root = Path(cua_fleet_distribution.locate_file(".")).resolve()
binding_path = Path(fleet_sdk.__file__).resolve()
- assert cua_fleet_distribution.version == "0.1.14"
+ assert cua_fleet_distribution.version == "0.1.16"
assert "fleet_sdk/__init__.py" in installed_files
assert binding_path.is_relative_to(distribution_root)
diff --git a/libs/python/cua-sandbox/tests/test_fleet_sdk_packaging.py b/libs/python/cua-sandbox/tests/test_fleet_sdk_packaging.py
index 76c2a43239..02ab6fc864 100644
--- a/libs/python/cua-sandbox/tests/test_fleet_sdk_packaging.py
+++ b/libs/python/cua-sandbox/tests/test_fleet_sdk_packaging.py
@@ -18,7 +18,7 @@ class FleetSdkPackagingTests(unittest.TestCase):
project = tomllib.load(pyproject_file)
dependencies = project["project"]["dependencies"]
- self.assertIn("cua-fleet==0.1.14", dependencies)
+ self.assertIn("cua-fleet==0.1.16", dependencies)
self.assertFalse(any(dependency.startswith("cua-train") for dependency in dependencies))
self.assertNotIn("cua-fleet", project["tool"]["uv"]["sources"])
self.assertNotIn("cua-train", project["tool"]["uv"]["sources"])
@@ -49,7 +49,7 @@ class FleetSdkPackagingTests(unittest.TestCase):
self.assertNotIn("cua-train", sandbox_dependencies)
self.assertIn("cua-fleet", sandbox_requires_dist)
self.assertNotIn("cua-train", sandbox_requires_dist)
- self.assertEqual(packages["cua-fleet"]["version"], "0.1.14")
+ self.assertEqual(packages["cua-fleet"]["version"], "0.1.16")
self.assertEqual(
packages["cua-fleet"]["source"], {"registry": "https://wheels.cua.ai/simple"}
)
diff --git a/libs/python/cua-sandbox/tests/test_live_fleet_e2e_support.py b/libs/python/cua-sandbox/tests/test_live_fleet_e2e_support.py
index 80157d0a5f..a4b8d3d5c0 100644
--- a/libs/python/cua-sandbox/tests/test_live_fleet_e2e_support.py
+++ b/libs/python/cua-sandbox/tests/test_live_fleet_e2e_support.py
@@ -215,10 +215,13 @@ async def test_wait_claims_absent_propagates_non_404_sdk_errors() -> None:
@pytest.mark.asyncio
-async def test_collect_resource_inventory_returns_empty_for_public_sdk_404() -> None:
[email protected]("status", [403, 404])
+async def test_collect_resource_inventory_returns_empty_for_missing_namespace(
+ status: int,
+) -> None:
class FakeClient:
async def list_templates(self, name: str):
- raise SdkError.Status("list templates", 404, b"not found")
+ raise SdkError.Status("list templates", status, b"missing")
assert await collect_resource_inventory(FakeClient(), "demo") == {
"templates": [],
diff --git a/libs/python/cua-sandbox/tests/test_pool.py b/libs/python/cua-sandbox/tests/test_pool.py
index deebefb6b3..5b6617c4a9 100644
--- a/libs/python/cua-sandbox/tests/test_pool.py
+++ b/libs/python/cua-sandbox/tests/test_pool.py
@@ -2,6 +2,7 @@ from __future__ import annotations
from types import SimpleNamespace
+import fleet_sdk
import pytest
from cua_sandbox import (
ClaimSpec,
@@ -152,6 +153,8 @@ class FakeFleetClient:
self.deleted_templates: list[str] = []
self.renewed: list[tuple[str, str]] = []
self.service_requests: list[object] = []
+ self.signed_url_creates: list[tuple[object, str, str | None, int]] = []
+ self.signed_url_revocations: list[object] = []
self.wait_calls = 0
self.closed = False
@@ -195,6 +198,23 @@ class FakeFleetClient:
self.service_requests.append((sandbox, service, path, request))
return SimpleNamespace(status=200, headers=[], body=b'{"result":"ok"}')
+ async def create_signed_service_url(
+ self,
+ sandbox,
+ service,
+ *,
+ label=None,
+ expires_in_seconds,
+ ):
+ self.signed_url_creates.append((sandbox, service, label, expires_in_seconds))
+ return signed_service_url()
+
+ async def list_signed_service_urls(self, sandbox):
+ return [signed_service_url()]
+
+ async def revoke_signed_service_url(self, signed_url):
+ self.signed_url_revocations.append(signed_url)
+
async def delete_claim(self, claim: object) -> None:
self.released.append(claim.metadata.name)
if self.release_error:
@@ -210,6 +230,21 @@ class FakeFleetClient:
self.closed = True
+def signed_service_url() -> SimpleNamespace:
+ return SimpleNamespace(
+ id="31e1c9bb-8cc9-4c50-9cf4-51798b6978e4",
+ namespace="foo",
+ claim="claim-1",
+ sandbox="sandbox-1",
+ service="mcp",
+ label="Customer demo",
+ url="https://signed.example/link",
+ created_at="2026-09-01T12:00:00Z",
+ expires_at="2026-09-01T13:00:00Z",
+ revoked_at=None,
+ )
+
+
@pytest.mark.asyncio
async def test_fleet_client_get_pool_uses_name_lookup_without_listing() -> None:
expected = fleet_pool()
@@ -260,6 +295,87 @@ async def test_fleet_client_reconcile_template_delegates_to_generated_client() -
assert await client.reconcile_template("desired") is expected
+async def test_fleet_client_manages_signed_service_urls(monkeypatch) -> None:
+ calls: list[tuple[str, object]] = []
+
+ class RequestBuilder:
+ def __init__(self):
+ self.values = {}
+
+ def sandbox(self, value):
+ self.values["sandbox"] = value
+ return self
+
+ def service(self, value):
+ self.values["service"] = value
+ return self
+
+ def label(self, value):
+ self.values["label"] = value
+ return self
+
+ def expires_in_seconds(self, value):
+ self.values["expires_in_seconds"] = value
+ return self
+
+ def build(self):
+ return SimpleNamespace(**self.values)
+
+ class GeneratedSignedServiceURL(SimpleNamespace):
+ def __init__(self, **values):
+ super().__init__(**values)
+
+ class GeneratedClient:
+ async def create_signed_service_url(self, request):
+ calls.append(("create", request))
+ return signed_service_url()
+
+ async def list_signed_service_urls(self, sandbox):
+ calls.append(("list", sandbox))
+ return [signed_service_url()]
+
+ async def revoke_signed_service_url(self, signed_url):
+ calls.append(("revoke", signed_url))
+
+ monkeypatch.setattr(
+ fleet_sdk,
+ "CreateSignedServiceUrlRequestBuilder",
+ RequestBuilder,
+ raising=False,
+ )
+ monkeypatch.setattr(fleet_sdk, "SignedServiceUrl", GeneratedSignedServiceURL, raising=False)
+ client = object.__new__(_FleetClient)
+ client._client = GeneratedClient()
+ sandbox = FleetSandbox(
+ namespace="foo",
+ claim="claim-1",
+ name="sandbox-1",
+ services=["mcp"],
+ )
+
+ created = await client.create_signed_service_url(
+ sandbox,
+ "mcp",
+ label="Customer demo",
+ expires_in_seconds=3600,
+ )
+ listed = await client.list_signed_service_urls(sandbox)
+ await client.revoke_signed_service_url(created)
+
+ create_request = calls[0][1]
+ assert create_request.sandbox is sandbox
+ assert (create_request.service, create_request.label, create_request.expires_in_seconds) == (
+ "mcp",
+ "Customer demo",
+ 3600,
+ )
+ assert calls[1] == ("list", sandbox)
+ assert listed == [created]
+ assert calls[2][0] == "revoke"
+ assert calls[2][1].id == created.id
+
+
@pytest.mark.asyncio
async def test_reconcile_creates_pool_referencing_a_template(monkeypatch):
client = FakeFleetClient()
@@ -547,6 +663,35 @@ async def test_claim_exposes_named_service_requests(monkeypatch):
assert request.body == b'{"jsonrpc": "2.0", "method": "tools/list", "id": 1}'
+async def test_claim_manages_signed_service_urls(monkeypatch):
+ reconcile_client = FakeFleetClient()
+ claim_client = FakeFleetClient()
+ clients = iter([reconcile_client, claim_client])
+ monkeypatch.setattr("cua_sandbox.pool._FleetClient", lambda: next(clients))
+ pool = await Pool.reconcile(pool_request())
+
+ async with pool.claim() as sandbox:
+ created = await sandbox.services.create_signed_url(
+ "mcp",
+ label="Customer demo",
+ expires_in_seconds=3600,
+ )
+ listed = await sandbox.services.list_signed_urls()
+ await sandbox.services.revoke_signed_url(created)
+
+ bound, service, label, expires_in_seconds = claim_client.signed_url_creates[0]
+ assert (bound.name, service, label, expires_in_seconds) == (
+ "sandbox-1",
+ "mcp",
+ "Customer demo",
+ 3600,
+ )
+ assert created.url == "https://signed.example/link"
+ assert listed == [created]
+ assert claim_client.signed_url_revocations == [created]
+
+
@pytest.mark.asyncio
async def test_claim_forwards_native_claim_spec_unchanged(monkeypatch):
reconcile_client = FakeFleetClient()
diff --git a/libs/python/cua-sandbox/uv.lock b/libs/python/cua-sandbox/uv.lock
index 4585b9fa45..220da1e3bd 100644
--- a/libs/python/cua-sandbox/uv.lock
+++ b/libs/python/cua-sandbox/uv.lock
@@ -569,14 +569,14 @@ dev = [{ name = "pytest", specifier = ">=8.3.5" }]
[[package]]
name = "cua-fleet"
-version = "0.1.14"
+version = "0.1.16"
source = { registry = "https://wheels.cua.ai/simple" }
wheels = [
- { url = "https://wheels.cua.ai/simple/cua-fleet/cua_fleet-0.1.14-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:d370f83773574da8edcca080e9d86aec8eb7ed758d6c551b900482a8575f6810" },
- { url = "https://wheels.cua.ai/simple/cua-fleet/cua_fleet-0.1.14-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e19784c0ce8aa2d9a77bf096fc6ff10e990842f05c67bdfb96a16ecd5e7123e2" },
- { url = "https://wheels.cua.ai/simple/cua-fleet/cua_fleet-0.1.14-py3-none-manylinux_2_34_aarch64.whl", hash = "sha256:d6ea25902cf9ffc89779530b6ae7cff5413383ea7dc3c632a4fb47e00699a6d4" },
- { url = "https://wheels.cua.ai/simple/cua-fleet/cua_fleet-0.1.14-py3-none-manylinux_2_34_x86_64.whl", hash = "sha256:2dc70e98b3e8c691bf0fff0494b0a85d2405e872f1ca99dbfa2680473cea565b" },
- { url = "https://wheels.cua.ai/simple/cua-fleet/cua_fleet-0.1.14-py3-none-win_amd64.whl", hash = "sha256:3e73327b7c99dc95a4b4194628d3575a8707cab77d6929ed1bf34a82192a4464" },
+ { url = "https://wheels.cua.ai/simple/cua-fleet/cua_fleet-0.1.16-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:27a8621170df2a14d4af8912f902266a0cc32c1ed91ebb592f6ddb3bcf600bb1" },
+ { url = "https://wheels.cua.ai/simple/cua-fleet/cua_fleet-0.1.16-py3-none-macosx_11_0_arm64.whl", hash = "sha256:31d0373884f2d04dac8c3a88d06da7669491e5cb0c9d7c47ec839f8e42dc4e76" },
+ { url = "https://wheels.cua.ai/simple/cua-fleet/cua_fleet-0.1.16-py3-none-manylinux_2_34_aarch64.whl", hash = "sha256:d29cc4cc2768ce2e9b48df9180ab1e544c5b659416f9d130af99f002fa9dd2f2" },
+ { url = "https://wheels.cua.ai/simple/cua-fleet/cua_fleet-0.1.16-py3-none-manylinux_2_34_x86_64.whl", hash = "sha256:6d1b2b2095b5cb629a303cdc314b8223c1205a49b0647a0d50a966f9a572131e" },
+ { url = "https://wheels.cua.ai/simple/cua-fleet/cua_fleet-0.1.16-py3-none-win_amd64.whl", hash = "sha256:ccd088f6a3d167a48f106518d24d3c601e3190d946f663f4c4ccec160b33ac8e" },
]
[[package]]
@@ -622,7 +622,7 @@ dev = [
requires-dist = [
{ name = "cua-auto", specifier = ">=0.1.2" },
{ name = "cua-core", specifier = ">=0.3.0,<0.4.0" },
- { name = "cua-fleet", specifier = "==0.1.14" },
+ { name = "cua-fleet", specifier = "==0.1.16" },
{ name = "grpcio", specifier = "==1.78.0" },
{ name = "httpx", specifier = ">=0.27.0" },
{ name = "jsonschema", specifier = ">=4.23,<5.0" },