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

> ## Agent Instructions
> These docs describe the Ancha CLI, npm package @ancha-labs/cli version 0.1.4, and the hosted workspace at app.ancha.io. Coding agents should start at https://docs.ancha.io/coding-agents. Run the CLI as `ancha` after `npm install -g @ancha-labs/cli`, or as `npx -y @ancha-labs/cli@0.1.4` without installing. Pass --json for machine-readable output, or set ANCHA_JSON=1. Every command ends with a `next:` line naming the next command. Exit codes: 0 pass, 1 a check failed or a comparison regressed, 2 usage, config or authentication error, 3 infrastructure error, 4 unimplemented endpoint with --strict.

# ancha wait

> Follow a run until it finishes and exit with the run's own exit code. Stopping wait leaves the run running.

`ancha wait` follows a run started with `ancha run --detach` and returns when it finishes, with the same exit code `ancha run` would have returned.

```bash theme={null}
ancha wait [options] <id>
```

| Argument | Description |
| - | - |
| `id` | Run id |

| Option | Description |
| - | - |
| `--out <dir>` | Run directory (default: .ancha/runs) |

## Example

```bash theme={null}
ancha run -n 3 --detach --json   # {"event":"run_detached","runId":"run_..."}
ancha wait run_20261031-070757_e0649a40912674ba
```

```text Output theme={null}
✓ starter  3/3 (100%)

agent not sealed: network open; environment limited to 9 variables from this shell (pass more with --pass-env NAME)
pass (minimum pass rate 100%)  run run_20261031-070757_e0649a40912674ba
next: ancha baseline save before
```

With `--json`, `wait` prints progress events and then the same `run_finished` summary as `ancha run --json`. To see the raw events as they happen, use [`ancha logs <id> --follow`](https://docs.ancha.io/cli/logs) instead.

Pressing Ctrl-C stops `wait` only. The run keeps going; call `wait`, `logs` or `status` again later.

## Exit codes

The run's own exit code: `0`, `1`, `2`, `3` or `4`. See [`ancha run`](https://docs.ancha.io/cli/run#exit-codes).


## Related topics

- [ancha run](https://docs.ancha.io/cli/run.md)
- [Troubleshooting](https://docs.ancha.io/troubleshooting.md)
- [Attempts and runs](https://docs.ancha.io/concepts/attempts-and-runs.md)
- [CLI overview](https://docs.ancha.io/cli/overview.md)
- [ancha agent](https://docs.ancha.io/cli/agent.md)


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