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

# Use from AI Agents

> The contract that makes brew-cli dependable inside Claude, Codex, and other coding agents: automatic JSON, semantic exit codes, and a confirmation protocol that never hangs.

The CLI treats agents as first-class users. Where the [MCP server](/api-reference/mcp/overview) gives an agent tools over a protocol, the CLI gives any harness that can run shell commands the same reach: composable, pipeable, and cheap on context.

## The Contract

* **JSON without asking.** When stdout is not a terminal (which is every agent), commands print the exact API response as one JSON line. Errors are JSON envelopes on stderr with stable `code` fields and a `requestId`.
* **Semantic exit codes.** `0` success, `1` API or runtime error, `2` usage error, `3` authentication error, `4` confirmation required. Unknown commands fail hard with no fuzzy "did you mean" to misread.
* **Never hangs.** Nothing waits on stdin unless it is a real terminal. Missing input is an immediate exit 2 with the fix in the message.
* **Stable surface.** Commands and flags are additive across releases, and the [manifest](#discovery-for-agents) describes the installed build exactly.

## The Confirmation Protocol

Irreversible commands (campaign sends, deletes, trigger fires, cancels) do not execute in a non-interactive session. They exit with code 4 and print an envelope:

```json theme={null}
{
  "confirmationRequired": true,
  "command": "brew-cli emails send",
  "summary": "Send email eml_123 as a REAL campaign to audience aud_9 now. Real recipients receive it; this cannot be undone.",
  "confirmCommand": "brew-cli emails send eml_123 --subject 'Fall sale' --audience aud_9 --domain dom_1 --yes"
}
```

The intended flow: show the `summary` to your human, and only run the `confirmCommand` after they approve. Passing `--yes` yourself is reserved for actions the user already asked for explicitly. Test sends (`emails send --test --to you@example.com`) are the safe lane and skip the gate.

## Discovery for Agents

```bash theme={null}
brew-cli docs --agent
```

Prints a JSON manifest of every command: path, summary, flags, safety class, whether it needs confirmation, and the API route behind it. Pair it with `brew-cli docs api` (the live `GET /v1/help` catalog) and the served agent guide at `https://brew.new/api/v1/llms.txt`.

The repo also ships a ready-made skill at [`skills/brew-cli/SKILL.md`](https://github.com/GetBrew/brew-cli/blob/main/skills/brew-cli/SKILL.md) that teaches Claude Code and compatible harnesses this whole contract in about fifty lines.

## A Typical Agent Session

```bash theme={null}
brew-cli contacts count --json
brew-cli emails generate --prompt "Welcome email for new signups" --json
brew-cli emails send eml_abc --test --to qa@yourteam.com --subject "Preview"
brew-cli analytics overview --since 2026-08-01T00:00:00Z --json
```

Reads flow freely, generation is metered by [credits](/api-reference/api/credits), and the one real send in the session was a test delivery to your own inbox.

## Need Help?

Our team is ready to support you at every step of your journey with Brew. Choose the option that works best for you:

<Tabs>
  <Tab title="Self-Service Tools">
    <CardGroup cols="2">
      <Card title="Search Documentation" icon="magnifying-glass" color="#c44925">
        Type in the "Ask any question" search bar at the top left to instantly find relevant documentation pages.
      </Card>

      <Card title="ChatGPT/Claude Integration" icon="robot" color="#c44925">
        Click "Open in ChatGPT" at the top right of any page to explore it further with ChatGPT or Claude.
      </Card>
    </CardGroup>
  </Tab>

  <Tab title="Talk to Our Team">
    <CardGroup cols="2">
      <Card title="Schedule a Call" icon="calendar" color="#c44925" href="https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ1iYoRUG1J792XQpbuQLjSRRDupr7MwraFK-HQRCtTYdBmrQi8nZu2qXfzKQigb8gbKJK3KN3-R">
        Book time with our founders for personalized guidance on strategy, best practices, or complex implementation questions.
      </Card>

      <Card title="Call Us Directly" icon="phone" color="#c44925">
        Need immediate assistance? Reach us at **+1-(332)-203-2145** for urgent issues or time-sensitive questions.
      </Card>

      <Card title="Slack Channel" icon="slack" color="#c44925">
        Our preferred support channel. You'll receive an invite after signup for direct founder support and fast responses.
      </Card>

      <Card title="Email Support" icon="envelope" color="#c44925" href="mailto:support@brew.new">
        Contact us at **[support@brew.new](mailto:support@brew.new)** for detailed inquiries or if you prefer not to use Slack.
      </Card>
    </CardGroup>
  </Tab>
</Tabs>
