# Agent Zero Headless

Use `a0 headless` when the user wants another Agent Zero runtime to help, or as a secondary use case when this same Agent Zero instance should ask itself a focused question through the local headless interface.

A0 is the setup exception. Do not run a generic login flow. If the user did not specify the target, ask whether they want to use this same Agent Zero instance or another/spun-up instance. For another instance, ask for or use a configured host. For protected hosts, use configured shell environment credentials when present.

Avoid recursive loops. Tell the target Agent Zero instance to answer directly and not to delegate back through terminal agents.

## Install And Probe

```bash
command -v a0 >/dev/null || test -x /opt/venv/bin/a0
a0 --help >/dev/null || /opt/venv/bin/a0 --help >/dev/null
```

## New Chat

```bash
cd "$WORKDIR"
a0 headless --host http://localhost:80 --no-docker-discovery --output jsonl --new-chat --workspace "$WORKDIR" -p "$TASK"
```

Use a configured remote host instead of `http://localhost:80` when the settings screen or user provides one.

## Continue Chat

```bash
a0 headless --host "$A0_HOST" --no-docker-discovery --output jsonl --chat "$CONTEXT_ID" --workspace "$WORKDIR" -p "$TASK"
```

For protected hosts, use the CLI's supported environment variables, for example `A0_USERNAME` and `A0_PASSWORD`, rather than inventing username/password flags.
