---
title: "Roll an agent back to an earlier revision"
method: POST
path: "/agents/{agent_id}:rollback"
tags: ["Agents"]
---

# Roll an agent back to an earlier revision

`POST /agents/{agent_id}:rollback`

## Request

- Base URL: `https://api.axilio.ai/api/v1`
- URL: `https://api.axilio.ai/api/v1/agents/{agent_id}:rollback`
- Auth: API key in header `X-Axilio-Api-Key`
- TypeScript: <https://skmtc.dev/axilioai/apis/axilio-api-2/docs/agents/:agent_id:rollback/post.ts> (a function with typed inputs; its response is checked against the schema)

Copies an earlier revision forward as the agent's newest revision, which becomes the one runs use. History only grows: nothing is removed.

## Path parameters

- `agent_id` string, uuid, required: The agent's id.

## Request body

- AgentRollbackRequest: Request body for rolling an agent back to an earlier revision.
  - `revision_id` string, uuid, required: The earlier revision to roll back to. It is copied forward as a new revision, which becomes current.

## Response `200`

OK

- AgentRevision: One revision of an agent: instructions or code. Revisions are append-only.
  - `agent_id` string, uuid, required: The agent the revision belongs to.
  - `author_user_id` string, uuid, nullable, required: The user who added the revision. Null once they have deleted their account.
  - `base_revision_id` string, uuid: On a proposed fix, the revision the repaired run ran.
  - `code` string: The script, on a code revision.
  - `created_at` string, date-time, required: When the revision was added.
  - `id` string, uuid, required: The revision's id.
  - `instructions` string: The task, on an instructions revision.
  - `kind` 'code' | 'instructions', required: code: the revision is a script. instructions: the revision is a task the agent works through a model.
  - `message` string: The author's note on the revision.
  - `on_failure` 'fail' | 'ask' | 'repair': On a code revision, what a run does when a step fails: fail the run, ask (pause for a person, who retries the step or completes the run), or repair (the agent takes over and proposes a fix).
  - `promoted_at` string, date-time: On a proposed fix, when it was promoted to current.
  - `proposal_state` 'waiting' | 'superseded' | 'promoted': Set when the revision is a fix a repair proposed, which is not current until promoted: waiting to be promoted, superseded (the agent has moved on from the revision it fixes, so it can't be promoted), or promoted.
  - `revision` integer, required: The revision's number within the agent, from 1.
  - `source_run_id` string, uuid: The run the revision came from: on a proposed fix, the run whose repair wrote it; on an agent saved from a run, that run.

## Other responses

- `400`: Bad Request
- `403`: Forbidden
- `404`: Not Found
- `422`: Unprocessable Entity
- `500`: Internal Server Error

## Changes

- **2026-11-02** `62aa324803a7`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/axilioai/apis/axilio-api-2/changes/agents/:agent_id:rollback/post.md)

---

[API](https://skmtc.dev/axilioai/apis/axilio-api-2.md) - [All operations](https://skmtc.dev/axilioai/apis/axilio-api-2/llms.txt) - [OpenAPI document](https://skmtc.dev/axilioai/apis/axilio-api-2/revisions/62aa324803a7?raw)
