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

# Agentrail CLI

> Use Agentrail from a terminal or a coding agent: sign in once, then run every Agentrail tool your role can use as a command.

The Agentrail CLI, `agentrail`, brings Agentrail to your terminal. Every Agentrail tool your role can use is a command, such as `agentrail simulations list-runs` or `agentrail readiness start-scan`, so you and the coding agents you work with can read results and act on them without opening Agentrail. One more command sets up Claude Code, Codex and Cursor to use Agentrail.

## Install it

The CLI needs Node.js 22 or later.

```sh theme={null}
npm install -g agentrail-cli@latest
```

It installs one command, `agentrail`. Install the package `agentrail-cli`: a package named just `agentrail` is not Agentrail's.

## Sign in

```sh theme={null}
agentrail login
```

The CLI opens Agentrail's sign-in page in your browser and prints a code. Check that the page shows the same code, confirm it, and the terminal says who you are signed in as.

The sign-in is kept in your operating system's keychain and renewed as you use it. It appears in **Settings · Agents** under **Your connections**, connected through **CLI**.

A coding agent that runs the CLI has no terminal for you to type in, so it signs in in two steps. See [Sign in without a terminal](https://agentrail.co/docs/cli/coding-agents.md#sign-in-without-a-terminal).

## Run your first commands

```sh theme={null}
agentrail tools
agentrail workspaces list
agentrail simulations list-runs --status failed --limit 5
```

`agentrail tools` lists every command your role can use. Commands act in your default workspace unless you choose another: see [Choose a workspace](https://agentrail.co/docs/cli/commands.md#choose-a-workspace).

## Check your setup

```sh theme={null}
agentrail doctor
```

It checks your Node.js version, that Agentrail can be reached, your sign-in, the commands available to you and this directory's workspace link, and says what to fix.

## Stay up to date

Once a day, a command also checks npm for a newer CLI and, when there is one, says so after its output. `agentrail update` checks now and prints the command that updates. If Agentrail needs a newer CLI than yours, commands stop with exit code 2 and say how to update.

## Sign out

`agentrail logout` removes the sign-in from this computer. To stop it at once, wherever it is used, disconnect **Agentrail CLI** in **Settings · Agents** under **Your connections**.

## Next

> [card] [Commands](https://agentrail.co/docs/cli/commands.md)
>
> Every command, its inputs, workspaces and output.

> [card] [Coding agents](https://agentrail.co/docs/cli/coding-agents.md)
>
> Set up Claude Code, Codex and Cursor, and let agents run the CLI.

> [card] [Reference](https://agentrail.co/docs/cli/reference.md)
>
> Options, environment variables, files and exit codes.


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