> Source: https://wexa.ai/docs/agents/rollback-agent-version

# rollback-agent-version

[Can be held for approval](/docs/sdks-and-apis/how-every-tool-call-works#lifecycle-and-governance)

Make an earlier promoted version of an agent live again. Needs the `fabric:orchestrate.write` grant and an admin role (`OWNER`, `ORG_ADMIN` or `PROJECT_ADMIN`).

The shape of `result` for `rollback-agent-version` is not recorded here: it was not captured against a live deployment. Call it once and read what comes back rather than assuming a shape.

**Roll back an agent**

**Wexa MCP server**

```bash
curl -sS -X POST https://fabric.wexa.ai/mcp/$FABRIC_PROJECT_ID \
  -H "authorization: Bearer $FABRIC_API_KEY" \
  -H "Mcp-Session-Id: $MCP_SESSION_ID" \
  -H "content-type: application/json" -H "accept: application/json" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"rollback-agent-version","arguments":{"agent_id":"6ab1945e7566f41b5c28e303.6ab1945e83ff5845d7db96bc","version":10}}}'
```

**REST API**

```bash
curl -sS https://fabric.wexa.ai/v1/rollback-agent-version \
  -H "authorization: Bearer $FABRIC_API_KEY" \
  -H "content-type: application/json" \
  -d '{"agent_id":"6ab1945e7566f41b5c28e303.6ab1945e83ff5845d7db96bc","version":10}'
```

**TypeScript SDK**

```ts
import { Fabric } from '@wexa-fabric/sdk'

const fabric = new Fabric()
const result = await fabric.rollbackAgentVersion({
  agent_id: '6ab1945e7566f41b5c28e303.6ab1945e83ff5845d7db96bc',
  version: 10
})
```

**Python SDK**

```python
from wexa import Fabric

fabric = Fabric()
out = fabric.rollback_agent_version(
    agent_id="6ab1945e7566f41b5c28e303.6ab1945e83ff5845d7db96bc",
    version=10,
)
```

## Parameters

| Parameter | Type | Required | Notes |
| --- | --- | --- | --- |
| `agent_id` | string | Required | Agent id. An agent in this project. |
| `version` | integer | Required | The version number to make live, at least 1. Find it with `agent-versions`. A version of that agent. |

**Errors**

- `ValidationError` (422): the credential does not hold an admin role (`OWNER`, `ORG_ADMIN` or `PROJECT_ADMIN`).
- `NotFound` (404): the agent has no promoted version to roll back to.

**More details**

The version you roll back to becomes `promoted`; the one that was live becomes `rolled_back`. Version numbers are not renumbered, so rolling back to v1 while v2 was live leaves v2 in the history marked `rolled_back`. Discover version numbers with [agent-versions](/docs/agents/agent-versions) first.

A version exists only after a promote, and a new agent has none: `agent-versions` answers `versions: []`. The first version of an agent is promoted in the console, in Agent Simulation. No tool creates it, so this tool has nothing to make live until that has happened once.

In the console, open the agent's **Version history** and choose **Restore this version** on an earlier one. A process flow has its own [rollback-flow-version](/docs/automation/rollback-flow-version); rolling a process flow back records which snapshot is live and does not rewrite its agents.

Every tool call works the same way: [How every tool call works](/docs/sdks-and-apis/how-every-tool-call-works).
