POST /v1/agents
Create an agent: its goal, the sections of its prompt, its channels and its tools.
POST
Creates an agent in the token’s project and returns it with its
_id.
The goal is the decision that matters. It is what switches the toolkits on, so an agent created to inform cannot later be made to book without changing it. Everything else — sections, channels, tools — can be adjusted afterwards.
You can send the prompt sections here, or create the agent bare and write them one at a time. Valid values for section, goal.type and channels come from the catalogue.
Endpoint
Required scope
agents:write
Body
Example request
An agent on the scenarios engine
Withengine: "scenarios" the agent reads the sections identity and objective (kind=escenarios) and works from its scenarios. Create the agent first, then its scenarios and their routes: the steps of a route carry the actions it uses.
curl
Response
201 Created
400 Bad Request
A field over its length limit, a malformedObjectId, an unknown property, INVALID_MODEL, or a case action that is not in the actions list (UNKNOWN_ACTION_TARGET). A new agent has no stages yet, so a case cannot point to one until it exists.
401 Unauthorized
Missing, invalid, revoked, or expired token.403 Forbidden
The token does not have theagents:write scope.
502 Bad Gateway
The agent service is unreachable.Operational notes
- An agent created here is not yet answering. The channel has to be connected on the company as well as enabled on the agent, and a goal that uses tools needs the data behind them — services, staff, catalogue — to exist.
- Every section you send is versioned from the start. The creation is version 1 of each.
languagecarries the country and it is not cosmetic. It is what decides how the agent conjugates; getting it wrong is the first thing a customer notices.engine: "scenarios"moves the behaviour out of the sections. The agent then reads the index of its scenarios and opens the one that fits; create them after the agent, or start from a template.- Leaving a section out is better than inventing one. An empty section is filled later; an invented one is discovered by a customer.
Authorizations
Body
application/json
Como corre el turno: turn, un agente con todo el prompt (el default al crear); scenarios, el motor de escenarios, que lee el indice de escenarios y abre el que corresponde. Los escenarios y sus rutas se crean despues, con POST /v1/agents/{id}/scenarios y POST /v1/agents/{id}/scenarios/{scenarioId}/routes.
Available options:
turn, scenarios Example:
"turn"