Skip to content
Anlyon
Esc
↑↓navigate↵open⌘Jpreview
On this page

Immutable versions and rollback

Ship an agent's configuration as immutable versions, promote it from staging to production with an explicit confirmation, pin the action versions it calls, and roll back by moving a pointer.

An agent is a named identity in one environment, such as support-agent in staging. Its configuration, including which action versions it calls, ships as immutable, append-only versions. Editing an agent never changes a version: it adds a new one. Promotion copies the published version into another environment, and rollback points the agent back at an earlier version.

Why versions and rollback

  • Risk. A bad prompt or tool change in production should be one step away from the configuration that worked, not an emergency redeploy. Every version is kept, so going back is always possible.
  • Risk, between environments. Promotion never copies a credential. Configuration names secrets, and each environment resolves its own, so a staging key never reaches production through a promotion.
  • Effort. You do not keep your own history of agent configurations or a release script to move them. Promotion is one call, and a protected environment asks you to confirm it.

Understand how versions work

  • Every edit creates a new version. Version numbers increase per agent, starting at 1, so history is one ordered sequence.
  • A published pointer (currentVersion) marks the live version of the agent in its environment.
  • Earlier versions are kept. A rollback moves the pointer to one of them, and you can move it forward again the same way.
v1  published ─┐
v2             │   promote v3 → pointer moves to v3
v3  published ─┘   incident → roll back → pointer moves to v1

Pin the action versions an agent calls

A version’s config.actions maps an action name to an immutable action version id:

{ "actions": { "refund": "acv_01JABCDEF" } }

When the agent calls refund, it runs the definition acv_01JABCDEF names, not whatever the action has since been edited to. Roll the agent back to a version that pins an older action version, and later calls run that older definition. A version that pins nothing restores the pointer and the prompt, and its tools run at their current definitions. List an action’s versions with GET /api/v2/actions/{ref}/versions.

When the pin is read

  • At each invocation, from the agent’s published version at that moment. It is not frozen when a run starts. Rolling an agent back mid-run takes effect on the run’s next action call, and a call already in flight finishes on the definition it started with. If a run must not see a promotion, start it after the promotion lands.
  • A pin that cannot be resolved fails the call. If a version names an action version that no longer exists, the invocation answers 409 ACTION_VERSION_PIN_UNRESOLVED, naming the agent, the action and the missing version. Anlyon never substitutes the current definition: running a different definition is what pinning exists to prevent.

Pinning is opt-in. Until a version’s config.actions names an action, that action’s invocations run its current definition.

Deleting an action archives it rather than destroying it, so versions that pin it stay resolvable and its invocation history survives. The archived action keeps its name, and creating a new action with that name in the same environment answers 409 CONFLICT, so use a new name.

Promote an agent to another environment

Promotion takes the agent’s published version and, in the target environment, creates an agent with the same name or appends a new immutable version to the existing one, and publishes it. The target keeps every earlier version, so a promotion is itself reversible.

Promotion does not copy secret values. Configuration references secrets by name, and each environment resolves its own: a promotion to production uses production’s secrets.

Promoting into a protected environment needs confirmProtected: true, so changing production is always a stated choice. The default Production environment is protected. See Protect production.

Agents are managed by admins in the console under Agents: create, add versions, promote and roll back. The same operations are on /api/v2/workspaces/{workspaceId}/agents and take a signed-in console session, not an API key.

curl -X POST https://api.anlyon.com/api/v2/workspaces/$WORKSPACE_ID/agents/agt_01JABCDEF/promote \
  -H "Cookie: better-auth.session_token=YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "targetEnvironmentId": "PRODUCTION_ENVIRONMENT_ID", "confirmProtected": true }'

The answer is 201 with the target agent and the version just published, { agent, version }.

Roll back by moving the pointer

Rolling back is not a rebuild or a restore from backup. It points the agent at an earlier version that is still there. In the console, open the agent and publish an earlier version. Through the API, set currentVersion:

curl -X PATCH https://api.anlyon.com/api/v2/workspaces/$WORKSPACE_ID/agents/agt_01JABCDEF \
  -H "Cookie: better-auth.session_token=YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "currentVersion": 1 }'

To add a version, send its whole configuration. Leave publish out to add it without making it live:

curl -X POST https://api.anlyon.com/api/v2/workspaces/$WORKSPACE_ID/agents/agt_01JABCDEF/versions \
  -H "Cookie: better-auth.session_token=YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "config": { "actions": { "refund": "acv_01JABCDEF" } }, "publish": true }'

Know what a rollback restores

A version restores the configuration Anlyon holds. It does not restore the world outside:

  • It does not undo a request already sent. Recovery or compensation is separate work.
  • An upstream API may have changed its behaviour since.
  • Secrets resolve per environment by name, so production keeps using production’s current credential.

Fix the errors you will meet

Status and code When What to do
409 CONFLICT Promoting into a protected environment without confirmProtected: true, into the agent’s own environment, or an agent with no published version; or creating an agent or action whose name is taken. Confirm, pick another target, publish a version first, or use a new name.
409 ACTION_VERSION_PIN_UNRESOLVED The agent’s published version pins an action version that no longer exists. Publish an agent version that pins an existing action version.
403 FEATURE_NOT_AVAILABLE Promoting on a workspace with no plan. Promotion is included during Early Beta Access and on every paid plan. Choose a plan.
404 NOT_FOUND The agent, version or environment does not exist in this workspace. Check the ids.
403 AUTHORIZATION_ERROR A member without the admin role creates, changes or promotes an agent. Ask an admin.

Was this page helpful?