# Headless runs and CI

> Run one agent without a terminal UI with raptor run, for scripts and CI. Progress goes to stderr, the answer to stdout, and failures exit non-zero.

`raptor run` runs a single agent to completion without the REPL or the dashboard. It is built for scripts, git hooks and CI.

```bash
raptor run "Fix the failing test in src/parser.rs"
raptor run --model deepseek-flash --effort high "Add a --json flag to the export command"
raptor run --yes "Upgrade the dependencies and make the build pass"
```

## Options

- `task` (string):
What the agent should do, as one quoted argument. It works in the current directory.
- `--model` (model id), default `from RAPTOR_MODEL or /model`:
The DeepSeek model for this run, for example `deepseek-flash`. See [choose a model](https://raptorcode.dev/docs/deepseek#choose-a-model).
- `--effort` (low | high | max), default `max`:
The thinking effort for this run.
- `--yes` (flag):
Approve every action that would ask for confirmation in the REPL. Without it, those actions are declined.

## How it behaves

- **Running the command is the consent.** The agent works in the current directory with the same tools as the REPL agent, under a [tool policy](https://raptorcode.dev/docs/security#tool-policy) rooted there.
- **Nobody answers confirmations.** Privileged, network and power commands, force pushes, shells reading stdin, force deletes outside the workspace and the first write outside the directory are declined and reported to the model, which has to find another way. `--yes` approves them instead, and each automatic decision is logged on stderr.
- **Hard denials stay denied**, with or without `--yes`.
- **Output is split.** Progress, tool calls, policy decisions and retries go to stderr; only the final answer goes to stdout. At the end, it prints the input, cached and output token totals.
- **Failures exit non-zero**, including a run that stops at the 100-step limit. Work done so far stays on disk.

> **Warning:** `--yes` gives the agent everything the user running it can do, except the hard denials. Use it in disposable environments such as CI runners or containers, not on a machine with credentials you care about.

## Use the answer in a script

Because only the answer goes to stdout, you can capture it directly:

```bash
raptor run "Summarise what changed in this branch compared with main" > summary.md
```

To give the agent an isolated branch, create a [task worktree](https://raptorcode.dev/docs/tasks#single-task-worktrees) and run it from there:

```bash
raptor task "Add router tests"
cd .raptor/worktrees/<task-id>
raptor run "Add tests for the router's error paths"
```

## Run in CI

Set `DEEPSEEK_API_KEY` from a secret. This GitHub Actions job installs the latest Linux package and runs one task:

```yaml .github/workflows/raptor.yml
name: raptor
on: workflow_dispatch

jobs:
  agent:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install RaptorCode
        run: |
          gh release download --repo RaptorLabsHQ/raptorcode --pattern '*_amd64.deb'
          sudo apt-get install -y ./raptor-code_*_amd64.deb
        env:
          GH_TOKEN: ${{ github.token }}
      - name: Run the agent
        run: raptor run "Fix the failing tests" > answer.md
        env:
          DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
```

With `CI=true`, which most CI systems set:

- output is plain;
- `raptor` prints its startup line instead of opening the REPL;
- `raptor tui` prints a snapshot;
- `raptor swarm run` refuses to start, because its confirmations need the dashboard. Use `raptor run` in CI.

> **Tip:** Review what a CI run changed before you merge it, like any other pull request. A headless agent is still a model acting on your repository.
