Upstash Documentation

Shell

2 min read

Every box has a full Linux shell and runs on Debian by default.

You can access that shell either through the SDK or directly over SSH.


SSH#

Connect to a box with:

When prompted for a password, use your Box API key.

For example:

Tip

You can also copy this command from the SSH button on the box details page in the Upstash Console.


API#

Run a shell command#

A shell command resolves when the command finishes and gives you back the result and status.

If you need additional system tools, install them with Debian's package manager inside the box.


Run a code snippet#

You can execute code inside of a box:


Check exit status#

If the command fails, the run status will be "failed" and its result contains the stderr output.


Chain commands#

Pass a full shell expression. Pipes, redirects, and chained commands all work as expected.


Cancel a long-running command#

You can cancel a run to abort it. The status becomes "cancelled".


Retrieve logs#

After a command finishes, call logs() to get the full timestamped output for debugging or auditing.


Examples#

Install dependencies before a run#

Set up the environment with box.exec.command(), then hand off to the agent.

Run a build and extract artifacts#

Execute a build command, then download the output.

Health-check before handing off#

Verify the environment is usable before starting a longer agent task.