> For the complete documentation index, see [llms.txt](https://docs.sail.money/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sail.money/sailor/guides/ci.md).

# Automate & run unattended

Once `sailor run --once` works, you can run the agent on a schedule or as a long-lived loop. The scaffold's `sailor-automation` skill offers **four options**, by reliability and infra overhead:

1. **GitHub Actions** (cloud runner, zero infra) — the scaffold's `.github/workflows/agent-tick.yml` runs `sailor run --once` on a cron; `sailor trigger github` fires it on demand. Simplest, but cron timing drifts.
2. **Self-hosted runner** — the same workflow on your own machine for reliable timing.
3. **Docker** — the `sailmoney/sailor` image on any VM or cloud, via a container registry (see [Docker](/sailor/docker.md)).
4. **Local daemon** — `sailor service install` registers an OS service (launchd / systemd / Task Scheduler) that restarts on crash; `sailor service status`/`stop`/`logs`/`uninstall` manage it. No Docker required.

The rest of this page details option 1 (GitHub Actions), the zero-infra default.

## GitHub Actions — one-time setup

**1. Export the CI keystore.**

```bash
sailor keys export-ci
```

This copies the **encrypted** agent-wallet keystore to `ci-keystore.json` in the project root and allowlists it in `.gitignore`. The geth v3 keystore is safe to commit — the raw private key is never exposed; it can only be unlocked with the passphrase.

**2. Commit the files the runner needs.**

```
ci-keystore.json
.sail/account.json
.sail/mandate.json
```

**3. Add two repository secrets** (Settings → Secrets and variables → Actions):

| Secret            | Value                                         |
| ----------------- | --------------------------------------------- |
| `SAIL_PASSPHRASE` | the passphrase that encrypts the agent wallet |
| `RPC_URL`         | your RPC endpoint for the agent's chain       |

## How the workflow runs

On each scheduled tick the workflow copies `ci-keystore.json` to `.sail/keys/manager.json`, then runs `npx sailor run --once` with `SAIL_PASSPHRASE` set so the manager key is unlocked non-interactively. **No private key ever appears in the workflow file or in the secrets** — only the passphrase and RPC URL do, and the keystore is encrypted.

```yaml
# .github/workflows/agent-tick.yml (provided by the scaffold) runs, roughly:
#   - npm ci
#   - cp ci-keystore.json .sail/keys/manager.json
#   - npx sailor run --once     # env: SAIL_PASSPHRASE, RPC_URL
```

Fire it manually without waiting for the cron:

```bash
sailor trigger github --reason "manual tick"
```

## Safety notes

* The agent in CI is still bounded by the on-chain mandate — CI cannot make it exceed its permissions.
* You can [pause](/sailor/cli.md) the session at any time (`sailor session pause`); a paused session makes every scheduled tick a no-op until you resume.
* Never commit `SAIL_PASSPHRASE` or any raw private key. Only the **encrypted** `ci-keystore.json` is committed.

The `sailor-automation` skill walks through all four options if you're [operating via a coding agent](/sailor/getting-started/coding-agent.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sail.money/sailor/guides/ci.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
