Create Agent
Endpoint to create a new agent.
- No Mage triggers are created during agent creation
- Triggers are lazily created when first scheduling a run via /schedule_run
- This allows for flexible scheduling (cron expressions, @hourly, @daily, etc.)
curl --request POST \
--url https://api.example.com/api/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_name": "<string>",
"agent_model": "<string>",
"agent_description": "<string>",
"agent_instruction": "<string>",
"agent_type": "<string>",
"agent_model_params": {},
"agent_tools": [],
"input_schema": {},
"output_schema": {},
"output_key": "<string>",
"output_schema_name": "<string>",
"skip_when_upstream": "<string>",
"sub_agents": [
"<string>"
],
"project_id": "thaink2",
"code_executor": "<string>",
"tags": [
"<string>"
],
"guardrails_config": {},
"memory_enabled": false,
"artifacts_enabled": false,
"superagent_template_id": "<string>",
"loop_max_iterations": 123,
"loop_exit_instruction": "<string>",
"mcp_servers": [
{
"name": "",
"transport": "http",
"url": "",
"headers": {},
"params": {},
"command": "",
"args": [],
"env": {},
"mcp_type": "<string>",
"toolset": "<string>",
"db_type": "<string>",
"db_database": "<string>"
}
],
"agent_skills": [
"<string>"
],
"hub_origin_id": "<string>",
"propagate_api_key": false
}
'import requests
url = "https://api.example.com/api/agents"
payload = {
"agent_name": "<string>",
"agent_model": "<string>",
"agent_description": "<string>",
"agent_instruction": "<string>",
"agent_type": "<string>",
"agent_model_params": {},
"agent_tools": [],
"input_schema": {},
"output_schema": {},
"output_key": "<string>",
"output_schema_name": "<string>",
"skip_when_upstream": "<string>",
"sub_agents": ["<string>"],
"project_id": "thaink2",
"code_executor": "<string>",
"tags": ["<string>"],
"guardrails_config": {},
"memory_enabled": False,
"artifacts_enabled": False,
"superagent_template_id": "<string>",
"loop_max_iterations": 123,
"loop_exit_instruction": "<string>",
"mcp_servers": [
{
"name": "",
"transport": "http",
"url": "",
"headers": {},
"params": {},
"command": "",
"args": [],
"env": {},
"mcp_type": "<string>",
"toolset": "<string>",
"db_type": "<string>",
"db_database": "<string>"
}
],
"agent_skills": ["<string>"],
"hub_origin_id": "<string>",
"propagate_api_key": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_name: '<string>',
agent_model: '<string>',
agent_description: '<string>',
agent_instruction: '<string>',
agent_type: '<string>',
agent_model_params: {},
agent_tools: [],
input_schema: {},
output_schema: {},
output_key: '<string>',
output_schema_name: '<string>',
skip_when_upstream: '<string>',
sub_agents: ['<string>'],
project_id: 'thaink2',
code_executor: '<string>',
tags: ['<string>'],
guardrails_config: {},
memory_enabled: false,
artifacts_enabled: false,
superagent_template_id: '<string>',
loop_max_iterations: 123,
loop_exit_instruction: '<string>',
mcp_servers: [
{
name: '',
transport: 'http',
url: '',
headers: {},
params: {},
command: '',
args: [],
env: {},
mcp_type: '<string>',
toolset: '<string>',
db_type: '<string>',
db_database: '<string>'
}
],
agent_skills: ['<string>'],
hub_origin_id: '<string>',
propagate_api_key: false
})
};
fetch('https://api.example.com/api/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://api.example.com/api/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([
'agent_name' => '<string>',
'agent_model' => '<string>',
'agent_description' => '<string>',
'agent_instruction' => '<string>',
'agent_type' => '<string>',
'agent_model_params' => [
],
'agent_tools' => [
],
'input_schema' => [
],
'output_schema' => [
],
'output_key' => '<string>',
'output_schema_name' => '<string>',
'skip_when_upstream' => '<string>',
'sub_agents' => [
'<string>'
],
'project_id' => 'thaink2',
'code_executor' => '<string>',
'tags' => [
'<string>'
],
'guardrails_config' => [
],
'memory_enabled' => false,
'artifacts_enabled' => false,
'superagent_template_id' => '<string>',
'loop_max_iterations' => 123,
'loop_exit_instruction' => '<string>',
'mcp_servers' => [
[
'name' => '',
'transport' => 'http',
'url' => '',
'headers' => [
],
'params' => [
],
'command' => '',
'args' => [
],
'env' => [
],
'mcp_type' => '<string>',
'toolset' => '<string>',
'db_type' => '<string>',
'db_database' => '<string>'
]
],
'agent_skills' => [
'<string>'
],
'hub_origin_id' => '<string>',
'propagate_api_key' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.example.com/api/agents"
payload := strings.NewReader("{\n \"agent_name\": \"<string>\",\n \"agent_model\": \"<string>\",\n \"agent_description\": \"<string>\",\n \"agent_instruction\": \"<string>\",\n \"agent_type\": \"<string>\",\n \"agent_model_params\": {},\n \"agent_tools\": [],\n \"input_schema\": {},\n \"output_schema\": {},\n \"output_key\": \"<string>\",\n \"output_schema_name\": \"<string>\",\n \"skip_when_upstream\": \"<string>\",\n \"sub_agents\": [\n \"<string>\"\n ],\n \"project_id\": \"thaink2\",\n \"code_executor\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"guardrails_config\": {},\n \"memory_enabled\": false,\n \"artifacts_enabled\": false,\n \"superagent_template_id\": \"<string>\",\n \"loop_max_iterations\": 123,\n \"loop_exit_instruction\": \"<string>\",\n \"mcp_servers\": [\n {\n \"name\": \"\",\n \"transport\": \"http\",\n \"url\": \"\",\n \"headers\": {},\n \"params\": {},\n \"command\": \"\",\n \"args\": [],\n \"env\": {},\n \"mcp_type\": \"<string>\",\n \"toolset\": \"<string>\",\n \"db_type\": \"<string>\",\n \"db_database\": \"<string>\"\n }\n ],\n \"agent_skills\": [\n \"<string>\"\n ],\n \"hub_origin_id\": \"<string>\",\n \"propagate_api_key\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/api/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"<string>\",\n \"agent_model\": \"<string>\",\n \"agent_description\": \"<string>\",\n \"agent_instruction\": \"<string>\",\n \"agent_type\": \"<string>\",\n \"agent_model_params\": {},\n \"agent_tools\": [],\n \"input_schema\": {},\n \"output_schema\": {},\n \"output_key\": \"<string>\",\n \"output_schema_name\": \"<string>\",\n \"skip_when_upstream\": \"<string>\",\n \"sub_agents\": [\n \"<string>\"\n ],\n \"project_id\": \"thaink2\",\n \"code_executor\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"guardrails_config\": {},\n \"memory_enabled\": false,\n \"artifacts_enabled\": false,\n \"superagent_template_id\": \"<string>\",\n \"loop_max_iterations\": 123,\n \"loop_exit_instruction\": \"<string>\",\n \"mcp_servers\": [\n {\n \"name\": \"\",\n \"transport\": \"http\",\n \"url\": \"\",\n \"headers\": {},\n \"params\": {},\n \"command\": \"\",\n \"args\": [],\n \"env\": {},\n \"mcp_type\": \"<string>\",\n \"toolset\": \"<string>\",\n \"db_type\": \"<string>\",\n \"db_database\": \"<string>\"\n }\n ],\n \"agent_skills\": [\n \"<string>\"\n ],\n \"hub_origin_id\": \"<string>\",\n \"propagate_api_key\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/agents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_name\": \"<string>\",\n \"agent_model\": \"<string>\",\n \"agent_description\": \"<string>\",\n \"agent_instruction\": \"<string>\",\n \"agent_type\": \"<string>\",\n \"agent_model_params\": {},\n \"agent_tools\": [],\n \"input_schema\": {},\n \"output_schema\": {},\n \"output_key\": \"<string>\",\n \"output_schema_name\": \"<string>\",\n \"skip_when_upstream\": \"<string>\",\n \"sub_agents\": [\n \"<string>\"\n ],\n \"project_id\": \"thaink2\",\n \"code_executor\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"guardrails_config\": {},\n \"memory_enabled\": false,\n \"artifacts_enabled\": false,\n \"superagent_template_id\": \"<string>\",\n \"loop_max_iterations\": 123,\n \"loop_exit_instruction\": \"<string>\",\n \"mcp_servers\": [\n {\n \"name\": \"\",\n \"transport\": \"http\",\n \"url\": \"\",\n \"headers\": {},\n \"params\": {},\n \"command\": \"\",\n \"args\": [],\n \"env\": {},\n \"mcp_type\": \"<string>\",\n \"toolset\": \"<string>\",\n \"db_type\": \"<string>\",\n \"db_database\": \"<string>\"\n }\n ],\n \"agent_skills\": [\n \"<string>\"\n ],\n \"hub_origin_id\": \"<string>\",\n \"propagate_api_key\": false\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Schema for creating a new agent. Attributes: name: str - The name of the agent. model: str - The model used by the agent. description: str - A brief description of the agent. instruction: str - Instructions for the agent's behavior. tools: list[str] - A list of tool paths used by the agent. input_schema: dict | None - The input schema for the agent (optional). output_schema: dict | None - The output schema for the agent (optional). organization_id: str - The ID of the organization the agent belongs to. project_id: str - The ID of the project the agent is associated with. owner_id: str - The ID of the owner of the agent. tags: list[str] | None - A list of tags associated with the agent (optional).
Show child attributes
Show child attributes
Response
Successful Response
curl --request POST \
--url https://api.example.com/api/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_name": "<string>",
"agent_model": "<string>",
"agent_description": "<string>",
"agent_instruction": "<string>",
"agent_type": "<string>",
"agent_model_params": {},
"agent_tools": [],
"input_schema": {},
"output_schema": {},
"output_key": "<string>",
"output_schema_name": "<string>",
"skip_when_upstream": "<string>",
"sub_agents": [
"<string>"
],
"project_id": "thaink2",
"code_executor": "<string>",
"tags": [
"<string>"
],
"guardrails_config": {},
"memory_enabled": false,
"artifacts_enabled": false,
"superagent_template_id": "<string>",
"loop_max_iterations": 123,
"loop_exit_instruction": "<string>",
"mcp_servers": [
{
"name": "",
"transport": "http",
"url": "",
"headers": {},
"params": {},
"command": "",
"args": [],
"env": {},
"mcp_type": "<string>",
"toolset": "<string>",
"db_type": "<string>",
"db_database": "<string>"
}
],
"agent_skills": [
"<string>"
],
"hub_origin_id": "<string>",
"propagate_api_key": false
}
'import requests
url = "https://api.example.com/api/agents"
payload = {
"agent_name": "<string>",
"agent_model": "<string>",
"agent_description": "<string>",
"agent_instruction": "<string>",
"agent_type": "<string>",
"agent_model_params": {},
"agent_tools": [],
"input_schema": {},
"output_schema": {},
"output_key": "<string>",
"output_schema_name": "<string>",
"skip_when_upstream": "<string>",
"sub_agents": ["<string>"],
"project_id": "thaink2",
"code_executor": "<string>",
"tags": ["<string>"],
"guardrails_config": {},
"memory_enabled": False,
"artifacts_enabled": False,
"superagent_template_id": "<string>",
"loop_max_iterations": 123,
"loop_exit_instruction": "<string>",
"mcp_servers": [
{
"name": "",
"transport": "http",
"url": "",
"headers": {},
"params": {},
"command": "",
"args": [],
"env": {},
"mcp_type": "<string>",
"toolset": "<string>",
"db_type": "<string>",
"db_database": "<string>"
}
],
"agent_skills": ["<string>"],
"hub_origin_id": "<string>",
"propagate_api_key": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_name: '<string>',
agent_model: '<string>',
agent_description: '<string>',
agent_instruction: '<string>',
agent_type: '<string>',
agent_model_params: {},
agent_tools: [],
input_schema: {},
output_schema: {},
output_key: '<string>',
output_schema_name: '<string>',
skip_when_upstream: '<string>',
sub_agents: ['<string>'],
project_id: 'thaink2',
code_executor: '<string>',
tags: ['<string>'],
guardrails_config: {},
memory_enabled: false,
artifacts_enabled: false,
superagent_template_id: '<string>',
loop_max_iterations: 123,
loop_exit_instruction: '<string>',
mcp_servers: [
{
name: '',
transport: 'http',
url: '',
headers: {},
params: {},
command: '',
args: [],
env: {},
mcp_type: '<string>',
toolset: '<string>',
db_type: '<string>',
db_database: '<string>'
}
],
agent_skills: ['<string>'],
hub_origin_id: '<string>',
propagate_api_key: false
})
};
fetch('https://api.example.com/api/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://api.example.com/api/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([
'agent_name' => '<string>',
'agent_model' => '<string>',
'agent_description' => '<string>',
'agent_instruction' => '<string>',
'agent_type' => '<string>',
'agent_model_params' => [
],
'agent_tools' => [
],
'input_schema' => [
],
'output_schema' => [
],
'output_key' => '<string>',
'output_schema_name' => '<string>',
'skip_when_upstream' => '<string>',
'sub_agents' => [
'<string>'
],
'project_id' => 'thaink2',
'code_executor' => '<string>',
'tags' => [
'<string>'
],
'guardrails_config' => [
],
'memory_enabled' => false,
'artifacts_enabled' => false,
'superagent_template_id' => '<string>',
'loop_max_iterations' => 123,
'loop_exit_instruction' => '<string>',
'mcp_servers' => [
[
'name' => '',
'transport' => 'http',
'url' => '',
'headers' => [
],
'params' => [
],
'command' => '',
'args' => [
],
'env' => [
],
'mcp_type' => '<string>',
'toolset' => '<string>',
'db_type' => '<string>',
'db_database' => '<string>'
]
],
'agent_skills' => [
'<string>'
],
'hub_origin_id' => '<string>',
'propagate_api_key' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.example.com/api/agents"
payload := strings.NewReader("{\n \"agent_name\": \"<string>\",\n \"agent_model\": \"<string>\",\n \"agent_description\": \"<string>\",\n \"agent_instruction\": \"<string>\",\n \"agent_type\": \"<string>\",\n \"agent_model_params\": {},\n \"agent_tools\": [],\n \"input_schema\": {},\n \"output_schema\": {},\n \"output_key\": \"<string>\",\n \"output_schema_name\": \"<string>\",\n \"skip_when_upstream\": \"<string>\",\n \"sub_agents\": [\n \"<string>\"\n ],\n \"project_id\": \"thaink2\",\n \"code_executor\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"guardrails_config\": {},\n \"memory_enabled\": false,\n \"artifacts_enabled\": false,\n \"superagent_template_id\": \"<string>\",\n \"loop_max_iterations\": 123,\n \"loop_exit_instruction\": \"<string>\",\n \"mcp_servers\": [\n {\n \"name\": \"\",\n \"transport\": \"http\",\n \"url\": \"\",\n \"headers\": {},\n \"params\": {},\n \"command\": \"\",\n \"args\": [],\n \"env\": {},\n \"mcp_type\": \"<string>\",\n \"toolset\": \"<string>\",\n \"db_type\": \"<string>\",\n \"db_database\": \"<string>\"\n }\n ],\n \"agent_skills\": [\n \"<string>\"\n ],\n \"hub_origin_id\": \"<string>\",\n \"propagate_api_key\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/api/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"<string>\",\n \"agent_model\": \"<string>\",\n \"agent_description\": \"<string>\",\n \"agent_instruction\": \"<string>\",\n \"agent_type\": \"<string>\",\n \"agent_model_params\": {},\n \"agent_tools\": [],\n \"input_schema\": {},\n \"output_schema\": {},\n \"output_key\": \"<string>\",\n \"output_schema_name\": \"<string>\",\n \"skip_when_upstream\": \"<string>\",\n \"sub_agents\": [\n \"<string>\"\n ],\n \"project_id\": \"thaink2\",\n \"code_executor\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"guardrails_config\": {},\n \"memory_enabled\": false,\n \"artifacts_enabled\": false,\n \"superagent_template_id\": \"<string>\",\n \"loop_max_iterations\": 123,\n \"loop_exit_instruction\": \"<string>\",\n \"mcp_servers\": [\n {\n \"name\": \"\",\n \"transport\": \"http\",\n \"url\": \"\",\n \"headers\": {},\n \"params\": {},\n \"command\": \"\",\n \"args\": [],\n \"env\": {},\n \"mcp_type\": \"<string>\",\n \"toolset\": \"<string>\",\n \"db_type\": \"<string>\",\n \"db_database\": \"<string>\"\n }\n ],\n \"agent_skills\": [\n \"<string>\"\n ],\n \"hub_origin_id\": \"<string>\",\n \"propagate_api_key\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/agents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_name\": \"<string>\",\n \"agent_model\": \"<string>\",\n \"agent_description\": \"<string>\",\n \"agent_instruction\": \"<string>\",\n \"agent_type\": \"<string>\",\n \"agent_model_params\": {},\n \"agent_tools\": [],\n \"input_schema\": {},\n \"output_schema\": {},\n \"output_key\": \"<string>\",\n \"output_schema_name\": \"<string>\",\n \"skip_when_upstream\": \"<string>\",\n \"sub_agents\": [\n \"<string>\"\n ],\n \"project_id\": \"thaink2\",\n \"code_executor\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"guardrails_config\": {},\n \"memory_enabled\": false,\n \"artifacts_enabled\": false,\n \"superagent_template_id\": \"<string>\",\n \"loop_max_iterations\": 123,\n \"loop_exit_instruction\": \"<string>\",\n \"mcp_servers\": [\n {\n \"name\": \"\",\n \"transport\": \"http\",\n \"url\": \"\",\n \"headers\": {},\n \"params\": {},\n \"command\": \"\",\n \"args\": [],\n \"env\": {},\n \"mcp_type\": \"<string>\",\n \"toolset\": \"<string>\",\n \"db_type\": \"<string>\",\n \"db_database\": \"<string>\"\n }\n ],\n \"agent_skills\": [\n \"<string>\"\n ],\n \"hub_origin_id\": \"<string>\",\n \"propagate_api_key\": false\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}