# Autopilot for background coding agents

URL: https://codepanel.ai/agent-autopilot

Start coding agent runs automatically on CI failures, blocked or stalled pull requests, Dependabot updates, issue labels, cron schedules, or webhooks.

CodePanel Autopilot starts coding agent runs automatically when events happen on a connected repository: a workflow fails on `main` or a pull request, a review blocks or stalls, Dependabot opens a dependency update, an issue receives a label, a cron schedule fires, or an authenticated webhook arrives. Every rule is bounded by spend caps, offline-by-default sandboxing, a three-failure circuit breaker, and a four-gate kill switch.

## Eight event triggers

Each autopilot rule watches one or all connected repositories and fills a validated prompt template from the triggering event:

| Trigger | When it fires | Debounce / setting |
| --- | --- | --- |
| `ci_failed` | A GitHub Actions workflow on the default branch ends `failure`, `timed_out`, or `startup_failure`. | 60 s debounce so a burst settles into one task. |
| `pr_ci_failed` | A workflow on a same-repo pull request branch fails. | Works from the PR head and pushes to its branch. |
| `review_blocked` | A CodePanel review posts blocking findings on a pull request. | Passes the blocking findings and finding refs to the agent. |
| `pr_stalled` | An open pull request has open CodePanel findings and no push since its review. | Configurable `idleMinutes` (15 to 10,080; default 90). |
| `dependabot_pr` | Dependabot opens a pull request. | 30 s debounce; pushes onto the PR branch when possible. |
| `issue_labeled` | An issue receives a configured label (default `agent`). | 30 s debounce; passes the issue number, title, and URL. |
| `schedule` | A five-field UTC cron schedule comes round (up to 4 times an hour). | Required cron expression, such as `0 2 * * *`. |
| `webhook` | An authenticated HTTP POST arrives at the rule's bearer-protected URL. | Passes the event source, title, severity, and payload. |

Every trigger ships with a default prompt, and any unknown placeholder is rejected on save so a misspelling never reaches an agent. See the full reference in [Autopilot docs](/docs/autopilot).

## Built-in safety for unattended runs

Trigger text such as an issue title or webhook payload can originate from outside your team, so rule-started runs start under stricter defaults than tasks you launch by hand:

- **Untrusted text fenced as data:** Event fields are marked as data, not instructions.
- **No network by default:** On macOS and Linux, a rule-started run has no network access at all, including during dependency installation, unless you explicitly allow it for that repository in Settings. Dependencies install offline from your package cache; if offline install cannot finish, the run pauses in your Inbox as `Needs network`.
- **Strict command permissions:** Runs start in `strict` mode, and any edit to a script-defining file (`package.json`, a `Makefile`, `scripts/`) forces the next script command to ask for confirmation again.
- **Three-failure circuit breaker:** After 3 consecutive failures, a rule disables itself automatically and opens a `Rule off` item in your Inbox explaining why.
- **No silent auto-merge:** Autopilot opens or updates pull requests for the [review panel](/ai-code-review); merging stays under your repository rules.

## Spend caps and concurrency limits

Every rule enforces layered caps at the model proxy before any provider call is dispatched:

| Guardrail | Default | Configurable range |
| --- | --- | --- |
| Per-task cap (`taskUsd`) | $2 | $0.10 to $50 |
| Per-rule daily cap (`dayUsd`) | $10 | $0.10 to $500 (at least `taskUsd`) |
| Account daily agent cap | $25 | Up to $1,000 per UTC day across all runs |
| Per-ticket cap | Off | Up to $1,000 across all runs sharing a ticket id |
| Rule concurrency (`maxConcurrent`) | 2 | 1 to 10 tasks at once per rule |

When a run hits a cap, the proxy stops it before overspending and places it in your Inbox. Model tokens are charged at provider list price on your own keys or prepaid credits ([Pricing](/pricing)).

## The four-gate kill switch

Stopping unattended agents cannot rely on a single flag. Pressing **Stop everything** twice in the Autopilot title bar (or `⌘⇧.` twice within four seconds from anywhere in the desktop app) activates four coordinated gates at once:

1. **Live runs:** Immediately stops every run in progress while keeping each task retryable.
2. **Task creation:** Refuses new tasks with a machine-readable `agents_paused` status and `nextAction`.
3. **Runner queue:** Returns an empty queue to local runners so queued tasks stay intact instead of being marked refused.
4. **Model proxy:** Rejects model calls before rate limiting or provider dispatch.

The same switch is available over MCP ([`pause_agents`](/docs/mcp-server/pause_agents), [`resume_agents`](/docs/mcp-server/resume_agents)) and the CLI (`codepanel autopilot pause`). Lifting a pause requires an owner-confirmed scope (`agents:write`), so an unattended agent cannot unpause itself.

Learn how local execution works in [Coding agents](/coding-agents), read the full [security model](/security), or [download the desktop app](/download).
