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

# Agent Quickstart: One Prompt Connects Your Agents

> Paste one prompt with no secret in it. Your coding agent signs in once, then connects your agent where it runs, starting with a free demo sandbox.

Paste this prompt into your coding agent, such as Claude Code, Codex, Cursor, or Gemini CLI:

```text Setup prompt theme={null}
Use curl to read https://onecli.sh/docs/agent-quickstart.md, then follow it to set up OneCLI for me.
```

The prompt holds no key. You approve once in your browser. Your agent then asks where the agent you want to connect runs, connects it, and proves it with a real call. It never connects itself, so its own settings stay as they are.

Self-hosting? Add your API address to the end of the prompt, for example `My OneCLI API is at https://onecli.example.com.`

The rest of this page is written for the agent, so it also shows exactly what the agent will do. To run the steps yourself, use the [Quickstart](/docs/quickstart.md).

## Instructions for the agent

You are setting up OneCLI for the person you are working with. If you are reading this page, you already have the instructions: start at Step 1.

OneCLI gives an agent access to APIs without giving it a key. Your person keeps their apps and keys in a vault. Each agent connects to one vault. When an agent calls an API through the OneCLI gateway, the gateway adds the credential on the way out.

You are your person's manager. You sign in once, then connect the agent your person wants, where it runs. You never connect yourself: you hold only the key that `onecli login` saves.

Follow these rules for the whole setup:

* Never run `onecli connect`, `onecli attach`, `onecli run`, or `onecli exec` for yourself, and never add a proxy to your own settings.
* Never ask your person for a key, a token, or a password. You do not need one.
* `onecli tokens create` shows a connect token once. Pass it only to the place it is for. Never repeat it, log it, or save it.
* Never print, log, or save a credential or the contents of `agent.env`. Where an agent is connected, never run commands that print the environment or `HTTPS_PROXY`, such as `env` or `printenv`: they hold that agent's credential.
* Run each command as written here. Do not preview, back up, or inspect around it.
* Show your person every link the CLI prints, as a bare URL on its own line. Then wait for them. Do not guess that they approved.
* Every `onecli` command you run prints JSON. Read the `code` and `action` fields of an error before you retry.
* If you cannot run a command, give your person the exact command and wait. Do not claim it is done.
* Do every step that applies, in order.

## Step 1: Install or update the CLI

```bash theme={null}
onecli version
```

```json theme={null}
{
  "version": "3.4.0",
  "os": "darwin",
  "arch": "arm64"
}
```

You need version 3.4.0 or later. If the command is not found, or the version is older, install the latest:

```bash theme={null}
curl -fsSL https://onecli.sh/cli/install | sh
```

The script installs the latest `onecli` binary from GitHub Releases, and replaces an older one. Run `onecli version` again to confirm it is on your `PATH`.

If your person named their own OneCLI address, set it in the shell of every `onecli` command you run. Skip this on OneCLI Cloud:

```bash theme={null}
export ONECLI_API_HOST=https://onecli.example.com
```

## Step 2: Sign in

Check whether you are signed in already:

```bash theme={null}
onecli whoami
```

If it prints your person's account, go to Step 3:

```json theme={null}
{
  "id": "0b8e5f3a-2c7d-4f19-9e6a-5d1c4b7a8e20",
  "email": "dana@acme.com",
  "name": "Dana Levi",
  "organization": {
    "id": "6f2a9c4e-1b3d-4e8f-a7c5-9d0e2f4b6a81",
    "name": "Acme",
    "slug": "acme",
    "role": "owner"
  },
  "api": "https://api.onecli.sh"
}
```

If it prints `"code": "AUTH_REQUIRED"`, sign in. `onecli login` prints a sign-in link, opens it in the browser, and then waits up to 5 minutes for your person. Run it in the background so you can read the link while it waits:

```bash theme={null}
nohup onecli login > /tmp/onecli-login.txt 2>&1 &
sleep 2; cat /tmp/onecli-login.txt
```

