# pause_agents

URL: https://codepanel.ai/docs/mcp-server/pause_agents

The CodePanel MCP tool that stops every agent at once: runs in progress stop, and no task, run or model call starts until resumed.

`pause_agents` stops every agent on the account at once. It needs the `tasks:write` scope.

Each run in progress is stopped the way [`stop_run`](/docs/mcp-server/stop_run) stops one: the run ends as `stopped`, what it waited on is denied, and its task can be run again. Until [`resume_agents`](/docs/mcp-server/resume_agents):

- no task is queued: [`start_task`](/docs/mcp-server/start_task) is refused;
- no run starts: a local runner claims nothing, and a queued task waits;
- the model proxy takes no call, so a run still finishing its last step cannot spend.

Each refusal is a `409` with `reason: "agents_paused"` and a `nextAction` naming `resume_agents`.

## When to call it

- **When runs are doing harm or spending faster than they should**, and stopping them one by one would take too long.
- **When the owner asks** to stop everything (the desktop app's "Stop everything").

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `reason` | string | no | Why, in a line; shown wherever the pause is read |

It writes: the server marks it `readOnlyHint: false` and `destructiveHint: true` (it can change what is already there), so a client that asks before writes asks here.

## What it returns

`{ before, after, stopped }`. `before` and `after` are shaped as [`get_agents_pause`](/docs/mcp-server/get_agents_pause) returns them. `stopped.runs` lists each run it stopped, with its `runId`, `taskId` and `title`. One call stops up to 50 runs; `stopped.more: true` means more were running, so call it again. Pausing again keeps the first pause's time, `via` and `reason`.

## The same step without MCP

| Surface | Form |
| --- | --- |
| HTTP API | `POST /autopilot/pause` with the `tasks:write` scope |
| CLI | `codepanel autopilot pause [--reason <text>]` |
| Desktop app | Autopilot, Stop everything, pressed twice |

## What the server tells your agent

The description your agent reads when it lists the tools:

> Use it to stop every agent on the account at once, when runs are doing harm or spending too fast. Stops each run in progress (its task stays retryable, as stop_run leaves it), and until resume_agents no task is queued, no run starts and no model call is made; queued tasks wait. Pausing again keeps the first pause and stops runs a bound left. Needs tasks:write. Returns { before, after, stopped: { runs: [{ runId, taskId, title }], more } }; more: true means pause again.

## Related

- [`resume_agents`](/docs/mcp-server/resume_agents): undo it.
- [`stop_run`](/docs/mcp-server/stop_run) and [`cancel_task`](/docs/mcp-server/cancel_task): stop one run or one task.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
