Skip to main content
POST
/
ext
/
agent
Create an agent
curl --request POST \
  --url https://api.trugen.ai/v1/ext/agent \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data @- <<EOF
{
  "agent_name": "Sample AI Agent",
  "agent_system_prompt": "You're a helpful ai agent. Answer all questions appropriately.",
  "config": {
    "timeout": 240
  },
  "knowledge_base": [
    {
      "id": "4a0365e4-ced5-42f0-8933-b6880a0ce044",
      "name": "new kb 123"
    }
  ],
  "record": true,
  "callback_url": "",
  "callback_events": [
    "participant_left",
    "max_call_duration_warning",
    "max_call_duration_timeout",
    "action_found"
  ],
  "avatars": [
    {
      "avatar_key_id": "665a1170",
      "config": {
        "llm": {
          "model": "meta-llama/llama-4-maverick-17b-128e-instruct",
          "provider": "groq"
        },
        "stt": {
          "model": "flux-general-en",
          "provider": "deepgram",
          "min_endpointing_delay": 0.3,
          "max_endpointing_delay": 0.4
        },
        "tts": {
          "model_id": "eleven_turbo_v2_5",
          "provider": "elevenlabs",
          "voice_id": "ZUrEGyu8GFMwnHbvLhv2"
        }
      },
      "persona_name": "Sample AI Agent",
      "persona_prompt": "You're a helpful ai agent. Answer all questions appropriately.",
      "conversational_context": "Sample Conversational Context",
      "idle_timeout": {
        "timeout": 30,
        "filler_phrases": [
          "Hey it's been a while since we last spoke, are we still connected?",
          "I notice we haven't talked for a bit, is everything okay?"
        ]
      },
      "welcome_message": {
        "wait_time": 2,
        "messages": [
          "Hi, how are you doing today?",
          "Hello, how can I help you?"
        ]
      },
      "warning_exit_message": {
        "callout_before": 10,
        "messages": [
          "We are almost at the end of our call, thank you for your time.",
          "Thank you for your time. We will see you next time."
        ]
      },
      "exit_message": {
        "max_call_duration": 300,
        "messages": [
          "We are at the end of our call, thank you for your time.",
          "Thank you for your time today."
        ]
      },
      "exit_heads_up_message": {
        "callout_before": 10,
        "messages": [
          "We are almost at the end of our call, thank you for your time.",
          "Thank you for your time. We will see you next time."
        ]
      }
    }
  ]
}
EOF
{
  "id": "045302f0-9783-4ff2-846e-3888fb2a7894",
  "message": "Agent created successfully"
}

Authorizations

x-api-key
string
header
required

Body

application/json
agent_name
string
default:Sofia - Friendly Support
required

Display name for the avatar persona.

agent_system_prompt
string
default:Speak in a warm, engaging tone and provide clear answers.
required

Behavioral prompt for the avatar interaction style.

avatars
object[]
required

List of avatars associated with this agent.

config
object
required

Agent-level configuration properties.

knowledge_base
object[] | null

List of knowledge bases attached to this agent.

tool
object[] | null

List of tools attached to this agent.

mcp
object[] | null

List of MCPs attached to this agent.

record
boolean
default:true

Determines whether voice call recordings should be stored.

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