DocsQuick Start
SandboxesQuick Start
v1.16+

Quick Start

This guide continues from Create a project and starts a sandbox-enabled service in the same quick-start project. Run these commands from the working directory created there.

Prerequisites

Before you start, make sure you have:

  • The quick-start project and initialized working directory from Create a project.
  • A queue or agent that can run service workloads.
  • Sandbox support enabled by your Polyaxon deployment or agent administrator.

Create a Sandbox Component

Create a Polyaxonfile named sandbox.yaml:

kind: component
version: 1.1
name: sandbox-dev

plugins:
  sandbox: true
  ssh: true
  tmux: true

run:
  kind: service
  volumes:
    - name: workspace
      emptyDir: {}
  container:
    image: python:3.11
    workingDir: /workspace
    command: ["sleep", "infinity"]
    volumeMounts:
      - name: workspace
        mountPath: /workspace

The emptyDir volume creates /workspace as writable scratch space for the lifetime of the pod. Its contents are lost when the pod is replaced. Save durable results to the run's outputs path before cleanup.

Start the Run

polyaxon run -p quick-start -f sandbox.yaml

Copy the run UUID from the command output into a variable in your local terminal:

export RUN_UUID=PASTE_RUN_UUID_HERE

The commands below reuse this variable. Wait until the run reaches running; sandbox ping does not wait for service readiness, so retry if the service is still starting.

This section passes -p quick-start explicitly. You can omit it while working from the directory initialized in Create a project.

Check Sandbox Health

polyaxon sandbox ping -p quick-start -uid $RUN_UUID

Execute a Command

polyaxon sandbox exec -p quick-start -uid $RUN_UUID -- python -V

Stream command output when the command may take longer:

polyaxon sandbox exec -p quick-start -uid $RUN_UUID --stream -- sh -lc 'python -V && pwd'

Open an Interactive Shell

polyaxon sandbox shell -p quick-start -uid $RUN_UUID

If plugins.tmux is enabled, you can also attach to a reconnectable terminal session:

polyaxon ops shell -p quick-start -uid $RUN_UUID

Keep or Stop the Run

Keep the service running while you work through the remaining sandbox guides. When you are finished, stop it to release CPU, memory, and GPU resources:

polyaxon ops stop -p quick-start -uid $RUN_UUID

For exact command options, see the sandbox CLI reference.

Next, continue to Connect with SSH.