Examples
Runnable examples covering every corner of the alineo SDK — clone, install, and run.
Every example below is a real, runnable package in the alineo repo — bunx alineo-cli init, bun install, bun start.
Hello World
Spin up an Ubuntu sandbox, run a command, and stream the output.
Code Interpreter
Run code through the sandbox's built-in interpreter — stateless and stateful modes.
File Operations
The full sandbox file operations API — read, write, move, search, and transfer.
Reading Files
Read a file written inside the sandbox back to the host process.
Capturing Output
Capture exec stdout and use it as input for subsequent steps.
Running Bash Scripts
Run a multi-line bash script inside an isolated sandbox and stream its output.
Interactive Exec
A live, bidirectional PTY session that can be checkpointed and resumed mid-session.
Exposing Ports
Start an HTTP server inside a sandbox and reach it from the host via sb.proxy().
Control Flow
retry, when, and forEach — alineo's built-in workflow control-flow primitives.
Cancellation & Cleanup
Resource cleanup and error handling when commands fail or time out.
Error Handling
Strict vs. non-strict exec, and the CommandError/SandboxError/ExecConnectionError types.
Reusable Environments
Build a sandbox image once, then restore from snapshot on every run.
Checkpoint & Resume
Capture a snapshot after install, then resume from it to skip setup on the next run.
Forking Sandboxes
Install dependencies once, then fork into independent sandboxes that run in parallel.