---
title: "Cancel an agent run"
description: "Ask a run that has not finished to stop. The unused reservation is refunded. A generation the run already started keeps its own lifecycle — cancel that at POST /v1/jobs/{id}/cancel. A run that already finished answers 409 run_not_cancelable."
url: https://docs.roasos.com/api-reference/agent/cancelAgentRun
---

# Cancel an agent run

Ask a run that has not finished to stop. The unused reservation is refunded. A generation the run already started keeps its own lifecycle — cancel that at POST /v1/jobs/{id}/cancel. A run that already finished answers 409 run_not_cancelable.

## `POST /v1/agent-runs/{id}/cancel`

Endpoint: `POST https://api.roasos.com/v1/agent-runs/{id}/cancel`

Cancel an agent run

Ask a run that has not finished to stop. The unused reservation is refunded. A generation the run already started keeps its own lifecycle — cancel that at POST /v1/jobs/{id}/cancel. A run that already finished answers 409 run_not_cancelable.

### Parameters

- `id` (path) — required

### Responses

- `200`: Cancellation recorded
- `400`: The run ID is not a UUID
- `404`: Run not found in this workspace
- `409`: run_not_cancelable: the run has already finished
- `503`: The cancellation could not be recorded

Read the full reference at https://docs.roasos.com/api-reference/agent/cancelAgentRun.
