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,
"memory": {
"isEnabled": false,
"instruction": "sample memory instruction for the agent"
}
},
"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."
]
}
}
]
}
EOFimport requests
url = "https://api.trugen.ai/v1/ext/agent"
payload = {
"agent_name": "Sample AI Agent",
"agent_system_prompt": "You're a helpful ai agent. Answer all questions appropriately.",
"config": {
"timeout": 240,
"memory": {
"isEnabled": False,
"instruction": "sample memory instruction for the agent"
}
},
"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."]
}
}
]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_name: 'Sample AI Agent',
agent_system_prompt: 'You\'re a helpful ai agent. Answer all questions appropriately.',
config: {
timeout: 240,
memory: {isEnabled: false, instruction: 'sample memory instruction for the agent'}
},
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.'
]
}
}
]
})
};
fetch('https://api.trugen.ai/v1/ext/agent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trugen.ai/v1/ext/agent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_name' => 'Sample AI Agent',
'agent_system_prompt' => 'You\'re a helpful ai agent. Answer all questions appropriately.',
'config' => [
'timeout' => 240,
'memory' => [
'isEnabled' => false,
'instruction' => 'sample memory instruction for the agent'
]
],
'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.'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.trugen.ai/v1/ext/agent"
payload := strings.NewReader("{\n \"agent_name\": \"Sample AI Agent\",\n \"agent_system_prompt\": \"You're a helpful ai agent. Answer all questions appropriately.\",\n \"config\": {\n \"timeout\": 240,\n \"memory\": {\n \"isEnabled\": false,\n \"instruction\": \"sample memory instruction for the agent\"\n }\n },\n \"knowledge_base\": [\n {\n \"id\": \"4a0365e4-ced5-42f0-8933-b6880a0ce044\",\n \"name\": \"new kb 123\"\n }\n ],\n \"record\": true,\n \"callback_url\": \"\",\n \"callback_events\": [\n \"participant_left\",\n \"max_call_duration_warning\",\n \"max_call_duration_timeout\",\n \"action_found\"\n ],\n \"avatars\": [\n {\n \"avatar_key_id\": \"665a1170\",\n \"config\": {\n \"llm\": {\n \"model\": \"meta-llama/llama-4-maverick-17b-128e-instruct\",\n \"provider\": \"groq\"\n },\n \"stt\": {\n \"model\": \"flux-general-en\",\n \"provider\": \"deepgram\",\n \"min_endpointing_delay\": 0.3,\n \"max_endpointing_delay\": 0.4\n },\n \"tts\": {\n \"model_id\": \"eleven_turbo_v2_5\",\n \"provider\": \"elevenlabs\",\n \"voice_id\": \"ZUrEGyu8GFMwnHbvLhv2\"\n }\n },\n \"persona_name\": \"Sample AI Agent\",\n \"persona_prompt\": \"You're a helpful ai agent. Answer all questions appropriately.\",\n \"conversational_context\": \"Sample Conversational Context\",\n \"idle_timeout\": {\n \"timeout\": 30,\n \"filler_phrases\": [\n \"Hey it's been a while since we last spoke, are we still connected?\",\n \"I notice we haven't talked for a bit, is everything okay?\"\n ]\n },\n \"welcome_message\": {\n \"wait_time\": 2,\n \"messages\": [\n \"Hi, how are you doing today?\",\n \"Hello, how can I help you?\"\n ]\n },\n \"warning_exit_message\": {\n \"callout_before\": 10,\n \"messages\": [\n \"We are almost at the end of our call, thank you for your time.\",\n \"Thank you for your time. We will see you next time.\"\n ]\n },\n \"exit_message\": {\n \"max_call_duration\": 300,\n \"messages\": [\n \"We are at the end of our call, thank you for your time.\",\n \"Thank you for your time today.\"\n ]\n },\n \"exit_heads_up_message\": {\n \"callout_before\": 10,\n \"messages\": [\n \"We are almost at the end of our call, thank you for your time.\",\n \"Thank you for your time. We will see you next time.\"\n ]\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.trugen.ai/v1/ext/agent")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"Sample AI Agent\",\n \"agent_system_prompt\": \"You're a helpful ai agent. Answer all questions appropriately.\",\n \"config\": {\n \"timeout\": 240,\n \"memory\": {\n \"isEnabled\": false,\n \"instruction\": \"sample memory instruction for the agent\"\n }\n },\n \"knowledge_base\": [\n {\n \"id\": \"4a0365e4-ced5-42f0-8933-b6880a0ce044\",\n \"name\": \"new kb 123\"\n }\n ],\n \"record\": true,\n \"callback_url\": \"\",\n \"callback_events\": [\n \"participant_left\",\n \"max_call_duration_warning\",\n \"max_call_duration_timeout\",\n \"action_found\"\n ],\n \"avatars\": [\n {\n \"avatar_key_id\": \"665a1170\",\n \"config\": {\n \"llm\": {\n \"model\": \"meta-llama/llama-4-maverick-17b-128e-instruct\",\n \"provider\": \"groq\"\n },\n \"stt\": {\n \"model\": \"flux-general-en\",\n \"provider\": \"deepgram\",\n \"min_endpointing_delay\": 0.3,\n \"max_endpointing_delay\": 0.4\n },\n \"tts\": {\n \"model_id\": \"eleven_turbo_v2_5\",\n \"provider\": \"elevenlabs\",\n \"voice_id\": \"ZUrEGyu8GFMwnHbvLhv2\"\n }\n },\n \"persona_name\": \"Sample AI Agent\",\n \"persona_prompt\": \"You're a helpful ai agent. Answer all questions appropriately.\",\n \"conversational_context\": \"Sample Conversational Context\",\n \"idle_timeout\": {\n \"timeout\": 30,\n \"filler_phrases\": [\n \"Hey it's been a while since we last spoke, are we still connected?\",\n \"I notice we haven't talked for a bit, is everything okay?\"\n ]\n },\n \"welcome_message\": {\n \"wait_time\": 2,\n \"messages\": [\n \"Hi, how are you doing today?\",\n \"Hello, how can I help you?\"\n ]\n },\n \"warning_exit_message\": {\n \"callout_before\": 10,\n \"messages\": [\n \"We are almost at the end of our call, thank you for your time.\",\n \"Thank you for your time. We will see you next time.\"\n ]\n },\n \"exit_message\": {\n \"max_call_duration\": 300,\n \"messages\": [\n \"We are at the end of our call, thank you for your time.\",\n \"Thank you for your time today.\"\n ]\n },\n \"exit_heads_up_message\": {\n \"callout_before\": 10,\n \"messages\": [\n \"We are almost at the end of our call, thank you for your time.\",\n \"Thank you for your time. We will see you next time.\"\n ]\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trugen.ai/v1/ext/agent")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_name\": \"Sample AI Agent\",\n \"agent_system_prompt\": \"You're a helpful ai agent. Answer all questions appropriately.\",\n \"config\": {\n \"timeout\": 240,\n \"memory\": {\n \"isEnabled\": false,\n \"instruction\": \"sample memory instruction for the agent\"\n }\n },\n \"knowledge_base\": [\n {\n \"id\": \"4a0365e4-ced5-42f0-8933-b6880a0ce044\",\n \"name\": \"new kb 123\"\n }\n ],\n \"record\": true,\n \"callback_url\": \"\",\n \"callback_events\": [\n \"participant_left\",\n \"max_call_duration_warning\",\n \"max_call_duration_timeout\",\n \"action_found\"\n ],\n \"avatars\": [\n {\n \"avatar_key_id\": \"665a1170\",\n \"config\": {\n \"llm\": {\n \"model\": \"meta-llama/llama-4-maverick-17b-128e-instruct\",\n \"provider\": \"groq\"\n },\n \"stt\": {\n \"model\": \"flux-general-en\",\n \"provider\": \"deepgram\",\n \"min_endpointing_delay\": 0.3,\n \"max_endpointing_delay\": 0.4\n },\n \"tts\": {\n \"model_id\": \"eleven_turbo_v2_5\",\n \"provider\": \"elevenlabs\",\n \"voice_id\": \"ZUrEGyu8GFMwnHbvLhv2\"\n }\n },\n \"persona_name\": \"Sample AI Agent\",\n \"persona_prompt\": \"You're a helpful ai agent. Answer all questions appropriately.\",\n \"conversational_context\": \"Sample Conversational Context\",\n \"idle_timeout\": {\n \"timeout\": 30,\n \"filler_phrases\": [\n \"Hey it's been a while since we last spoke, are we still connected?\",\n \"I notice we haven't talked for a bit, is everything okay?\"\n ]\n },\n \"welcome_message\": {\n \"wait_time\": 2,\n \"messages\": [\n \"Hi, how are you doing today?\",\n \"Hello, how can I help you?\"\n ]\n },\n \"warning_exit_message\": {\n \"callout_before\": 10,\n \"messages\": [\n \"We are almost at the end of our call, thank you for your time.\",\n \"Thank you for your time. We will see you next time.\"\n ]\n },\n \"exit_message\": {\n \"max_call_duration\": 300,\n \"messages\": [\n \"We are at the end of our call, thank you for your time.\",\n \"Thank you for your time today.\"\n ]\n },\n \"exit_heads_up_message\": {\n \"callout_before\": 10,\n \"messages\": [\n \"We are almost at the end of our call, thank you for your time.\",\n \"Thank you for your time. We will see you next time.\"\n ]\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "045302f0-9783-4ff2-846e-3888fb2a7894",
"message": "Agent created successfully"
}{
"error": "Invalid request body"
}{
"error": "Unauthorized: not a valid authorization api key"
}{
"error": "Error creating agent"
}Video Agents
Create Agent
Creates a new agent with avatar IDs, knowledge bases, and additional settings
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,
"memory": {
"isEnabled": false,
"instruction": "sample memory instruction for the agent"
}
},
"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."
]
}
}
]
}
EOFimport requests
url = "https://api.trugen.ai/v1/ext/agent"
payload = {
"agent_name": "Sample AI Agent",
"agent_system_prompt": "You're a helpful ai agent. Answer all questions appropriately.",
"config": {
"timeout": 240,
"memory": {
"isEnabled": False,
"instruction": "sample memory instruction for the agent"
}
},
"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."]
}
}
]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_name: 'Sample AI Agent',
agent_system_prompt: 'You\'re a helpful ai agent. Answer all questions appropriately.',
config: {
timeout: 240,
memory: {isEnabled: false, instruction: 'sample memory instruction for the agent'}
},
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.'
]
}
}
]
})
};
fetch('https://api.trugen.ai/v1/ext/agent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trugen.ai/v1/ext/agent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_name' => 'Sample AI Agent',
'agent_system_prompt' => 'You\'re a helpful ai agent. Answer all questions appropriately.',
'config' => [
'timeout' => 240,
'memory' => [
'isEnabled' => false,
'instruction' => 'sample memory instruction for the agent'
]
],
'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.'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.trugen.ai/v1/ext/agent"
payload := strings.NewReader("{\n \"agent_name\": \"Sample AI Agent\",\n \"agent_system_prompt\": \"You're a helpful ai agent. Answer all questions appropriately.\",\n \"config\": {\n \"timeout\": 240,\n \"memory\": {\n \"isEnabled\": false,\n \"instruction\": \"sample memory instruction for the agent\"\n }\n },\n \"knowledge_base\": [\n {\n \"id\": \"4a0365e4-ced5-42f0-8933-b6880a0ce044\",\n \"name\": \"new kb 123\"\n }\n ],\n \"record\": true,\n \"callback_url\": \"\",\n \"callback_events\": [\n \"participant_left\",\n \"max_call_duration_warning\",\n \"max_call_duration_timeout\",\n \"action_found\"\n ],\n \"avatars\": [\n {\n \"avatar_key_id\": \"665a1170\",\n \"config\": {\n \"llm\": {\n \"model\": \"meta-llama/llama-4-maverick-17b-128e-instruct\",\n \"provider\": \"groq\"\n },\n \"stt\": {\n \"model\": \"flux-general-en\",\n \"provider\": \"deepgram\",\n \"min_endpointing_delay\": 0.3,\n \"max_endpointing_delay\": 0.4\n },\n \"tts\": {\n \"model_id\": \"eleven_turbo_v2_5\",\n \"provider\": \"elevenlabs\",\n \"voice_id\": \"ZUrEGyu8GFMwnHbvLhv2\"\n }\n },\n \"persona_name\": \"Sample AI Agent\",\n \"persona_prompt\": \"You're a helpful ai agent. Answer all questions appropriately.\",\n \"conversational_context\": \"Sample Conversational Context\",\n \"idle_timeout\": {\n \"timeout\": 30,\n \"filler_phrases\": [\n \"Hey it's been a while since we last spoke, are we still connected?\",\n \"I notice we haven't talked for a bit, is everything okay?\"\n ]\n },\n \"welcome_message\": {\n \"wait_time\": 2,\n \"messages\": [\n \"Hi, how are you doing today?\",\n \"Hello, how can I help you?\"\n ]\n },\n \"warning_exit_message\": {\n \"callout_before\": 10,\n \"messages\": [\n \"We are almost at the end of our call, thank you for your time.\",\n \"Thank you for your time. We will see you next time.\"\n ]\n },\n \"exit_message\": {\n \"max_call_duration\": 300,\n \"messages\": [\n \"We are at the end of our call, thank you for your time.\",\n \"Thank you for your time today.\"\n ]\n },\n \"exit_heads_up_message\": {\n \"callout_before\": 10,\n \"messages\": [\n \"We are almost at the end of our call, thank you for your time.\",\n \"Thank you for your time. We will see you next time.\"\n ]\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.trugen.ai/v1/ext/agent")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"Sample AI Agent\",\n \"agent_system_prompt\": \"You're a helpful ai agent. Answer all questions appropriately.\",\n \"config\": {\n \"timeout\": 240,\n \"memory\": {\n \"isEnabled\": false,\n \"instruction\": \"sample memory instruction for the agent\"\n }\n },\n \"knowledge_base\": [\n {\n \"id\": \"4a0365e4-ced5-42f0-8933-b6880a0ce044\",\n \"name\": \"new kb 123\"\n }\n ],\n \"record\": true,\n \"callback_url\": \"\",\n \"callback_events\": [\n \"participant_left\",\n \"max_call_duration_warning\",\n \"max_call_duration_timeout\",\n \"action_found\"\n ],\n \"avatars\": [\n {\n \"avatar_key_id\": \"665a1170\",\n \"config\": {\n \"llm\": {\n \"model\": \"meta-llama/llama-4-maverick-17b-128e-instruct\",\n \"provider\": \"groq\"\n },\n \"stt\": {\n \"model\": \"flux-general-en\",\n \"provider\": \"deepgram\",\n \"min_endpointing_delay\": 0.3,\n \"max_endpointing_delay\": 0.4\n },\n \"tts\": {\n \"model_id\": \"eleven_turbo_v2_5\",\n \"provider\": \"elevenlabs\",\n \"voice_id\": \"ZUrEGyu8GFMwnHbvLhv2\"\n }\n },\n \"persona_name\": \"Sample AI Agent\",\n \"persona_prompt\": \"You're a helpful ai agent. Answer all questions appropriately.\",\n \"conversational_context\": \"Sample Conversational Context\",\n \"idle_timeout\": {\n \"timeout\": 30,\n \"filler_phrases\": [\n \"Hey it's been a while since we last spoke, are we still connected?\",\n \"I notice we haven't talked for a bit, is everything okay?\"\n ]\n },\n \"welcome_message\": {\n \"wait_time\": 2,\n \"messages\": [\n \"Hi, how are you doing today?\",\n \"Hello, how can I help you?\"\n ]\n },\n \"warning_exit_message\": {\n \"callout_before\": 10,\n \"messages\": [\n \"We are almost at the end of our call, thank you for your time.\",\n \"Thank you for your time. We will see you next time.\"\n ]\n },\n \"exit_message\": {\n \"max_call_duration\": 300,\n \"messages\": [\n \"We are at the end of our call, thank you for your time.\",\n \"Thank you for your time today.\"\n ]\n },\n \"exit_heads_up_message\": {\n \"callout_before\": 10,\n \"messages\": [\n \"We are almost at the end of our call, thank you for your time.\",\n \"Thank you for your time. We will see you next time.\"\n ]\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trugen.ai/v1/ext/agent")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_name\": \"Sample AI Agent\",\n \"agent_system_prompt\": \"You're a helpful ai agent. Answer all questions appropriately.\",\n \"config\": {\n \"timeout\": 240,\n \"memory\": {\n \"isEnabled\": false,\n \"instruction\": \"sample memory instruction for the agent\"\n }\n },\n \"knowledge_base\": [\n {\n \"id\": \"4a0365e4-ced5-42f0-8933-b6880a0ce044\",\n \"name\": \"new kb 123\"\n }\n ],\n \"record\": true,\n \"callback_url\": \"\",\n \"callback_events\": [\n \"participant_left\",\n \"max_call_duration_warning\",\n \"max_call_duration_timeout\",\n \"action_found\"\n ],\n \"avatars\": [\n {\n \"avatar_key_id\": \"665a1170\",\n \"config\": {\n \"llm\": {\n \"model\": \"meta-llama/llama-4-maverick-17b-128e-instruct\",\n \"provider\": \"groq\"\n },\n \"stt\": {\n \"model\": \"flux-general-en\",\n \"provider\": \"deepgram\",\n \"min_endpointing_delay\": 0.3,\n \"max_endpointing_delay\": 0.4\n },\n \"tts\": {\n \"model_id\": \"eleven_turbo_v2_5\",\n \"provider\": \"elevenlabs\",\n \"voice_id\": \"ZUrEGyu8GFMwnHbvLhv2\"\n }\n },\n \"persona_name\": \"Sample AI Agent\",\n \"persona_prompt\": \"You're a helpful ai agent. Answer all questions appropriately.\",\n \"conversational_context\": \"Sample Conversational Context\",\n \"idle_timeout\": {\n \"timeout\": 30,\n \"filler_phrases\": [\n \"Hey it's been a while since we last spoke, are we still connected?\",\n \"I notice we haven't talked for a bit, is everything okay?\"\n ]\n },\n \"welcome_message\": {\n \"wait_time\": 2,\n \"messages\": [\n \"Hi, how are you doing today?\",\n \"Hello, how can I help you?\"\n ]\n },\n \"warning_exit_message\": {\n \"callout_before\": 10,\n \"messages\": [\n \"We are almost at the end of our call, thank you for your time.\",\n \"Thank you for your time. We will see you next time.\"\n ]\n },\n \"exit_message\": {\n \"max_call_duration\": 300,\n \"messages\": [\n \"We are at the end of our call, thank you for your time.\",\n \"Thank you for your time today.\"\n ]\n },\n \"exit_heads_up_message\": {\n \"callout_before\": 10,\n \"messages\": [\n \"We are almost at the end of our call, thank you for your time.\",\n \"Thank you for your time. We will see you next time.\"\n ]\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "045302f0-9783-4ff2-846e-3888fb2a7894",
"message": "Agent created successfully"
}{
"error": "Invalid request body"
}{
"error": "Unauthorized: not a valid authorization api key"
}{
"error": "Error creating agent"
}Authorizations
Body
application/json
Display name for the avatar persona.
Behavioral prompt for the avatar interaction style.
List of avatars associated with this agent.
Show child attributes
Show child attributes
Agent-level configuration properties.
Show child attributes
Show child attributes
List of knowledge bases attached to this agent.
Show child attributes
Show child attributes
List of tools attached to this agent.
Show child attributes
Show child attributes
List of MCPs attached to this agent.
Show child attributes
Show child attributes
Determines whether voice call recordings should be stored.
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" ]
Webhook endpoint URL to send callback events to.
Example:
"https://webhooks.example.com/agent-events"
Was this page helpful?
⌘I