Drafts and published versions
An agent has numbered versions. Each version has a status:1
Edit
PATCH an agent and your changes go to its draft. If there is no draft, Clarity creates one from the published version first. Live calls keep using the published version.2
Publish
POST …/publish checks the draft against the full configuration rules. If it passes, the draft becomes the published version and the previous one becomes outdated.3
Roll back if needed
POST …/versions/{versionId}/republish makes an outdated version live again.Creating, editing, publishing, republishing and cloning agents need the publish permission, because they change what callers hear. Your organization API key has it.
Endpoints
All paths are under/v1/projects/{projectId}/agents.
GET / leaves out Voice Assist agents. Add ?type=assist for only those, or ?type=all for every agent. Each listed agent shows its published configuration and carries published_version_id, published_version_number and has_draft.
Create an agent
The prompt,task_prompt_json, is a rich-text document: paragraphs of text nodes. A mention node inserts a variable, such as a campaign item’s custom_vars value.
201 with the new agent, including its id. The agent is published right away as version 1, so it can take calls once a number routes to it.
nameis required and must be unique in the project. A taken name answers400.- Fields you leave out get Clarity’s defaults. That includes the speech-recognition, language-model and voice settings in
agent_model_config, which you can set later. - To see the full set of fields an agent’s configuration can carry, read
GET /v1/agents/config-schema. It returns the JSON Schema every version is checked against when it is published.
Edit and publish
1
Change the draft
Send only the fields you want to change:The change is in the draft only. One exception: a new
name applies to the agent at once.2
Publish
warnings, for example about a language model that could not be verified. A publish with warnings still succeeds.POST /{id}/discard-draft. Reading the agent then returns the published version again.
Validation
Agents are checked twice:-
When you save (
POST,PATCH), the body is checked field by field. A bad body answers422with every problem inissues:Unknown fields are dropped without an error, so check the field names you send. -
When you publish, the complete configuration is checked against the runtime schema. A version that does not pass answers
422and stays a draft:messagelists each problem with its path.detailsholds the same problems as objects.
Versions and rollback
GET /{id}/versions/{versionId} returns a version’s full configuration.
To roll back, republish an outdated version:
422 if the rules have changed since.
Every conversation records the version that handled it (agent_version_id), so you can compare calls before and after a change. See Conversations and recordings.
Clone
POST /{id}/clone copies the agent’s published version into a new agent named <name> (clone) (or (clone 2) and so on if that name is taken). The copy is published. An agent that was never published cannot be cloned (409).