# Quickstart

> Let your agent do it: Install Hermitbox on this machine and run a first sandbox. Run `curl -fsSL https://hbx.sh | sh` as my ordinary user, never with sudo, then check it with `~/.local/bin/hermitbox run -- echo hello`. Create a sandbox with the CLI, run `echo hello` in it and delete it. If I want TypeScript or Python, install that SDK from the release, export `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` as the page shows, and run its example. Never copy the key into a file or this chat. Show me each output. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/get-started/quickstart.md.

Install Hermitbox, create a sandbox, run `echo hello` in it and delete it. Do it from the CLI
first, then the same steps from TypeScript or Python.

## Install Hermitbox

Run the installer as your own user. Linux (`x86_64` or `aarch64`), no root, no Docker.

```sh
curl -fsSL https://hbx.sh | sh
```

The installer starts Hermitbox and prints a JSON summary. `apiUrl` is your API URL, and `apiKey`
is your key, printed on the first install only. Both are also saved privately for the CLI and
`hermitbox mcp`.

## Check it works

```sh
~/.local/bin/hermitbox run -- echo hello
```

It prints:

```txt
hello
```

`hermitbox run` creates a sandbox, runs one command in it and deletes it. New shells find
`hermitbox` on your `PATH`. In the shell you installed from, use `~/.local/bin/hermitbox`.

## Use the CLI

The CLI reads the credentials the installer saved. This block uses `jq` to read the new
sandbox's ID.

```sh
# Create a sandbox and save its ID.
SANDBOX_ID=$(hermitbox sandbox create | jq -r .id)

# Run a command in it.
hermitbox sandbox exec "$SANDBOX_ID" -- echo hello

# Delete it when you're done.
hermitbox sandbox rm "$SANDBOX_ID"
```

`hermitbox sandbox create` prints the new sandbox as JSON. With no tier named, the sandbox runs on
the host's default tier. On a host that serves only containers, add `--image alpine:3.22` to
`create`.

## Set the URL and key

The SDKs read `HERMITBOX_API_URL` and `HERMITBOX_API_KEY` from the environment. Use the `apiUrl`
the installer printed. `hermitbox config key` prints the saved key.

```sh
export HERMITBOX_API_URL='<api-url>'
export HERMITBOX_API_KEY="$(hermitbox config key)"
```

Keep the key in your process's private environment, never in a file you share.

## Use TypeScript

Install the TypeScript SDK from the release:

```sh
npm install https://github.com/hermitbox/hermitbox/releases/download/v0.2.1/hermitbox-0.2.1.tgz
```

Save this as `quickstart.ts`:

```ts
import { Hermitbox } from 'hermitbox'

// Read HERMITBOX_API_URL and HERMITBOX_API_KEY from the environment.
const hb = new Hermitbox()

// Create a sandbox on the host's default tier.
const box = await hb.sandbox()

// Run a command in it.
const result = await box.run('echo hello')
console.log(result.stdout) // hello

// Delete it when you're done.
await box.delete()
```

Run it with Bun or your project's TypeScript runner:

```sh
bun quickstart.ts
```

## Use Python

Install the Python SDK from the release, on Python 3.12 or later:

```sh
pip install https://github.com/hermitbox/hermitbox/releases/download/v0.2.1/hermitbox-0.2.1-py3-none-any.whl
```

Save this as `quickstart.py`:

```python
from hermitbox import Hermitbox

# Read HERMITBOX_API_URL and HERMITBOX_API_KEY from the environment.
hb = Hermitbox()

# Create a sandbox on the host's default tier.
box = hb.sandbox()

# Run a command in it.
result = box.run('echo hello')
print(result.stdout)  # hello

# Delete it when you're done.
box.delete()
```

Run it:

```sh
python3 quickstart.py
```

## Default tier

These examples name no tier and no image, so Hermitbox picks `process` or `wasm`. On a host that
serves only containers, or whose default tier is `container`, pass an image to `hb.sandbox()`:
`{ image: 'alpine:3.22' }` in TypeScript, `image='alpine:3.22'` in Python. See
[Isolation tiers](https://docs.hermitbox.dev/v0.2.1/concepts/isolation.md).

## Next steps

- [Connect your agent](https://docs.hermitbox.dev/v0.2.1/get-started/agents.md): paste one prompt into your agent, or add `hermitbox mcp` to it
  yourself.
- [Concepts](https://docs.hermitbox.dev/v0.2.1/concepts/sandboxes.md): sandboxes, their lifecycle, isolation tiers and templates.
- [Hosting](https://docs.hermitbox.dev/v0.2.1/hosting.md): run Hermitbox on a server, a platform that runs images, or a
  fleet of machines.
