---
title: End an agent run
description: "Explicitly ends a run (WIBLO-085.6): stops/deletes its sandbox and marks the run ended."
api_method: POST
api_path: "/v1/agent-runs/{runId}/end"
canonical_url: https://wiblo.app/docs/developers/api/agent-runs/end-agent-run
last_updated: 2026-07-28T17:31:44+02:00
md_url: https://wiblo.app/docs/developers/api/agent-runs/end-agent-run.md
---

# End an agent run

`POST /v1/agent-runs/{runId}/end`

Explicitly ends a run (WIBLO-085.6): stops/deletes its sandbox and marks the run `ended`. Unlike an idle stop, an ended run does NOT auto-reprovision on a new message — a fresh run is required. Idempotent — ending an already-ended run still acks. Cross-tenant probes and unknown ids collapse onto the same 404 `AGENT_RUN_NOT_FOUND` envelope. Per-user rate-limited at 30/60s.

## Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `runId` | `string` | Yes |  |

## Request

**curl**

```bash
curl https://api.wiblo.app/v1/agent-runs/{runId}/end \
  -X POST \
  -H "Authorization: Bearer $WIBLO_TOKEN"
```

**TypeScript**

```ts
import { createSdk, endAgentRun } from "@workspace/sdk"

const sdk = createSdk({ baseUrl: "https://api.wiblo.app" })

const { data, error } = await endAgentRun({
  client: sdk,
  path: { runId: "..." },
})
```

## Responses

**`200`** — The run was ended and its sandbox stopped. Returns `EndAgentRunResponse`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `runId` | `string` | Yes |  |
| `status` | `"ended"` | Yes |  |

**`401`** — No valid session cookie or `wbl_*` bearer was present. Returns `ApiErrorEnvelope`.

**`404`** — No run visible to the caller with this id (`AGENT_RUN_NOT_FOUND`). Returns `ApiErrorEnvelope`.

**`422`** — Path param failed UUID validation (`INVALID_PARAMS`). Returns `ApiErrorEnvelope`.

**`429`** — Rate limit exceeded. The body's `error.code` is `RATE_LIMITED` and `error.details.retry_after` is the same number of seconds as the `Retry-After` header. Returns `ApiErrorEnvelope`.
