API reference
Replace an agent's definition
PUT /v1/agents/{agent_id}/definition
Put a definition back onto an agent: its prompt, configuration, voice, languages, analysis, and the tools and knowledge bases it names. On a published agent the change is live at once, as an edit in the console is, until the next publish freezes it as a version. Needs agents:write and a live key.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
agent_id |
path | string (uuid) | Yes |
Body
Sent as JSON. A field this operation does not take is refused, so a typo fails loudly.
| Field | Type | Required | Description |
|---|---|---|---|
definition |
object | Yes | The agent's new definition. Its kind and direction must be the agent's own. |
name |
string or null | No | A new name, if it is to change. |
Answer
200 with AgentWritten.
Errors
Every error is a problem document with a stable code.
| Status | When |
|---|---|
401 |
The key is missing, mistyped, unknown, revoked or expired. |
403 |
The key lacks a permission, a live key was sent from a browser, or the organization is frozen and the request would change something. |
404 |
This key reaches no such agent. |
409 |
The project already has an agent with that name, or it is frozen. |
422 |
The definition cannot be read, holds something an agent may not, or is for another kind or direction of agent. |
429 |
Too many requests for this key or its organization; see Retry-After. |
500 |
Something went wrong on our side. Quote the request_id to support. |
Examples
#!/bin/sh
# Replace an agent's definition. On a published agent the change is live at once. With a live key.
curl -sS --fail-with-body -X PUT "https://api.aigently.ai/v1/agents/9b1d3f5a-7c9e-4b1d-a3f5-7c9e1b3d5f7a/definition" \
-H "Authorization: Bearer $AIGENTLY_API_KEY" \
--json '{
"definition": {
"format": "agently.agent/1",
"agent": {
"name": "Aigently front desk",
"kind": "custom",
"direction": "outbound",
"system_prompt": "You are the Aigently front desk. Greet {{first_name}} by name and confirm their booking."
},
"references": {}
}
}'
Try it
Sends this request to the API from your browser, with a test key. Nothing it does rings a phone.