porter_sandbox:
Porter
Porter is the top-level sync client. It exposes resource namespaces for sandboxes, volumes, health, and readiness.
| Option | Type | Description |
|---|---|---|
api_key | str | None | Optional API key. Only required when invoking the Sandbox API from outside the sandbox-enabled cluster. Create one from Settings > API tokens in the Porter Dashboard. Creating API tokens requires admin permissions. |
base_url | str | None | Optional API base URL override. In-cluster Porter Applications use the in-cluster Sandbox API URL by default. |
timeout | float | None | Request timeout in seconds. Defaults to 30 seconds. |
porter.sandboxes
create
| Argument | Type | Description |
|---|---|---|
image | str | Container image to run. |
name | str | None | Optional cluster-unique sandbox name. Use lowercase letters, numbers, and hyphens; start and end with a letter or number. Names currently cannot be reused, even after termination. |
command | list[str] | None | Optional entrypoint override. |
args | list[str] | None | Optional arguments passed to the command. |
env | dict[str, str] | None | Environment variables to set in the sandbox. |
tags | dict[str, str] | None | Key-value labels for finding related sandboxes. |
volume_mounts | dict[str, str] | None | Volume IDs keyed by absolute mount path inside the sandbox. |
Sandbox handle.
get
Sandbox handle. Use names as the canonical reference for sandboxes you need to operate on later.
list
Sandbox
Sandbox is the handle returned by porter.sandboxes.
Properties:
| Property | Type | Description |
|---|---|---|
id | str | Sandbox identifier. |
phase | StatusResponsePhase | None | Last-known lifecycle phase. |
tags | dict[str, str] | None | Last-known tags. |
| Method | Description |
|---|---|
refresh() | Refetches status and updates phase and tags. |
exec(command) | Runs a command in the sandbox and returns stdout, stderr, and exit code. |
logs(since=None, limit=None) | Fetches structured log lines. |
terminate() | Terminates the sandbox. |
Volumes
Volumes are persistent storage that can be mounted into sandboxes.| Method | Description |
|---|---|
porter.volumes.list() | Lists volumes. |
porter.volumes.create(name=None) | Creates a volume. Pass a name when you need stable lookup later. |
porter.volumes.get(name) | Fetches a volume by name. |
porter.volumes.delete(name) | Deletes a volume by name. |
Async client
AsyncPorter mirrors Porter with awaitable methods:
Low-level client
The top-level client exposes generated low-level clients through.raw:

