> ## Documentation Index
> Fetch the complete documentation index at: https://agdiai-597e782f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Automation

# CLI Automation

Use `--non-interactive` to automate `agdi onboard`.

> [!NOTE]
>
> `--json` does not imply non-interactive mode. Use `--non-interactive` (and `--workspace`) for scripts.

## Baseline non-interactive example

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
agdi onboard --non-interactive \
  --mode local \
  --auth-choice apiKey \
  --anthropic-api-key "$ANTHROPIC_API_KEY" \
  --secret-input-mode plaintext \
  --gateway-port 18789 \
  --gateway-bind loopback \
  --install-daemon \
  --daemon-runtime node \
  --skip-skills
```

Add `--json` for a machine-readable summary.

Use `--secret-input-mode ref` to store env-backed refs in auth profiles instead of plaintext values.
Interactive selection between env refs and configured provider refs (`file` or `exec`) is available in the onboarding flow.

In non-interactive `ref` mode, provider env vars must be set in the process environment.
Passing inline key flags without the matching env var now fails fast.

Example:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
agdi onboard --non-interactive \
  --mode local \
  --auth-choice openai-api-key \
  --secret-input-mode ref \
  --accept-risk
```

## Provider-specific examples

> [accordion] Gemini example
>
> ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
> agdi onboard --non-interactive \
>   --mode local \
>   --auth-choice gemini-api-key \
>   --gemini-api-key "$GEMINI_API_KEY" \
>   --gateway-port 18789 \
>   --gateway-bind loopback
> ```

> [accordion] Z.AI example
>
> ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
> agdi onboard --non-interactive \
>   --mode local \
>   --auth-choice zai-api-key \
>   --zai-api-key "$ZAI_API_KEY" \
>   --gateway-port 18789 \
>   --gateway-bind loopback
> ```

> [accordion] Vercel AI Gateway example
>
> ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
> agdi onboard --non-interactive \
>   --mode local \
>   --auth-choice ai-gateway-api-key \
>   --ai-gateway-api-key "$AI_GATEWAY_API_KEY" \
>   --gateway-port 18789 \
>   --gateway-bind loopback
> ```

> [accordion] Cloudflare AI Gateway example
>
> ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
> agdi onboard --non-interactive \
>   --mode local \
>   --auth-choice cloudflare-ai-gateway-api-key \
>   --cloudflare-ai-gateway-account-id "your-account-id" \
>   --cloudflare-ai-gateway-gateway-id "your-gateway-id" \
>   --cloudflare-ai-gateway-api-key "$CLOUDFLARE_AI_GATEWAY_API_KEY" \
>   --gateway-port 18789 \
>   --gateway-bind loopback
> ```

> [accordion] Moonshot example
>
> ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
> agdi onboard --non-interactive \
>   --mode local \
>   --auth-choice moonshot-api-key \
>   --moonshot-api-key "$MOONSHOT_API_KEY" \
>   --gateway-port 18789 \
>   --gateway-bind loopback
> ```

> [accordion] Mistral example
>
> ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
> agdi onboard --non-interactive \
>   --mode local \
>   --auth-choice mistral-api-key \
>   --mistral-api-key "$MISTRAL_API_KEY" \
>   --gateway-port 18789 \
>   --gateway-bind loopback
> ```

> [accordion] Synthetic example
>
> ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
> agdi onboard --non-interactive \
>   --mode local \
>   --auth-choice synthetic-api-key \
>   --synthetic-api-key "$SYNTHETIC_API_KEY" \
>   --gateway-port 18789 \
>   --gateway-bind loopback
> ```

> [accordion] OpenCode example
>
> ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
> agdi onboard --non-interactive \
>   --mode local \
>   --auth-choice opencode-zen \
>   --opencode-zen-api-key "$OPENCODE_API_KEY" \
>   --gateway-port 18789 \
>   --gateway-bind loopback
> ```
>
> Swap to `--auth-choice opencode-go --opencode-go-api-key "$OPENCODE_API_KEY"` for the Go catalog.

> [accordion] Ollama example
>
> ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
> agdi onboard --non-interactive \
>   --mode local \
>   --auth-choice ollama \
>   --custom-model-id "qwen3.5:27b" \
>   --accept-risk \
>   --gateway-port 18789 \
>   --gateway-bind loopback
> ```

> [accordion] Custom provider example
>
> ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
> agdi onboard --non-interactive \
>   --mode local \
>   --auth-choice custom-api-key \
>   --custom-base-url "https://llm.example.com/v1" \
>   --custom-model-id "foo-large" \
>   --custom-api-key "$CUSTOM_API_KEY" \
>   --custom-provider-id "my-custom" \
>   --custom-compatibility anthropic \
>   --gateway-port 18789 \
>   --gateway-bind loopback
> ```
>
> `--custom-api-key` is optional. If omitted, onboarding checks `CUSTOM_API_KEY`.
>
> Ref-mode variant:
>
> ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
> export CUSTOM_API_KEY="your-key"
> agdi onboard --non-interactive \
>   --mode local \
>   --auth-choice custom-api-key \
>   --custom-base-url "https://llm.example.com/v1" \
>   --custom-model-id "foo-large" \
>   --secret-input-mode ref \
>   --custom-provider-id "my-custom" \
>   --custom-compatibility anthropic \
>   --gateway-port 18789 \
>   --gateway-bind loopback
> ```
>
> In this mode, onboarding stores `apiKey` as `{ source: "env", provider: "default", id: "CUSTOM_API_KEY" }`.

## Add another agent

Use `agdi agents add <name>` to create a separate agent with its own workspace,
sessions, and auth profiles. Running without `--workspace` launches the wizard.

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
agdi agents add work \
  --workspace ~/.agdi/workspace-work \
  --model openai/gpt-5.2 \
  --bind whatsapp:biz \
  --non-interactive \
  --json
```

What it sets:

* `agents.list[].name`
* `agents.list[].workspace`
* `agents.list[].agentDir`

Notes:

* Default workspaces follow `~/.agdi/workspace-<agentId>`.
* Add `bindings` to route inbound messages (the wizard can do this).
* Non-interactive flags: `--model`, `--agent-dir`, `--bind`, `--non-interactive`.

## Related docs

* Onboarding hub: [Onboarding (CLI)](https://agdiai-597e782f.mintlify.site/start/wizard.md)
* Full reference: [CLI Setup Reference](https://agdiai-597e782f.mintlify.site/start/wizard-cli-reference.md)
* Command reference: [`agdi onboard`](https://agdiai-597e782f.mintlify.site/cli/onboard)


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