curl --request POST \
--url https://{appid}.api-{region}.cometchat.io/v3/ai-agents/agents \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"name": "My Mastra Agent",
"icon": "<string>",
"integrateWith": "mastra",
"integrationType": "agent",
"isActive": true,
"tools": [
"<string>"
],
"actions": [
"<string>"
],
"metaData": {
"greetingMessage": "<string>",
"introductoryMessage": "<string>",
"suggestedMessages": [
"<string>"
]
}
}
'import requests
url = "https://{appid}.api-{region}.cometchat.io/v3/ai-agents/agents"
payload = {
"name": "My Mastra Agent",
"icon": "<string>",
"integrateWith": "mastra",
"integrationType": "agent",
"isActive": True,
"tools": ["<string>"],
"actions": ["<string>"],
"metaData": {
"greetingMessage": "<string>",
"introductoryMessage": "<string>",
"suggestedMessages": ["<string>"]
}
}
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: 'My Mastra Agent',
icon: '<string>',
integrateWith: 'mastra',
integrationType: 'agent',
isActive: true,
tools: ['<string>'],
actions: ['<string>'],
metaData: {
greetingMessage: '<string>',
introductoryMessage: '<string>',
suggestedMessages: ['<string>']
}
})
};
fetch('https://{appid}.api-{region}.cometchat.io/v3/ai-agents/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/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' => 'My Mastra Agent',
'icon' => '<string>',
'integrateWith' => 'mastra',
'integrationType' => 'agent',
'isActive' => true,
'tools' => [
'<string>'
],
'actions' => [
'<string>'
],
'metaData' => [
'greetingMessage' => '<string>',
'introductoryMessage' => '<string>',
'suggestedMessages' => [
'<string>'
]
]
]),
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/agents"
payload := strings.NewReader("{\n \"name\": \"My Mastra Agent\",\n \"icon\": \"<string>\",\n \"integrateWith\": \"mastra\",\n \"integrationType\": \"agent\",\n \"isActive\": true,\n \"tools\": [\n \"<string>\"\n ],\n \"actions\": [\n \"<string>\"\n ],\n \"metaData\": {\n \"greetingMessage\": \"<string>\",\n \"introductoryMessage\": \"<string>\",\n \"suggestedMessages\": [\n \"<string>\"\n ]\n }\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/agents")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Mastra Agent\",\n \"icon\": \"<string>\",\n \"integrateWith\": \"mastra\",\n \"integrationType\": \"agent\",\n \"isActive\": true,\n \"tools\": [\n \"<string>\"\n ],\n \"actions\": [\n \"<string>\"\n ],\n \"metaData\": {\n \"greetingMessage\": \"<string>\",\n \"introductoryMessage\": \"<string>\",\n \"suggestedMessages\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appid}.api-{region}.cometchat.io/v3/ai-agents/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\": \"My Mastra Agent\",\n \"icon\": \"<string>\",\n \"integrateWith\": \"mastra\",\n \"integrationType\": \"agent\",\n \"isActive\": true,\n \"tools\": [\n \"<string>\"\n ],\n \"actions\": [\n \"<string>\"\n ],\n \"metaData\": {\n \"greetingMessage\": \"<string>\",\n \"introductoryMessage\": \"<string>\",\n \"suggestedMessages\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"agent": {
"uid": "550e8400-e29b-41d4-a716-446655440000",
"appId": "my-app-id",
"name": "My Agent",
"icon": "https://example.com/icon.png",
"isActive": true,
"integrateWith": "openai",
"integrationType": "agent",
"tools": [
"tool1"
],
"actions": [
"action1"
],
"instruction": "You are a helpful assistant",
"integrationMeta": {},
"metaData": {},
"deletedAt": null,
"createdAt": "2025-12-01T00:00:00.000Z",
"updatedAt": "2025-12-01T00:00:00.000Z"
}
}Create BYO Agent
Creates a new BYO Agent that delegates conversations to an external AI Agent. Use this endpoint to register a BYO (Bring Your Own) agent powered by frameworks like Mastra, CrewAI, or LangGraph.
Validation: All referenced tools and actions are validated before the agent is created.
curl --request POST \
--url https://{appid}.api-{region}.cometchat.io/v3/ai-agents/agents \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"name": "My Mastra Agent",
"icon": "<string>",
"integrateWith": "mastra",
"integrationType": "agent",
"isActive": true,
"tools": [
"<string>"
],
"actions": [
"<string>"
],
"metaData": {
"greetingMessage": "<string>",
"introductoryMessage": "<string>",
"suggestedMessages": [
"<string>"
]
}
}
'import requests
url = "https://{appid}.api-{region}.cometchat.io/v3/ai-agents/agents"
payload = {
"name": "My Mastra Agent",
"icon": "<string>",
"integrateWith": "mastra",
"integrationType": "agent",
"isActive": True,
"tools": ["<string>"],
"actions": ["<string>"],
"metaData": {
"greetingMessage": "<string>",
"introductoryMessage": "<string>",
"suggestedMessages": ["<string>"]
}
}
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: 'My Mastra Agent',
icon: '<string>',
integrateWith: 'mastra',
integrationType: 'agent',
isActive: true,
tools: ['<string>'],
actions: ['<string>'],
metaData: {
greetingMessage: '<string>',
introductoryMessage: '<string>',
suggestedMessages: ['<string>']
}
})
};
fetch('https://{appid}.api-{region}.cometchat.io/v3/ai-agents/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/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' => 'My Mastra Agent',
'icon' => '<string>',
'integrateWith' => 'mastra',
'integrationType' => 'agent',
'isActive' => true,
'tools' => [
'<string>'
],
'actions' => [
'<string>'
],
'metaData' => [
'greetingMessage' => '<string>',
'introductoryMessage' => '<string>',
'suggestedMessages' => [
'<string>'
]
]
]),
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/agents"
payload := strings.NewReader("{\n \"name\": \"My Mastra Agent\",\n \"icon\": \"<string>\",\n \"integrateWith\": \"mastra\",\n \"integrationType\": \"agent\",\n \"isActive\": true,\n \"tools\": [\n \"<string>\"\n ],\n \"actions\": [\n \"<string>\"\n ],\n \"metaData\": {\n \"greetingMessage\": \"<string>\",\n \"introductoryMessage\": \"<string>\",\n \"suggestedMessages\": [\n \"<string>\"\n ]\n }\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/agents")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Mastra Agent\",\n \"icon\": \"<string>\",\n \"integrateWith\": \"mastra\",\n \"integrationType\": \"agent\",\n \"isActive\": true,\n \"tools\": [\n \"<string>\"\n ],\n \"actions\": [\n \"<string>\"\n ],\n \"metaData\": {\n \"greetingMessage\": \"<string>\",\n \"introductoryMessage\": \"<string>\",\n \"suggestedMessages\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appid}.api-{region}.cometchat.io/v3/ai-agents/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\": \"My Mastra Agent\",\n \"icon\": \"<string>\",\n \"integrateWith\": \"mastra\",\n \"integrationType\": \"agent\",\n \"isActive\": true,\n \"tools\": [\n \"<string>\"\n ],\n \"actions\": [\n \"<string>\"\n ],\n \"metaData\": {\n \"greetingMessage\": \"<string>\",\n \"introductoryMessage\": \"<string>\",\n \"suggestedMessages\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"agent": {
"uid": "550e8400-e29b-41d4-a716-446655440000",
"appId": "my-app-id",
"name": "My Agent",
"icon": "https://example.com/icon.png",
"isActive": true,
"integrateWith": "openai",
"integrationType": "agent",
"tools": [
"tool1"
],
"actions": [
"action1"
],
"instruction": "You are a helpful assistant",
"integrationMeta": {},
"metaData": {},
"deletedAt": null,
"createdAt": "2025-12-01T00:00:00.000Z",
"updatedAt": "2025-12-01T00:00:00.000Z"
}
}Authorizations
API Key (i.e. Rest API Key from the Dashboard).
Headers
Chat API version. Defaults to v3.0.
Body
- Mastra
- Mastra (Legacy)
- LangGraph
- CrewAI
- Vercel AI V5
- AG2
- Rasa
- Agno
- AG-UI
Name of the agent
"My Mastra Agent"
URL to the icon/avatar of the agent
Integration platform identifier
mastra Type of connection
agent Whether the agent is active
Mastra-specific configuration
Show child attributes
Show child attributes
List of tool names (must exist in the app's tools)
List of action names (must exist in the app's actions)
Metadata for the agent
Show child attributes
Show child attributes
Response
Agent created successfully
Show child attributes
Show child attributes
Was this page helpful?