Skip to main content
POST
/
ai-agents
/
agent-builder
/
agents
Create Agent
curl --request POST \
  --url https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/agents \
  --header 'Content-Type: application/json' \
  --header 'apikey: <api-key>' \
  --data '
{
  "name": "<string>",
  "icon": "<string>",
  "description": "<string>",
  "tools": [
    "<string>"
  ],
  "apiTools": [
    "<string>"
  ],
  "mcpServers": [
    "<string>"
  ],
  "instruction": "<string>",
  "metaData": {},
  "model": "gpt-4o-mini",
  "modelMetaData": {
    "temperature": 0.7,
    "maxTokens": 4096
  },
  "isActive": true
}
'
import requests

url = "https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/agents"

payload = {
"name": "<string>",
"icon": "<string>",
"description": "<string>",
"tools": ["<string>"],
"apiTools": ["<string>"],
"mcpServers": ["<string>"],
"instruction": "<string>",
"metaData": {},
"model": "gpt-4o-mini",
"modelMetaData": {
"temperature": 0.7,
"maxTokens": 4096
},
"isActive": True
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
icon: '<string>',
description: '<string>',
tools: ['<string>'],
apiTools: ['<string>'],
mcpServers: ['<string>'],
instruction: '<string>',
metaData: {},
model: 'gpt-4o-mini',
modelMetaData: {temperature: 0.7, maxTokens: 4096},
isActive: true
})
};

fetch('https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/agents', 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://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/agents",
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([
'name' => '<string>',
'icon' => '<string>',
'description' => '<string>',
'tools' => [
'<string>'
],
'apiTools' => [
'<string>'
],
'mcpServers' => [
'<string>'
],
'instruction' => '<string>',
'metaData' => [

],
'model' => 'gpt-4o-mini',
'modelMetaData' => [
'temperature' => 0.7,
'maxTokens' => 4096
],
'isActive' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <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://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/agents"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"icon\": \"<string>\",\n \"description\": \"<string>\",\n \"tools\": [\n \"<string>\"\n ],\n \"apiTools\": [\n \"<string>\"\n ],\n \"mcpServers\": [\n \"<string>\"\n ],\n \"instruction\": \"<string>\",\n \"metaData\": {},\n \"model\": \"gpt-4o-mini\",\n \"modelMetaData\": {\n \"temperature\": 0.7,\n \"maxTokens\": 4096\n },\n \"isActive\": true\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("apikey", "<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://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/agents")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"icon\": \"<string>\",\n \"description\": \"<string>\",\n \"tools\": [\n \"<string>\"\n ],\n \"apiTools\": [\n \"<string>\"\n ],\n \"mcpServers\": [\n \"<string>\"\n ],\n \"instruction\": \"<string>\",\n \"metaData\": {},\n \"model\": \"gpt-4o-mini\",\n \"modelMetaData\": {\n \"temperature\": 0.7,\n \"maxTokens\": 4096\n },\n \"isActive\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/agents")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"icon\": \"<string>\",\n \"description\": \"<string>\",\n \"tools\": [\n \"<string>\"\n ],\n \"apiTools\": [\n \"<string>\"\n ],\n \"mcpServers\": [\n \"<string>\"\n ],\n \"instruction\": \"<string>\",\n \"metaData\": {},\n \"model\": \"gpt-4o-mini\",\n \"modelMetaData\": {\n \"temperature\": 0.7,\n \"maxTokens\": 4096\n },\n \"isActive\": true\n}"

response = http.request(request)
puts response.read_body
{
  "agent": {
    "uid": "agent-uuid-1234",
    "appId": "my-app-id",
    "name": "Support Agent",
    "icon": "https://example.com/icon.png",
    "isActive": true,
    "description": "A helpful support agent",
    "tools": [
      "gmail",
      "slack"
    ],
    "files": [],
    "websites": [],
    "otherKbIntegrations": [],
    "apiTools": [],
    "mcpServers": [],
    "frontendActions": [],
    "ragVersion": "v2",
    "lastMessageAt": null,
    "instruction": "You are a helpful assistant",
    "formattedInstruction": "You are a helpful assistant",
    "metaData": {},
    "model": "gpt-4o-mini",
    "modelMetaData": {},
    "createdAt": 1700000000000,
    "updatedAt": 1700000000000
  }
}
For the complete error reference, see Error Guide.

Authorizations

apikey
string
header
required

API Key (i.e. Rest API Key from the Dashboard).

Headers

chatApiVersion
string
default:v3.0

Chat API version. Defaults to v3.0.

Body

application/json
name
string
required

Name of the agent

icon
string

URL to the icon/avatar of the agent

description
string

Description of the agent

tools
string[]

Array of tool names available to this agent

apiTools
string[]

Array of API tool names available to this agent

mcpServers
string[]

Array of MCP server names available to this agent

instruction
string

Instructions for the agent behavior

metaData
object

Additional metadata for the agent

model
string
default:gpt-4o-mini

AI model to use for this agent

modelMetaData
object

Configuration metadata for the AI model

isActive
boolean
default:true

Is the agent active?

Response

201 - application/json

Agent created successfully

agent
object