Skip to main content
POST
/
agent
/
api
Create an agent
curl --request POST \
  --url https://api.trugen.ai/v1/agent/api \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "avatar_ids": [
    "ava_ae61c9e28b",
    "ava_ed3a666dc5"
  ],
  "name": "New Agent",
  "system_prompt": "You are a helpful assistant",
  "email": "test@test.com",
  "config": {
    "timeout": 240
  },
  "is_active": true,
  "knowledge_base": [
    {
      "id": "4a0365e4-ced5-42f0-8933-b6880a0ce044",
      "name": "new kb 123"
    }
  ],
  "record": true,
  "callback_url": "https://play.svix.com/in/e_pBuXcpDaVzRzwn3L5El4xFFlKnD/",
  "callback_events": [
    "participant_left",
    "max_call_duration_warning",
    "max_call_duration_timeout",
    "action_found"
  ]
}
'
{
  "id": "045302f0-9783-4ff2-846e-3888fb2a7894",
  "message": "Agent created successfully"
}

Authorizations

x-api-key
string
header
required

Body

application/json
name
string
required

Display name for the avatar persona.

Example:

"Sofia - Friendly Support"

system_prompt
string
required

Behavioral prompt for the avatar interaction style.

Example:

"Speak in a warm, engaging tone and provide clear answers."

config
object
required

Agent-level configuration properties.

avatar_key_id
string

Avatar identifier key.

Example:

"1e4ea106"

avatars
object[]

List of avatars associated with this agent.

knowledge_base
object[] | null

List of knowledge bases attached to this agent.

record
boolean

Determines whether voice call recordings should be stored.

Example:

true

callback_events
string[]

Webhook events that should trigger callbacks.

Example:
[
"participant_left",
"agent.started_speaking",
"agent.stopped_speaking",
"agent.interrupted",
"user.started_speaking",
"user.stopped_speaking",
"utterance_committed",
"max_call_duration_timeout"
]
callback_url
string

Webhook endpoint URL to send callback events to.

Example:

"https://webhooks.example.com/agent-events"

Response

Agent created successfully

id
string
message
string