> ## Documentation Index
> Fetch the complete documentation index at: https://www.agent37.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Run Omnara agents on Agent37

> Connect your Agent37 workspace to Omnara as a machine pool: Omnara runs the agent, and each agent works on its own always-on Agent37 instance.

[Omnara](https://www.omnara.com) is an open-source platform for managed agents. It runs the agent loop and keeps the state, and you choose the models, tools, and machines. Agent37 is one of its [machine pool providers](https://docs.omnara.com/machines/providers/agent37): connect your workspace, and every agent gets its own Agent37 instance, an always-on Linux computer that keeps its files, starts in seconds, and bills by the minute, from \$4.76 a month.

## How it works

* **Omnara** runs the agent loop and calls the model, so model keys never reach the instance. You launch agents from Omnara's dashboard, CLI, API, or SDK.
* **Each Omnara machine is one instance in your workspace**, created from the pool's template and size. Omnara names it `omnara-mch-...` and sets `omnara-installation` and `omnara-machine` in its `metadata`.
* Omnara starts its daemon on the instance with [exec](https://www.agent37.com/docs/agents-api/exec.md). The daemon connects out to Omnara, so the instance needs no public URL or open port.
* The instance stays on between turns and keeps its files and running processes. Omnara deletes it when you archive the agent.

## Before you begin

* An Agent37 API key in `AGENT37_API_KEY` and a funded [workspace wallet](https://www.agent37.com/docs/agents-api/billing.md). Create a key in the [dashboard](https://www.agent37.com/dashboard/cloud/api-keys). Machines run and bill in that key's workspace.
* An [Omnara Cloud](https://app.omnara.com) account.
* Node.js 22 or newer, to run Omnara's CLI with `npx`.

## 1. Store your API key in Omnara

```bash theme={null}
npx omnara login
npx omnara config select

npx omnara secrets create --owner-kind org --name agent37-api-key \
  --material-kind generic --material-value "$AGENT37_API_KEY"
```

`login` opens your browser to approve the CLI, and `config select` picks the organization and project the next commands use. Note the secret id (`sec_...`) in the output.

## 2. Create the pool

```bash theme={null}
npx omnara pools create \
  --name agent37-pool \
  --provider agent37 \
  --provider-auth-secret-id <secret-id> \
  --default-machine-provider-options '{}' \
  --default-machine-cpu 2 \
  --default-machine-memory-mb 4096 \
  --max-machine-cpu 4 \
  --max-machine-memory-mb 8192 \
  --max-total-machines 10 \
  --max-total-cpu 20 \
  --max-total-memory-mb 40960
```

* With no template in the provider options, machines use `agent37-omnara`: Ubuntu 24.04 as root, working in `/workspace`, with Python, Node.js, Go, PostgreSQL, Redis, `gh`, `rg`, PDF tools, and Playwright with headless Chromium installed. To run your own image, see [Use your own image](#use-your-own-image).
* CPU and memory must be one of Agent37's [sizes](https://www.agent37.com/docs/agents-api/instance-sizing.md): 2 vCPU with 4096 MB, or 4 vCPU with 8192, 16384, or 32768 MB.
* Machines run in the `us` region.

Note the pool id (`mpo_...`) in the output, then grant the pool to your project:

```bash theme={null}
npx omnara grant pools add --machine-pool-id <pool-id>
```

Omnara's dashboard does the same: on the **Machines** page, click **New pool** and choose **Agent37**.

## 3. Launch an agent

Save this as `agent.yaml`:

```yaml agent.yaml theme={null}
version: v1
instruction: You have an Agent37 machine. Run commands there to complete tasks.
model:
  provider_config: omnara-openrouter
  name: anthropic/claude-fable-5.2
machine_sources:
  - machine_pool_name: agent37-pool
```

`omnara-openrouter` is the model provider every Omnara Cloud organization starts with. Launch the agent with a first task:

```bash theme={null}
npx omnara agents launch --file agent.yaml --name "Agent37 demo" \
  --message "Run uname -a, then write the current date to /workspace/note.txt."
```

Omnara creates an instance from the pool, and the agent runs its commands there. Note the agent id (`agt_...`) in the output. Follow the conversation in the [Omnara dashboard](https://app.omnara.com), or in your terminal:

```bash theme={null}
npx omnara agents chat <agent-id>
```

## 4. Reach the machine yourself

The machine is an ordinary instance in your workspace. Find it by name:

```bash theme={null}
curl --fail-with-body -sS https://api.agent37.com/v1/instances \
  -H "Authorization: Bearer $AGENT37_API_KEY" \
  | jq '.data[] | select((.name // "") | startswith("omnara-mch-")) | {id, name, status}'
```

Export its `id` as `INSTANCE_ID`, then read the file the agent wrote:

```bash theme={null}
curl --fail-with-body -sS \
  "https://sandbox.agent37.app/v1/instances/$INSTANCE_ID/exec" \
  -H "X-Agent37-Key: $AGENT37_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "command": "cat /workspace/note.txt" }'
```

`stdout` is the date the agent wrote. The rest of the Sandbox API works on the machine too:

* **A URL for every port.** A server the agent starts on port 3000 answers at `https://{instanceId}-3000.agent37.app` with your key in `X-Agent37-Key`. A [signed URL](https://www.agent37.com/docs/agents-api/urls.md) opens it in a browser, and a [public port](https://www.agent37.com/docs/agents-api/public-ports.md) gives it an address that needs no key.
* **SSH.** Add your public key once, then use `ssh`, `scp`, or VS Code Remote to watch an agent work or pick up where it left off. See [SSH](https://www.agent37.com/docs/agents-api/ssh.md).

## Use your own image

A pool can run any [workspace template](https://www.agent37.com/docs/agents-api/templates.md) in place of `agent37-omnara`. Register a public `linux/amd64` image with one call:

```bash theme={null}
curl --fail-with-body -sS https://api.agent37.com/v1/templates \
  -H "Authorization: Bearer $AGENT37_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "omnara-machine",
    "image_ref": "docker.io/library/buildpack-deps:24.04-curl",
    "entrypoint": ["/bin/sh", "-c", "trap \"exit 0\" TERM; while :; do sleep 3600 & wait $!; done"]
  }'
```

Then name it in the provider options when you create the pool:

```bash theme={null}
--default-machine-provider-options '{"template": "omnara-machine"}'
```

* Omnara starts its daemon with a command on the running instance, so the image's main process only has to keep running. The `entrypoint` above does that for an image whose own command exits.
* Agents run commands as the image's default user. Use an image that runs as root if agents should install packages.
* Omnara creates default instances, where Docker and systemd do not run (those need a [VM](https://www.agent37.com/docs/agents-api/vm-instances.md)), so use an image that needs neither.
* To build from a Dockerfile with no local Docker, run `npx agent37 templates build . --name omnara-machine`.
* Add `@<revision>`, such as `omnara-machine@2`, to [pin a published revision](https://www.agent37.com/docs/agents-api/templates.md#pin-a-template-version).

## Billing and cleanup

Omnara does not put Agent37 machines to sleep, so an instance bills its [running rate](https://www.agent37.com/docs/agents-api/billing.md) by the minute for as long as its agent keeps it. Archive an agent when it is done, which deletes its instance:

```bash theme={null}
npx omnara agents archive <agent-id>
```

To have Omnara delete machines that sit idle, create the pool with `--delete-after-idle-minutes`, which takes 5 or more.

To remove the rest of what this guide created, delete the pool and the secret, then revoke the API key in the [Agent37 dashboard](https://www.agent37.com/dashboard/cloud/api-keys):

```bash theme={null}
npx omnara pools delete <pool-id>
npx omnara secrets delete <secret-id>
```

Agent37 bills compute and storage through your [wallet](https://www.agent37.com/docs/agents-api/billing.md); model usage is billed through Omnara.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.