```text theme={null}
Open this link, sign in and confirm the code 5082a793: https://app.onecli.sh/auth/cli?code=5082a793046a097650ad80c4cd42a508
```

Write the link and the short code in a message to your person now, before you wait: many agent apps fold a command's output away, so they may not see it there. They sign in, or create an account, and approve. Then wait for the command to finish and read its result:

```bash theme={null}
until grep -qE '"(status|error)"' /tmp/onecli-login.txt; do sleep 2; done
cat /tmp/onecli-login.txt; rm /tmp/onecli-login.txt
```

On success:

```json theme={null}
{
  "status": "ok",
  "email": "dana@acme.com",
  "name": "Dana Levi",
  "expires_at": "2027-02-28T12:12:02.859Z"
}
```

This saves a key for managing vaults and agents. It expires after 90 days. It is not an agent's access to a vault: each agent gets its own in the next steps.

If your shell cannot open a browser, add `--no-open`. The link works from any device.

## Step 3: Ask where the agent runs

Ask your person one question, and wait for the answer:

```text theme={null}
Where does the agent you want to connect run?
1. A free demo sandbox: OneCLI starts a Linux box for you, already connected to your Personal vault, for 24 hours
2. An E2B sandbox
3. A Daytona sandbox
4. Docker, or a server of your own
5. This machine
```

To someone trying OneCLI for the first time, recommend the demo sandbox. Then follow their answer:

| Answer | Go to |
| - | - |
| 1 | Step 4 |
| 2, 3, or 4 | Step 5 |
| 5 | Step 6 |

## Step 4: Connect a free demo sandbox

> [!NOTE]
>
> The demo sandbox is a preview. It may change or be removed. Each person gets one, once, where their OneCLI offers it.

Start it:

```bash theme={null}
onecli demo start
```

OneCLI starts the box and connects it to your person's Personal vault as the agent `demo-sandbox`. This takes a few seconds. Once it is connected:

```json theme={null}
{
  "sandbox_id": "c0f3a6d2-7b1e-4a8f-9d25-3e6b8c4f1a07",
  "state": "connected",
  "agent_id": "8d2f6b1e-4c7a-4e3b-a915-62f0d8c3b7e4",
  "agent_name": "demo-sandbox",
  "vault_id": "lhnojmifhyjqyshv",
  "provider": "boat",
  "created_at": "2026-12-01T12:20:05.118Z",
  "ends_at": "2026-12-02T12:20:01.904Z"
}
```

If you get an error instead, tell your person what it means. Then go back to Step 3 and ask again, without the demo sandbox:

| `code` | What it means |
| - | - |
| `DEMO_SANDBOX_LIMIT` | Your person used their free demo sandbox already. |
| `DEMO_SANDBOX_NOT_OFFERED` or `DEMO_SANDBOX_NOT_CONFIGURED` | This OneCLI does not offer a demo sandbox. |
| `DEMO_SANDBOX_FULL` | Every demo sandbox is in use. Your person can try again in a few minutes. |
| `DEMO_SANDBOX_NO_VAULT` | Your person has no Personal vault in this organization. |
| `DEMO_SANDBOX_PROVIDER` | The box could not start or connect, and was deleted. Your person can try again a minute later. |

For `DEMO_SANDBOX_STARTING`, do not ask again: a box is starting now. Wait 30 seconds, then run `onecli demo start` again.

Once the box is connected, prove it with the same call, twice, inside the box. `onecli demo run` runs one shell command there and prints its output. Pass the command as one quoted string. First around OneCLI, with no credential:

```bash theme={null}
onecli demo run -- 'curl --noproxy "*" -s -o /dev/null -w %{http_code} https://httpbin.org/bearer'
```

```json theme={null}
{
  "exit_code": 0,
  "stdout": "401",
  "stderr": "",
  "truncated": false
}
```

Then through OneCLI. A login shell (`sh -lc`) reads the proxy settings that connecting wrote in the box:

