Create agent with AI

View as Markdown
Creates a new agent using AI generation. Accepts either a guided questionnaire (array of Q&A pairs) or a free-text description. The AI generates the agent's prompt and configuration. A security check is run on the generated prompt before the agent is persisted. Deducts credits on success. **Rules:** - Either `questions` (non-empty array) or `description` must be provided — not both. - `emotiveToggle`, `voiceId`, and `voiceModel` must either all be present or all be absent. - When `emotiveToggle=true`, `voiceModel` must be `GPT_REALTIME`. - When `emotiveToggle=false`, `voiceModel` cannot be `GPT_REALTIME`.

Authentication

AuthorizationBearer

API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth.

Request

This endpoint expects an object.
namestringOptional<=50 characters

Agent name. Auto-generated if omitted.

descriptionstringOptional<=15000 characters

Free-text description. Required if questions not given.

questionslist of objectsOptional

Guided Q&A pairs. Required if description not given.

typeenumOptional

Workflow type. Only single_prompt is supported.

Allowed values:
emotiveTogglebooleanOptional

Enable emotive (GPT Realtime) mode. Must be given with voiceId and voiceModel.

voiceIdstringOptional

Voice ID. Must be given together with emotiveToggle and voiceModel.

voiceModelstringOptional

Voice model. Must be given together with emotiveToggle and voiceId.

knowledgeBaseIdstringOptional

Knowledge base to attach (must belong to the organization).

Response

Agent created — returns the new agent’s ObjectId

successboolean
datastring
MongoDB ObjectId of the created agent

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
500
Internal Server Error
503
Service Unavailable Error