porter-sandbox. Use it from application code running in your sandbox-enabled Porter cluster.
Install
Add the SDK to your application image:uv:
Create your first sandbox
Create a sandbox, execute a command, print the command output, and terminate the sandbox when the work is done:PORTER_SANDBOX_API_KEY to a Porter API token and PORTER_CLUSTER_ID to the target cluster. The SDK reads the project from the token and builds the external Porter API URL automatically; see calling from outside the cluster for details.
Use sandbox names when you need to fetch, inspect, exec into, or terminate a sandbox later. Sandbox names must be unique within a cluster and currently cannot be reused, even after the sandbox is terminated.
Fetch logs
Logs are returned as structured log lines:Get a sandbox by name
Useget(name) when you know the sandbox name:
List sandboxes
Use tags to find sandboxes created by a workflow:Async usage
UseAsyncPorter from async application code:
asyncio.gather:

