Example: Multi-step job in one sandbox
You use this pattern when later steps depend on earlier outputs in the same filesystem: you clone a repo, you install dependencies, you build, you run tests, you tar artifacts. You keep one sandbox alive for the whole pipeline so you do not re-upload layers between steps.What you accomplish
You run sequentialexec calls. You set cwd so each command runs in the right tree. You pass env when a step needs extra variables. You inspect exit codes after expensive steps so you fail fast.
Concepts you use
- Shared state: Every
execin the same sandbox sees the same disk (until you remove the VM). - Fail fast: You use
set -euo pipefailin bash when you wrap multiple shell commands in oneexec, or you checkexit_codeafter each SDK call. - Idempotency: You design steps so retries (new sandbox) do not corrupt external systems: your job touches only paths inside the VM until you upload results out.
Prerequisites
You completed Examples overview.Step 1: Provision workspace
Step 2: Seed files (or clone)
You simulate a repo with a placeholder file when you do not clone from Git in this example.Step 3: Step A: prepare
Step 4: Step B: transform (depends on A)
Step 5: Step C: package artifact
Step 6: Remove the sandbox
Practices you should follow
- You merge trivial shell steps into one
execwhen that reduces round trips: balance readability against latency. - You stream logs to your observability stack when steps run longer than a few minutes (Code execution).
- You cap total job time at the orchestrator level (queue worker deadline) even when each
exechas its owntimeout.
Related guides
CI test runner
Single-command gate on exit code
File ingest and ETL
Upload → transform → download

