# `alphaavatar start`

Start an Avatar: on the Host that runs for the application home, or on a Host of its own.

```bash
alphaavatar start [<bundle> | <file>] [KEY=VALUE ...]
```

- **A Host runs** ([`alphaavatar host start`](https://docs.alphaavatar.io/en/v0.7.0/cli/host.md)): start asks it for the Avatar, shows its
  progress, then follows it in the foreground. Ctrl+C or SIGTERM stops that Avatar; the Host keeps
  running. An Avatar already running there is refused: stop it first.
- **None runs**: start runs a Host in this process, its management service included, and the
  Avatar in it. The Host lives as long as its Avatar: Ctrl+C or SIGTERM stops both, as does the
  Avatar stopping or failing. See [who starts what](https://docs.alphaavatar.io/en/v0.7.0/cli/host.md#who-starts-what-and-what-stops-it).
- Loads a bundle by name, a YAML/JSON file, or the default bundle when omitted; see
  [choosing a configuration](https://docs.alphaavatar.io/en/v0.7.0/cli/config.md#choosing-a-configuration).
- Reads each variable from the environment, then `.env` (`ENV_FILE`), then the credentials
  [`alphaavatar setup`](https://docs.alphaavatar.io/en/v0.7.0/cli/setup.md) stored; see [credentials](https://docs.alphaavatar.io/en/v0.7.0/cli/config.md#credentials).
- INFO logging; health server on `127.0.0.1:8081`; its own Host's management service on
  `127.0.0.1:8091` ([settings](https://docs.alphaavatar.io/en/v0.7.0/cli/host.md#settings)), or the local socket alone when that port is
  taken.
- Creates the application home and Avatar workspace on first run.
- Ctrl+C or SIGTERM stops it after every owned resource is released.
- Validates the configuration before starting; [`alphaavatar config check`](https://docs.alphaavatar.io/en/v0.7.0/cli/config.md#config-check) runs the same validation without starting.

| Exit code | Meaning |
| --- | --- |
| 0 | Stopped normally |
| 1 | Failed while running; on a running Host, also a refused start (an Avatar runs there) |
| 2 | Configuration or startup error |
| 130 | Interrupted |

Either way the reason a start failed is the same, stage and diagnostic; on a running Host it stays
queryable (`alphaavatar host status`) and the start can be retried there.

For development, use [`alphaavatar dev`](https://docs.alphaavatar.io/en/v0.7.0/cli/dev.md).
