Skip to main content
POST
Crear un agente
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

Response

201 Created

400 Bad Request

A field over its length limit, a malformed ObjectId, an unknown property, or INVALID_MODEL.

401 Unauthorized

Missing, invalid, revoked, or expired token.

403 Forbidden

The token does not have the agents: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.
  • language carries 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.
  • Leaving a section out is better than inventing one. An empty section is filled later; an invented one is discovered by a customer.

Authorizations

Authorization
string
header
required

Personal Access Token con prefijo kbai_pk_. Generar desde el portal con permiso developer.manage_tokens.

Body

application/json
name
string
required
Maximum string length: 150
Example:

"Agente de ventas"

description
string
Maximum string length: 500
model
string

Identificador del modelo. Se valida contra los modelos soportados; uno desconocido devuelve 400 INVALID_MODEL.

Example:

"gpt-5"

language
string

Locale del agente. El pais importa: es-CL y es-MX no conjugan igual.

Example:

"es-CL"

timezone
string
Example:

"America/Santiago"

goal
object
prompts
object[]

Las secciones del prompt. Se pueden mandar aca al crear, o una por una con PUT /v1/agents/{id}/prompts/{section}.

Maximum array length: 20
channels
string[]

Canales por los que atiende, del catalogo (GET /v1/prompt-types?kind=channel).

Maximum array length: 10
Example:
reengagement
object

Reenganche: cuantas veces vuelve sobre una conversacion enfriada y cada cuanto.

Example:
tools
string[]

ObjectIds de herramientas (GET /v1/tools) que puede usar.

Maximum array length: 100
knowledge_node_ids
string[]

ObjectIds de nodos de la base de conocimiento a asignar.

Maximum array length: 200
stages
string[]

Etapas del embudo, por NOMBRE y en orden. Se crea un pipeline en el CRM con el nombre del agente y esas etapas, y el agente queda habilitado para mover tickets solo entre ellas. Sin esto no se crea ningun pipeline y el agente no mueve tickets.

Maximum array length: 20
Example:

Response

201 - application/json
agent
object
required