```bash theme={null}
onecli demo run -- 'sh -lc "curl -s -o /dev/null -w %{http_code} https://httpbin.org/bearer"'
```

```json theme={null}
{
  "exit_code": 0,
  "stdout": "200",
  "stderr": "",
  "truncated": false
}
```

The gateway added the Test key on the way out. Neither you nor the box held it.

Tell your person that the box is theirs until `ends_at`, and that their dashboard lists it as `demo-sandbox`. You can run more commands in it with `onecli demo run -- '<command>'`, and end it now with `onecli demo end`. Go to Step 7.

## Step 5: Connect your own sandbox or server

List your person's vaults:

```bash theme={null}
onecli vaults list
```

```json theme={null}
[
  {
    "id": "lhnojmifhyjqyshv",
    "name": "Personal",
    "slug": null,
    "personal": true,
    "item_count": 1,
    "agent_count": 0,
    "created_at": "2026-11-30T12:10:44.512Z",
    "last_used_at": null,
    "member_count": 1
  }
]
```

Use the vault your person named. If they named none, use the one with `"personal": true`.

Make a one-use connect token for the new agent. Name the agent so your person can tell their agents apart, and name the provider: `e2b`, `daytona`, `docker`, or what the place is.

```bash theme={null}
onecli tokens create --vault lhnojmifhyjqyshv --name research-container --provider docker
```

```json theme={null}
{
  "id": "605ba657-1c5c-423f-ab62-7cfdf98751dd",
  "vault_id": "lhnojmifhyjqyshv",
  "name": "research-container",
  "provider": "docker",
  "created_at": "2026-12-01T14:58:22.013Z",
  "expires_at": "2026-12-01T15:13:22.004Z",
  "connect_token": "oc_connect_…",
  "connect_command": "onecli connect oc_connect_…",
  "install_command": "curl -fsSL https://api.onecli.sh/v1/install/connect | sh -s -- oc_connect_…"
}
```

The token works once, and expires after 15 minutes. Run `install_command` inside the place where the new agent runs, as the user the agent runs as. It needs `sh` and `curl`, and it connects that place, not yours:

| Where | How to run `install_command` |
| - | - |
| E2B or Daytona | In the sandbox's terminal, or as the first command your code runs in the sandbox. |
| Docker | `docker exec <container> sh -c '<install_command>'` |
| Your own server | In a shell on that server. |

If you can reach that place yourself, such as a container on this machine, run the line there. Otherwise give your person the line and where to run it, then wait for them.

Check that the new agent is connected:

```bash theme={null}
onecli agents list --mine
```

```json theme={null}
[
  {
    "id": "3a7c9e1f-5b2d-4c8a-b6e4-0f9d2a1c7b35",
    "name": "research-container",
    "vault_id": "lhnojmifhyjqyshv",
    "runtime": "docker",
    "provider": "docker",
    "status": "active",
    "created_at": "2026-12-01T15:01:47.326Z",
    "expires_at": null,
    "last_seen_at": "2026-12-01T15:01:47.326Z",
    "created_by": {
      "via": "connect",
      "person": "Dana Levi",
      "key_name": "onecli login on a terminal"
    },
    "kind": null,
    "vault_name": "Personal"
  }
]
```

Then prove it with the same call, twice, inside that place. First around OneCLI, which answers `401`:

```bash theme={null}
curl --noproxy '*' -s -o /dev/null -w "%{http_code}\n" https://httpbin.org/bearer
```

Then through OneCLI, which answers `200`. A login shell reads the proxy settings that connecting wrote there. Start the agent from a login shell too, such as a new SSH session, so its calls go through OneCLI:

```bash theme={null}
sh -lc 'curl -s -o /dev/null -w "%{http_code}\n" https://httpbin.org/bearer'
```

In a Docker container, run each one with `docker exec <container> sh -lc '...'`. If you cannot run commands there, give your person the two lines. Go to Step 7.

## Step 6: Connect this machine

This choice comes last. An agent connected on this machine sends its calls through the gateway, so it stays apart from you: your person connects it, in a new terminal, and you do not.

