> Source: https://wexa.ai/docs/tools/agent-versions

# agent-versions

Read an agent's promoted version history. Every promote records a snapshot: version number, the config as promoted, who promoted it and with what role, its test pass rate, and which version it replaced. Pass `agent_id` alone to list all versions newest-first; add `from_version` and `to_version` to get a field-level diff between two. Status is promoted | superseded | rolled_back — the LIVE one is whichever is `promoted`, which is NOT necessarily the highest number, because a rollback can make an earlier version live again. Use rollback-agent-version to change which one is live.

## What it is called on each surface

The wire name is `agent-versions` everywhere: it is what the Wexa MCP server advertises, the REST path is
`POST /v1/agent-versions`, and each SDK exposes it under its own language's naming convention.

| Surface | Name |
| --- | --- |
| Wexa MCP server | `agent-versions` |
| REST API | `POST /v1/agent-versions` |
| TypeScript SDK | `fabric.agentVersions()` |
| Python SDK | `fabric.agent_versions()` |

## Arguments

1 of the 3 arguments is required. Omitting a required one is refused before the tool runs, at the validation stage, so it costs nothing and changes nothing.

| Argument | Type | Required | Notes |
| --- | --- | --- | --- |
| `agent_id` | string | Required | Agent id (an agent inside a process flow). Required. |
| `from_version` | integer | Optional | With to_version: return a diff between these two versions instead of the list. |
| `to_version` | integer | Optional | With from_version: the version to diff against. |

`project_id`, `projectID`, `organization_id` and `executed_by` are not arguments you pass: the
platform binds all four from the credential you authenticated with, and both SDKs refuse them
before the request leaves your process — see
[server-bound arguments](/docs/get-started/scope-and-server-bound-arguments).

## What it returns

The three surfaces wrap this differently, and code written against one will not read another
correctly — see [return shape](/docs/tools/overview#return-shape).

A real response, captured from a live call to `agent-versions`:

**Result of agent-versions**

**REST API**

```json
{
  "lifecycle_id": "qlc_000176",
  "result": {
    "agent_id": "6ab1945e7566f41b5c28e303.6ab1945e83ff5845d7db96bc",
    "live_version": 0,
    "versions": []
  }
}
```

**Wexa MCP server**

```json
{
  "content": [
    {
      "type": "text",
      "text": "{\"lifecycle_id\":\"qlc_000176\",\"result\":{\"agent_id\":\"6ab1945e7566f41b5c28e303.6ab1945e83ff5845d7db96bc\",\"live_version\":0,\"versions\":[]}}"
    }
  ],
  "isError": false
}
```

**TypeScript SDK**

```ts
// the object you get back IS the result — there is no `.result` to read
{
  agent_id: '6ab1945e7566f41b5c28e303.6ab1945e83ff5845d7db96bc',
  live_version: 0,
  versions: []
}

// The TS SDK names these camelCase — lifecycleId, traceId — where Python uses
// lifecycle_id and trace_id. Both are non-enumerable: readable, but omitted by
// Object.keys() and JSON.stringify(). `result.lifecycleId` here is undefined.
result.lifecycleId // 'qlc_000176'
```

**Python SDK**

```python
# a dict subclass; `result` is already unwrapped
{
 "agent_id": "6ab1945e7566f41b5c28e303.6ab1945e83ff5845d7db96bc",
 "live_version": 0,
 "versions": []
}

out.lifecycle_id  # 'qlc_000176' — an attribute, not a key
```

Keeping the `lifecycle_id` is what lets you ask later why a call was allowed, refused or held.

## Calling it

The same call on all four surfaces. Pick a tab once and every code block in the documentation follows it.

The ids in this example are real: they resolve against the project the documentation is written
against, so the call runs as written once you point it at your own deployment. Swap them for the
ids of your own objects.

**Call agent-versions**

**Wexa MCP server**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "agent-versions",
    "arguments": {
      "agent_id": "6ab1945e7566f41b5c28e303.6ab1945e83ff5845d7db96bc"
    }
  }
}
```

**REST API**

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

**TypeScript SDK**

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

const fabric = new Fabric()
const { result } = await fabric.agentVersions({
  agent_id: "6ab1945e7566f41b5c28e303.6ab1945e83ff5845d7db96bc"
})
```

**Python SDK**

```python
from wexa import Fabric

fabric = Fabric()
out = fabric.agent_versions(agent_id="6ab1945e7566f41b5c28e303.6ab1945e83ff5845d7db96bc")
```

## Errors

Both SDKs raise the same typed errors, chosen from the gateway's own error string first and its
HTTP status second. `agent-versions` checks the `fabric:orchestrate.read` grant, and reaches the seven classes every
tool reaches — listed under [the common set](/docs/tools/errors#the-common-set). These are the ones specific to it:

| Error | Status | Raised when |
| --- | --- | --- |
| `NotFound` | 404 | `agent_id` matches no agent in this project, or that agent has no version history yet. |
| `ConfigurationError` | 5xx | `agent-versions` is not available to you. Retrying will not help. |

## Governance

Every call to `agent-versions` runs through the same ten-stage lifecycle as every other Wexa tool: the
credential is resolved to a scope, the `fabric:orchestrate.read` grant is checked, quota is drawn down, the arguments are
validated, policy rules are evaluated, the call is executed, the result is shaped and redacted, and an audit
record is written. The `lifecycle_id` in the response is the handle to that record.

`agent-versions` only reads, so it is not marked consequential: it is audited lightly and is never held for
approval. It still consumes quota and is still refused by policy like anything else.

## See also

[The tool index](/docs/tools/overview), [errors](/docs/tools/errors),
and [which identifier goes where](/docs/tools/identifiers).
