> For the complete documentation index, see [llms.txt](/llms.txt).
> A full single-fetch corpus is available at [llms-full.txt](/llms-full.txt).
---
title: Automation & agent commands
description: Reference for driving the CLI from another program - MCP stdio transport, CLI schema introspection, and embedded agent guidance.
category: CLI
last_verified: 2026-07-24
hideRightSidebar: true
---

Three commands exist for scripting the CLI or connecting it to an AI agent rather than a human: **`agnt5 mcp`** exposes AGNT5 as MCP tools over stdio, **`agnt5 schema`** dumps the CLI's own command tree as JSON, and **`agnt5 agent-guide`** prints embedded guidance for driving the CLI.


**Commands**: `agnt5 mcp [options]`, `agnt5 schema [options]`, `agnt5 agent-guide [options]`
**Key flags**: `--services` (mcp), `--command` (schema), `--context` (agent-guide)
**Required**: `agnt5 mcp` needs an API key (`agnt5 auth login` first)


## `agnt5 mcp`

```bash
agnt5 mcp [options]
```

Exposes AGNT5 tools as JSON-RPC 2.0 over stdio — the same tool definitions the AGNT5 MCP HTTP server uses. Reads newline-delimited JSON-RPC requests from stdin and writes responses to stdout; it always speaks raw JSON-RPC regardless of `--output`/`--json`. Requires an API key — run `agnt5 auth login` first.

| Flag | Description |
| --- | --- |
| `--services <name,...>` | Limit exposed tools to these categories: `projects`, `deployments`, `workers`, `runs`, `traces`, `evals`, `experiments`, `scorers`, `quality`. Default: all. |

This is what `agnt5 dev up` starts automatically (unless `--no-mcp` is set) to connect an editor or agent to your local project. Point an MCP-compatible client at the `agnt5 mcp` command directly to use it standalone:

```json
{
  "mcpServers": {
    "agnt5": {
      "command": "agnt5",
      "args": ["mcp", "--services", "runs,traces,deployments"]
    }
  }
}
```

## `agnt5 schema`

```bash
agnt5 schema [options]
```

Emits the CLI's own command tree — names, flags (name, type, default, required), and subcommands — derived directly from the Cobra command definitions. Because it reads the live command tree, it self-updates as commands change, which makes it useful as a machine-readable source of truth for other tools (including doc generators).

| Flag | Description |
| --- | --- |
| `--command <name>` | Scope the output to one top-level command. |

Human-readable output prints an indented tree; `--output json` (or piping the output) emits the structured JSON schema.

```bash
agnt5 schema --command deploy
agnt5 schema --output json > cli-schema.json
```

## `agnt5 agent-guide`

```bash
agnt5 agent-guide [options]
```

Prints embedded guidance for driving the CLI — a `SKILL.md`-style reference bundled into the binary at build time. Useful as system context for an agent that needs to operate `agnt5` on your behalf.

| Flag | Description |
| --- | --- |
| `--context` | Print the full `CONTEXT.md` reference instead of the default `SKILL.md`. |

With `--output json`, returns `{"data": {"file", "content"}}`.

```bash
agnt5 agent-guide
agnt5 agent-guide --context --output json
```

## Next steps

- [All commands](/docs/cli/commands.md): the full command list `agnt5 schema` describes.
- [Local development](/docs/cli/dev.md): `agnt5 dev up` starts the MCP server this page documents.
- [Configuration](/docs/cli/configuration.md): environment variables `agnt5 mcp` and scripted CLI calls both read.
