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

# Create a rig

> Spin up a rig pre-loaded with your repo and agent credentials.

This guide walks through creating a rig, waiting for it to become ready,
and tearing it down. By default everything runs on the hosted platform at
[app.amika.dev](https://app.amika.dev).

## Prerequisites

> [!NOTE]
>
> * An Amika account. The CLI uses `amika auth login`. The SDK needs an API
>   key, which you pass as `apiKey`.
> * (For the `--git` flow) Git installed and a repo to mount.
> * For the SDK: `npm install @amika/sdk`.

## Step 1 — Create the rig

The simplest rig uses the `coder` preset (Ubuntu 24.04 with Node, Python,
and the Claude Code / Codex / OpenCode CLIs pre-installed).

```bash CLI theme={null}
amika rig create --name dev-box --preset coder
```

```ts TypeScript theme={null}
import { AmikaClient } from "@amika/sdk";

const client = new AmikaClient({ apiKey: process.env.AMIKA_API_KEY! });

const rig = await client.rigs.create({
  name: "dev-box",
  preset: "coder",
});
```

```bash HTTP API theme={null}
curl -X POST https://app.amika.dev/api/v0beta1/rigs \
  -H "Authorization: Bearer $AMIKA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "dev-box", "preset": "coder"}'
```

To clone a repo into the rig, run the CLI from inside that repository or pass
`--git <path-or-URL>`. The SDK accepts a URL through `repoUrl`.

```bash CLI theme={null}
# Clone the repo in the current directory
amika rig create --name dev-box --preset coder

# Or clone a remote URL
amika rig create --name dev-box --preset coder \
  --git https://github.com/gofixpoint/example-repo.git
```

```ts TypeScript theme={null}
const rig = await client.rigs.create({
  name: "dev-box",
  preset: "coder",
  repoUrl: "https://github.com/gofixpoint/example-repo.git",
  branch: "main",
});
```

```bash HTTP API theme={null}
curl -X POST https://app.amika.dev/api/v0beta1/rigs \
  -H "Authorization: Bearer $AMIKA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "dev-box",
    "preset": "coder",
    "repo_url": "https://github.com/gofixpoint/example-repo.git",
    "branch": "main"
  }'
```

### How the CLI picks a repo

* Run `amika rig create` **from inside a git repo** and that repo is used
  automatically — no flag needed.
* **Outside a repo** (or to target a different one), pass `--git <path-or-URL>`.
  The value accepts a local path or a git URL (HTTPS or SSH).
* Pass `--no-git` to skip auto-detection and create a **repo-less rig** — a
  rig with no repository mounted. This is useful for scratch environments or
  when you clone repos yourself after connecting.

> [!NOTE]
>
> A repo-less rig still boots a full environment; it just starts without a
> checked-out repository. Configuration for multi-repo and repo-less rigs is
> covered in the [Repository configuration](https://docs.amika.dev/reference/repository-configuration.md)
> guide.

## Step 2 — Wait until it's ready

A new rig starts out initializing and becomes `running` once it's reachable
and its setup has finished.

```bash CLI theme={null}
# `rig create` blocks until the rig is ready — no extra step needed.
```

```ts TypeScript theme={null}
// `rigs.create` returns before setup finishes.
// `wait` polls every 3 seconds until the rig is running and setup
// succeeded, for up to 15 minutes.
await rig.wait();
```

```bash HTTP API theme={null}
# Create returns 202 before setup finishes. Poll until `status` is
# `running` and `setup_status` is `ok`.
curl https://app.amika.dev/api/v0beta1/rigs/dev-box \
  -H "Authorization: Bearer $AMIKA_API_KEY"
```

> [!NOTE]
>
> `rig.wait()` throws an `AmikaWaitError` if provisioning fails, the setup
> script fails, or the deadline passes. Its `reason` field says which. Pass
> `{ maxWaitMs }` to change the deadline.

## Step 3 — Tear it down

When you're done, delete the rig to free its resources.

```bash CLI theme={null}
amika rig delete dev-box --force
```

```ts TypeScript theme={null}
await rig.delete();

// Or, without a fetched rig:
await client.rigs.handle("dev-box").delete();
```

```bash HTTP API theme={null}
curl -X DELETE https://app.amika.dev/api/v0beta1/rigs/dev-box \
  -H "Authorization: Bearer $AMIKA_API_KEY"
```

## Next steps

> [card] [Send a message to an agent](https://docs.amika.dev/guides/send-a-message-to-an-agent.md)

> [card] [Inject credentials](https://docs.amika.dev/guides/inject-credentials.md)

> [card] [Rig lifecycle](https://docs.amika.dev/guides/rig-lifecycle.md)

> [card] [Rig configuration reference](https://docs.amika.dev/reference/rig-configuration.md)


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