Skip to main content
The TypeScript Sandbox SDK is published as porter-sandbox. Use it from application code running in your sandbox-enabled Porter cluster.
Sandboxes are in a private beta. Please reach out to us at support@porter.run or over Slack if you are interested in joining.

Install

Add the SDK to your application:

Create your first sandbox

Create a sandbox, execute a command, print the command output, and terminate the sandbox when the work is done:
The SDK connects to the in-cluster Sandbox API automatically when this code runs as a Porter Application in the same cluster where sandboxes are enabled. If you need to invoke sandboxes from outside that cluster, pass an API token to the SDK. You can create an API token from Settings > API tokens in the Porter Dashboard. Creating API tokens requires admin permissions. 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

List sandboxes

Use tags to find sandboxes created by a workflow:

Concurrent sandboxes

All TypeScript Sandbox SDK methods are promise-based, so you can fan out with Promise.all:

Next steps