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

# Quickstart

> Start axed in Docker, run a long job, disconnect, replay its output from an offset, and open a shell.

In about five minutes you will start axed with a token, run a job that keeps running after you disconnect, replay its output from a byte offset, and open an interactive shell. Everything runs in Docker, so it works on Linux and macOS.

You need Docker and `openssl`.

**1. Get the image**

Pull the default image and tag it `axe` for the commands below. It holds both binaries: the `axed` daemon and the `axectl` CLI.

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
docker pull ghcr.io/vincent0426/axe:latest
docker tag ghcr.io/vincent0426/axe:latest axe
```

To build it from a checkout instead, run `docker build -t axe .` in the repository. See [Installation](https://axe-engine.mintlify.site/installation.md).

**2. Start axed with a token**

Create a Docker network and a random token, then start axed with the token mounted as a file.

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
docker network create axe
echo -n "$(openssl rand -hex 16)" > token
docker run -d --name axed --network axe -v "$PWD/token:/run/token:ro" \
  axe --auth-token-file /run/token
```

The image runs as user 1000, so the token file must be readable by it. axed serves its native API on port 9090. It logs `cgroups unavailable; using process groups and rlimits`, which is expected in a container without a delegated cgroup. See [Containers and hosts](https://axe-engine.mintlify.site/deploy/containers.md) if you want cgroups.

**3. Define the axectl wrapper**

Run `axectl` in a container on the same network. This shell function passes the address and token for you.

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axectl() {
  docker run --rm -it --detach-keys=ctrl-] --network axe --entrypoint axectl \
    -e AXE_ADDR=axed:9090 -e AXE_TOKEN="$(cat token)" axe "$@"
}
axectl info
```

`axectl info` prints the daemon's version, instance id, and limits. In a script or CI job with no terminal, use `-i` instead of `-it`.

> [!TIP]
>
> On Linux you can run `axectl` on the host instead. Start axed with `-p 9090:9090` added to `docker run` so the port is published, copy `/usr/local/bin/axectl` out of the image with `docker create` and `docker cp` (as [Installation](https://axe-engine.mintlify.site/installation.md#the-static-binaries) does from the `static` image), and set `AXE_ADDR=127.0.0.1:9090` and `AXE_TOKEN="$(cat token)"`.

**4. Start a long job**

`axectl run` starts a detached process and prints its id. The process keeps running after `axectl` exits.

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axectl run --name build -- sh -c 'for i in $(seq 1 300); do echo step $i; sleep 1; done'
```

You have now disconnected. The client is gone, and the job is still running inside the sandbox.

**5. Check on it**

List processes. The `OUTPUT` column is the number of bytes the process has written so far. `CPU` and `MEM` end in `*` because, without a cgroup, they cover only the leader.

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axectl ps
```

```text theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
ID                                NAME         PID      STATE      EXIT      CPU       MEM    OUTPUT  COMMAND
3488d52e997f479ea52172b7bef35c29  build        19       running    -        0.0*   1.2MiB*        35  sh -c for i in $(seq 1 300); do echo step $i; sleep 1; done
```

Print everything retained so far with `axectl logs build`.

**6. Replay from an offset**

Pass the byte count you noted back with `--from` to get only what came after it. This is how a client that reconnects picks up where it left off.

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axectl logs --from 35 build
```

axed keeps the newest 1 MiB of output per process by default (`--retain`). If the bytes you ask for were already evicted, you get the rest along with a note of how many bytes were dropped. See [Output and replay](https://axe-engine.mintlify.site/processes/output.md).

**7. Follow live output**

Add `-f` to keep following. Ctrl-C stops following, not the process.

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axectl logs -f build
```

**8. Open a shell**

Start a shell with a terminal (`-t`) and attach to it (`-a`). Ctrl-P Ctrl-Q detaches and leaves it running.

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axectl run -t -a --name shell -- bash
```

Reattach later with `axectl attach -i shell`. Docker claims Ctrl-P Ctrl-Q for itself, which is why the wrapper sets `--detach-keys`. See [Terminals](https://axe-engine.mintlify.site/processes/terminals.md).

**9. Kill the job and read its exit code**

`axectl kill` sends SIGTERM to the process group. `axectl wait` exits with the process's exit code.

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axectl kill build
axectl wait build; echo $?
```

`axectl wait` prints `signaled 143`, and `echo` prints `143`. A process killed by a signal reports 128 plus the signal number, and SIGTERM is 15. Remove the finished record with `axectl rm build`.

**10. Clean up**

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
docker rm -f axed
docker network rm axe
rm token
```

## Next steps

> [card] [Architecture](https://axe-engine.mintlify.site/architecture.md)
>
> How axed, the adapters and the engine fit together.

> [card] [Replace sandboxd](https://axe-engine.mintlify.site/deploy/agent-sandbox.md)
>
> Run AXE in Kubernetes Agent Sandbox.

> [card] [Run processes](https://axe-engine.mintlify.site/processes/run.md)
>
> Names, labels, limits, timeouts and attached runs.

> [card] [axectl reference](https://axe-engine.mintlify.site/reference/axectl.md)
>
> Every command and flag.


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