Versions, latest and Live
Every save of an agent creates a new version. latest is the newest one. Live is the one your users get. By default Live follows latest; an admin can pin it to one version and keep users there while you keep saving.
In one line
Live is what users get; latest is every save.
latest and Live
| Word | Means | Moves when |
|---|---|---|
latest | The newest version | Every save: a new version, a restore, an agents apply that changes the agent, skills saved from chat |
| Live | The version users get | With every save while the agent follows latest. Otherwise only when an admin goes live, rolls back or lets it follow latest again |
A new agent starts with version 1 as both latest and Live, so it can run at once.
The agent carries both pointers: latestVersionId and latestVersionNumber, liveVersionId and liveVersionNumber, plus liveMode. GET /v1/agents/{agentId}/versions/latest and GET /v1/agents/{agentId}/versions/live return the version itself. While Live versions are not available in your workspace yet, liveMode is null and every caller gets latest.
Live modes
| Mode | liveMode | What users get |
|---|---|---|
| Follows latest | follows_latest | Every save, at once. The default for every agent |
| Pinned | pinned | The version an admin put live, until an admin changes it. A save moves only latest |
Only Go live, Roll back and Follow latest change the mode. A save, a restore or an update of the agent never does; liveMode in a create or update body is ignored.
Go Live, Roll Back, Follow Latest
Only an ADMIN or OWNER can change what users get: a signed-in admin, or an API key whose role is ADMIN or OWNER. A member can save versions and try them, but cannot move Live.
| Action | What it does |
|---|---|
| Go live | Puts a version live and pins the agent there |
| Roll back | Go live with an older version. The agent is pinned, so the next save does not undo it |
| Follow latest | Moves Live to latest and lets it follow every save again |
All three are one call, PUT /v1/agents/{agentId}/labels/live:
# Go live with a version (an older version is a roll back)
curl -X PUT https://api.2kw.ai/v1/agents/agt_123/labels/live \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk_your_api_key" \
-d '{
"agentVersionId": "ver_456",
"expectedVersionId": "ver_455",
"expectedLiveMode": "follows_latest",
"note": "Fixes the VAT rule"
}'
# Follow latest again
curl -X PUT https://api.2kw.ai/v1/agents/agt_123/labels/live \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk_your_api_key" \
-d '{ "liveMode": "follows_latest", "expectedVersionId": "ver_456", "expectedLiveMode": "pinned" }'
agentVersionId: the version to put live. Leave it out only for Follow latest.liveMode:pinned(the default when you send a version) orfollows_latest(send no version).pinnedwithout a version, orfollows_latestwith one, answers400.expectedVersionIdandexpectedLiveMode: the agent'sliveVersionIdandliveModeas you read them. If Live moved since, because another admin acted or a save moved a following agent, the call answers409 LIVE_CHANGEDinstead of overwriting it. Read the agent again and decide again.note: why, up to 1,000 characters, shown in the Live history.
Before a version goes live it is checked again: it must be active, and its models, tools, connectors and skills must still be valid. A version that can no longer run is refused here, not at a user's first message.
A call that changes nothing answers 200 and adds no history entry: Go live with the version a pinned agent already has, or Follow latest on an agent that already follows. Pinning a following agent at its current version is a change, because it sets the mode. The response is the live label; read liveMode from GET /v1/agents/{agentId}. Every field: API reference.
Restore is not Roll back. Restore (PUT /v1/agents/{agentId}/versions/{versionId}/activate) copies an older version to a new latest. On a following agent that reaches users at once; on a pinned agent Live stays where it is. To change what users of a pinned agent get, roll back.
The live and latest labels cannot be created, renamed or deleted by hand (400 RESERVED_LABEL_NAME). The Live version of a pinned agent cannot be deactivated (409 VERSION_IS_LIVE): put another version live, or follow latest, first.
From the CLI, which sends the expected values for you:
2kw agents go-live invoice-checker --version 7 --note "Fixes the VAT rule"
2kw agents go-live invoice-checker --version 6 # an older version: roll back
2kw agents follow-latest invoice-checker
2kw agents live-history invoice-checker
2kw agents versions live --agent <agentId>
The MCP server has the same as 2kw_go_live_agent, 2kw_follow_latest_agent and 2kw_agent_live_history. Go live and Follow latest need a key whose role is ADMIN or OWNER there too. An agent's own tools can never reach them.
In the console, an admin finds Go live in the agent's header and Roll back to this on an older row and Go live with this on a newer row of the agent's Versions page; Follow latest is in the agent's menu while it is pinned.
References
Wherever you name a version of an agent, you use one of four kinds:
| Reference | Example | Gets |
|---|---|---|
| Live | agent/invoice-checker@live | What users get |
latest | agent/invoice-checker@latest | Every save |
| A label | agent/invoice-checker@prod | The version a member pointed the label at. It moves only when a member moves it |
| A fixed version | a version id, ver_… | One version. It never changes |
Labels are yours to create and move; see Agents. A fixed version is named by its id, for example in an experiment variant ("version": { "versionId": "…" }) or in GET /v1/agents/{agentId}/versions/{versionId}. Every response's model names the version that ran (agent/invoice-checker@4), whatever you addressed.
Prompts and schemas have versions, labels and latest, and no Live: see Prompts and Schemas.
Which Version a Run Gets
A reference with @live, @latest or a label runs that. A bare agent/invoice-checker runs what fits the caller:
| Caller | agent/x | agent/x@live | @latest or another label |
|---|---|---|---|
| Signed-in member: chat app, mobile app, console chat, the CLI signed in with your account | Live | Live | MEMBER and above |
| Embeddable surface visitor | Live | Live | 404 |
Member or API key with role USER | Live | Live | 404 |
API key with role MEMBER, ADMIN or OWNER: the API, and the CLI, MCP server and n8n with such a key | latest | Live | That label |
- An API key keeps
latestfor a bare reference, so existing scripts run what they ran before. Send@livewhen you mean what users get. - A caller that may not name
@latestor another label gets the same404as an unknown agent. - Scheduled tasks run Live.
- A sub-agent follows its parent: under a parent on
latestit runslatest, under any other parent it runs Live. - An experiment variant runs the label or version you pick, and
latestwhen it names none.liveis a label you can pick.
Reads that describe what users get follow Live too. The agent catalog describes the Live version. GET /v1/agents/{agentId}/skills and GET /v1/agents/{agentId}/knowledge take label, default live; a MEMBER or above may pass latest or another label.
Trying latest in chat. When latest differs from Live, a member (MEMBER and above) starting a new chat with the agent can switch it from Live to Latest. That chat then runs latest; reopened later, it continues on Live. Each answer shows the version that answered.
Open conversations. A turn runs the version it started on, and its model names it. The next message resolves the agent again, so an open chat gets the new Live with its next message.
Live History
GET /v1/agents/{agentId}/labels/live/history lists who put which version live, newest first and paged. Any MEMBER or above can read it.
| Field | Meaning |
|---|---|
kind | go_live, rollback or follow_latest. Ignore a value you do not know |
fromVersionNumber, toVersionNumber | Where Live was, and where it went |
liveMode | The mode after the change |
actorKind, actorId | Who did it: user or api_key, and its id. Ignore a value you do not know |
note | Why, as sent |
at | When |
Saves of a following agent are not listed: the history holds the decisions, not every save. The console shows it on the agent's Versions page, and the CLI as 2kw agents live-history <agent>.
Errors
The label and version calls answer with a problem document; branch on errorCode.
Status and errorCode | When | What to do |
|---|---|---|
400 RESERVED_LABEL_NAME | Creating, renaming or deleting live or latest by hand | Use another label name |
400 | pinned without a version, or follows_latest with one | Send a version to go live, none to follow latest |
403 GO_LIVE_REQUIRES_ADMIN | Go live, Roll back or Follow latest by a caller below ADMIN | Ask an admin, or use a key whose role is ADMIN or OWNER |
404 | Unknown agent or version | Check the ids |
409 LIVE_CHANGED | Live, or its mode, changed since you read it | Read the agent again and decide again |
409 VERSION_INACTIVE | The version is deactivated | Pick an active version, or restore it and put the copy live |
409 VERSION_IS_LIVE | Deactivating the Live version of a pinned agent | Put another version live, or follow latest, first |
409 LIVE_NOT_ACTIVE | Live versions are not available in this workspace yet | Nothing to do: every caller gets latest until then |
On POST /v1/responses, a caller that may not name @latest or another label gets the unknown-agent 404 described on Errors.