API reference
Create an agent
POST /v1/agents
Make an agent in a project from a definition. It is a draft until it is published. Everything the definition names is looked up in the project by name, and what is not there is listed in unbound with what the agent does without it. Needs agents:write and a live key.
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 | An agent definition, as GET /v1/agents/{id}/definition answers with or the console exports. |
name |
string or null | No | Its name. The definition's own, made free in the project, unless you say. |
project_id |
string (uuid) | Yes | The project the agent is made in. |
Answer
201 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 project. |
409 |
The project already has an agent with that name, or it is frozen. |
422 |
The definition cannot be read, or holds something an agent may not. |
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
# Create an agent from a definition. It is a draft until it is published. With a live key.
curl -sS --fail-with-body -X POST "https://api.aigently.ai/v1/agents" \
-H "Authorization: Bearer $AIGENTLY_API_KEY" \
--json '{
"project_id": "0b1c2d3e-4f5a-6b7c-8d9e-0f1a2b3c4d5e",
"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.