Run `onecli vaults list` to find the vault id, as in Step 5. Then give your person these lines, with their vault id, a name for the agent, and the agent they use (`claude`, `codex`, `cursor`, `hermes`, `opencode`, or `openclaw`):

```bash theme={null}
onecli connect --vault lhnojmifhyjqyshv --name claude-code-macbook --no-profile
onecli exec -- curl -s -o /dev/null -w "%{http_code}\n" https://httpbin.org/bearer
onecli run -- claude
```

The first line connects this machine as a new agent. `--no-profile` keeps the proxy out of their other shells, so it never reaches you. The second line proves it: it prints `200`, because the gateway added the Test key. The third starts their agent with the proxy and the OneCLI certificate for that session only.

Wait for your person, then run `onecli agents list --mine` to see the new agent. Go to Step 7.

## Step 7: Offer a first real app

The Test key is only a demonstration. Ask your person which app they want their agent to use first, such as GitHub, Gmail, or Slack. Then give them the link that adds it to the agent's vault, with the vault id and the app:

```text theme={null}
https://app.onecli.sh/w/lhnojmifhyjqyshv/connections?connect=github
```

They connect the app in their browser, and the agent can use it from its next call. Never ask them for a key. On any other OneCLI, the dashboard address is `origins.external` in the answer of `curl -s <your API address>/v1/instance`.

If they want no app now, tell them they can add one later from the vault's page.

## Report back

Finish with a report of four lines at most:

* Where the new agent runs, its name, and its vault.
* The two status codes of the proof.
* The app you offered, with its link, or that none was asked for.
* Any step you could not do, with the exact command your person should run.

Do not list files. If sign-in is still waiting for approval, say the setup is prepared but not verified.

## After setup

You stay signed in for 90 days, so your person can ask you to connect more agents at any time: start again at Step 3. Each agent gets its own one-use token.

| You want to | Run |
| - | - |
| List the agents you connected | `onecli agents list --mine` |
| Disconnect one | `onecli agents disconnect <agent-id> --yes` |
| List unused connect tokens | `onecli tokens list --vault <vault-id>` |
| Revoke one | `onecli tokens revoke <token-id> --vault <vault-id>` |
| End the demo sandbox now | `onecli demo end` |
| Read the whole agent guide | `curl -s https://api.onecli.sh/v2/skill` |

## When something fails

| What you see | What it means | What to do |
| - | - | - |
| `"code": "AUTH_REQUIRED"` with `"action": "onecli login"` | You have not signed in, or the 90-day key expired. | Sign in, as in Step 2. |
| `onecli login` returns without `"status": "ok"` | The link expired or your person did not approve. | Ask before you run it again. |
| `unknown command` for `demo`, `tokens`, or `vaults` | The CLI is older than 3.4. | Update it, as in Step 1. |
| A `DEMO_SANDBOX_...` code | No demo sandbox for your person now. | See Step 4, then ask again without it. |
| `401` from the call through OneCLI | The vault has no Test key, which is normal for an account made before the Test key existed. The agent is still connected. | Do not investigate. Say so in your report, and go to Step 7. |
| The new agent is not in `onecli agents list --mine` | The line did not run there yet, or the token expired after 15 minutes. | Make a new token, and run its line again. |
| A gateway answer with `X-OneCLI-Decision: needs_approval` | A person is deciding. The gateway holds the call for up to 3 minutes. | Wait. Do not retry or look for another way round. |
| `X-OneCLI-Decision: blocked` | A rule forbids this call. | Say so. Retrying will not help. |
| `X-OneCLI-Decision: no_credential` | The vault has no item for this host. | Offer the app, as in Step 7. |

## Reference

* The agent guide your instance serves: `GET /v2/skill`
* Every command and flag: [CLI reference](/docs/cli/onecli-cli.md)
* How the gateway adds credentials: [How it works](/docs/how-it-works.md)
* Who may use what: [Agent access](/docs/guides/agent-access.md)


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