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

# Nonhumans CLI: Scaffold, Deploy, and Manage Agents

> Use the Nonhumans CLI to scaffold agent projects, manage deployments, tail logs, inspect email and wallet, and control secrets from any terminal.

The Nonhumans CLI is the fastest way to go from zero to a running agent. Use it to scaffold new projects, push deployments, tail logs, inspect your agent's inbox and wallet, and manage secrets — all without leaving your terminal. It pairs with both the TypeScript and Python SDKs and works equally well in local development and CI pipelines.

## Installation

```bash theme={null}
# Use without installing — always runs the latest version
npx nonhumans

# Or install globally for a persistent command
npm install -g @nonhumans/cli
```

<Tip>
  Running via `npx nonhumans` guarantees you are always on the latest CLI version with no manual upgrade step. Use the global install when you want tab completion or a fixed version in CI.
</Tip>

***

## Authentication

Before running any command, authenticate the CLI with your Nonhumans account:

```bash theme={null}
npx nonhumans login
```

This opens your browser to complete OAuth. Once you approve, the CLI stores a local token at `~/.nonhumans/credentials` and all subsequent commands use it automatically.

<Note>
  In headless environments (CI, Docker), pass your API key via the `--api-key` flag or the `NONHUMANS_KEY` environment variable instead of running `login`.
</Note>

***

## Command reference

### `nonhumans init [name]`

Scaffold a new agent project in the current directory (or a named subdirectory). Creates a project structure with a starter agent file, a `nonhumans.json` config, and an example `.env`.

```bash theme={null}
npx nonhumans init my-agent
```

### `nonhumans deploy`

Build and push your agent to always-on compute. The CLI reads your `nonhumans.json` for the entry point and runtime, then streams build output to your terminal.

```bash theme={null}
npx nonhumans deploy
```

### `nonhumans status`

Check the current runtime status of your deployed agent — whether it is running, sleeping, or in an error state.

```bash theme={null}
npx nonhumans status
```

### `nonhumans logs`

Tail live log output from your running agent. Press `Ctrl+C` to stop streaming.

```bash theme={null}
npx nonhumans logs
npx nonhumans logs --since 1h   # show logs from the last hour
```

### `nonhumans email`

Inspect your agent's email inbox from the terminal. Lists recent messages with sender, subject, and timestamp.

```bash theme={null}
npx nonhumans email              # list inbox
npx nonhumans email read <id>    # print a single message body
```

### `nonhumans wallet`

Check balances and send payments without opening a dashboard.

```bash theme={null}
npx nonhumans wallet balance              # show all balances
npx nonhumans wallet send \
  --to 0xAbC123... \
  --amount 50 \
  --currency usdc \
  --memo "Payout March"
```

### `nonhumans memory`

Search and inspect everything stored in your agent's vector memory.

```bash theme={null}
npx nonhumans memory search "email preferences"
npx nonhumans memory list --limit 20
```

### `nonhumans vault set/get`

Store and retrieve secrets without touching the dashboard.

```bash theme={null}
npx nonhumans vault set stripe_key sk_live_...
npx nonhumans vault get stripe_key
npx nonhumans vault list            # show all key names (values hidden)
npx nonhumans vault delete stripe_key
```

### `nonhumans agents list`

List every agent associated with your account, along with their handle, status, and creation date.

```bash theme={null}
npx nonhumans agents list
```

***

## Global flags

Every command accepts these flags:

| Flag              | Description                                                      |
| ----------------- | ---------------------------------------------------------------- |
| `--api-key <key>` | Override the stored credential with a specific API key.          |
| `--output json`   | Print output as JSON — ideal for scripting and piping into `jq`. |
| `--help`          | Print usage information for any command.                         |

<Tip>
  Combine `--output json` with `jq` to build powerful shell pipelines:

  ```bash theme={null}
  npx nonhumans wallet balance --output json | jq '.usdc'
  ```
</Tip>

***

## From `init` to `deploy` — step by step

The following walkthrough takes you from a blank directory to a live, always-on agent in under five minutes.

<Steps>
  <Step title="Authenticate">
    Log in to your Nonhumans account. The CLI stores your token locally.

    ```bash theme={null}
    npx nonhumans login
    ```
  </Step>

  <Step title="Scaffold your project">
    Create a new agent project. Replace `my-agent` with your desired handle.

    ```bash theme={null}
    npx nonhumans init my-agent
    cd my-agent
    ```

    The scaffolded directory looks like this:

    ```
    my-agent/
    ├── agent.ts          # entry point
    ├── nonhumans.json    # project config
    ├── package.json
    └── .env.example
    ```
  </Step>

  <Step title="Set your API key">
    Copy `.env.example` to `.env` and paste your API key.

    ```bash theme={null}
    cp .env.example .env
    # Edit .env and set NONHUMANS_KEY=your_key_here
    ```
  </Step>

  <Step title="Write your agent logic">
    Open `agent.ts` and build your agent using the SDK. The scaffold includes a minimal example to get you started.

    ```typescript theme={null}
    import { Nonhumans } from '@nonhumans/sdk'

    const agent = new Nonhumans({ apiKey: process.env.NONHUMANS_KEY })

    export default async function run() {
      const emails = await agent.email.list({ unread: true })
      console.log(`Inbox has ${emails.length} unread message(s).`)
    }
    ```
  </Step>

  <Step title="Deploy to always-on compute">
    Push your agent. The CLI bundles your code, uploads it, and starts the runtime.

    ```bash theme={null}
    npx nonhumans deploy
    ```

    You will see streaming build output. A successful deploy prints your agent's public URL:

    ```
    ✓ Build complete
    ✓ Agent live at https://my-agent.nonhumans.ai
    ```
  </Step>

  <Step title="Verify it is running">
    Confirm the deployment and watch live logs.

    ```bash theme={null}
    npx nonhumans status
    npx nonhumans logs
    ```
  </Step>
</Steps>

***

## Next steps

<CardGroup cols={2}>
  <Card title="TypeScript SDK" icon="js" href="/sdk/typescript">
    Explore all SDK modules — email, wallet, memory, compute, and more.
  </Card>

  <Card title="Python SDK" icon="python" href="/sdk/python">
    Build agents in Python with sync and async support.
  </Card>
</CardGroup>
