Versioning Lifecycle
Every Atoms agent’s runtime config — prompt, tools, voice, language, post-call metrics — is managed as versions. You don’t edit the live config directly; you fork a draft, change what you need, publish it as a new version, and activate that version. This guide walks the full lifecycle from code.
For the dashboard equivalent and a deeper conceptual overview, see Agent Versioning.
All examples assume BASE="https://api.smallest.ai/atoms/v1" and SMALLEST_API_KEY is set in your environment.
The flow
Steps 5 and 6 are separate. POST .../publish does not activate the new version, even if you pass activate: true in the body. Always call activate explicitly.
Full walkthrough (curl)
Python (using the SDK + raw requests)
The agent CRUD endpoints are exposed through the SmallestAI REST client. The draft/version endpoints are not yet first-class in the Python SDK, so they’re called directly:
Common pitfalls
Publish does NOT auto-activate, even with activate: true
The publish endpoint accepts activate in its body, but the field is not honored — the new version comes back with isActive: false. Always call PATCH /versions/{versionId}/activate explicitly. Confirmed against the live API on 2026-06-11.
Activate immediately after publish returns a security-check error
Each publish triggers a backend security check that takes ~6 seconds. Activating before it completes returns an error. The simplest fix is sleep 6 between publish and activate; for production, poll GET /agent/{id}/versions/{versionId} and wait for securityCheck.status: "passed".
POST /drafts requires a source — empty body returns 400
The body must include either sourceVersionId (fork from a published version) or sourceDraftId (fork from another draft). An empty {} returns 400 "Either sourceVersionId or sourceDraftId is required".
PATCH on the draft config does not echo the patched fields
The response body returns the new draftRevision counter and a few rotated block ids, but not the fields you sent in the PATCH. To confirm a value persisted, fetch the draft after with GET /agent/{id}/drafts/{draftId}.
POST /agent with language but no switching returns 400
POST /agent with language but no switching returns 400
If you include the language object in the create body, it must contain a switching object — even an empty one ("switching": {"isEnabled": false}) is enough. Omitting language entirely is also fine.
DELETE /agent/{id} returns 404 — use /archive
The agent delete endpoint is DELETE /agent/{id}/archive, not plain DELETE /agent/{id}. Plain DELETE returns 404.
What about PATCH /workflow/{workflowId}?
A legacy endpoint, PATCH /workflow/{workflowId} (the workflowId is on the agent document, not the agent id), writes directly to the underlying workflow document. On a versioned agent it bypasses the version lifecycle — the change isn’t captured as a version and fields missing from the payload can be silently overwritten. Always go through the drafts → publish → activate flow above.

