curl --request POST \
--url http://127.0.0.1:8400/v1/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"model": "<string>",
"instructions": "<string>",
"tools": [
{
"name": "bash",
"description": "<string>",
"input_schema": {}
}
],
"mcp_servers": [
{
"name": "<string>",
"url": "<string>",
"headers": {}
}
],
"skills": [
"<string>"
],
"metadata": {}
}
'import requests
url = "http://127.0.0.1:8400/v1/agents"
payload = {
"name": "<string>",
"model": "<string>",
"instructions": "<string>",
"tools": [
{
"name": "bash",
"description": "<string>",
"input_schema": {}
}
],
"mcp_servers": [
{
"name": "<string>",
"url": "<string>",
"headers": {}
}
],
"skills": ["<string>"],
"metadata": {}
}
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({
name: '<string>',
model: '<string>',
instructions: '<string>',
tools: [{name: 'bash', description: '<string>', input_schema: {}}],
mcp_servers: [{name: '<string>', url: '<string>', headers: {}}],
skills: ['<string>'],
metadata: {}
})
};
fetch('http://127.0.0.1:8400/v1/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_PORT => "8400",
CURLOPT_URL => "http://127.0.0.1:8400/v1/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>',
'model' => '<string>',
'instructions' => '<string>',
'tools' => [
[
'name' => 'bash',
'description' => '<string>',
'input_schema' => [
]
]
],
'mcp_servers' => [
[
'name' => '<string>',
'url' => '<string>',
'headers' => [
]
]
],
'skills' => [
'<string>'
],
'metadata' => [
]
]),
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 := "http://127.0.0.1:8400/v1/agents"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"model\": \"<string>\",\n \"instructions\": \"<string>\",\n \"tools\": [\n {\n \"name\": \"bash\",\n \"description\": \"<string>\",\n \"input_schema\": {}\n }\n ],\n \"mcp_servers\": [\n {\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"headers\": {}\n }\n ],\n \"skills\": [\n \"<string>\"\n ],\n \"metadata\": {}\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("http://127.0.0.1:8400/v1/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"model\": \"<string>\",\n \"instructions\": \"<string>\",\n \"tools\": [\n {\n \"name\": \"bash\",\n \"description\": \"<string>\",\n \"input_schema\": {}\n }\n ],\n \"mcp_servers\": [\n {\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"headers\": {}\n }\n ],\n \"skills\": [\n \"<string>\"\n ],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8400/v1/agents")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"model\": \"<string>\",\n \"instructions\": \"<string>\",\n \"tools\": [\n {\n \"name\": \"bash\",\n \"description\": \"<string>\",\n \"input_schema\": {}\n }\n ],\n \"mcp_servers\": [\n {\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"headers\": {}\n }\n ],\n \"skills\": [\n \"<string>\"\n ],\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "agent",
"name": "<string>",
"instructions": "<string>",
"model": "<string>",
"tools": [
{
"type": "builtin",
"name": "bash",
"description": "<string>",
"input_schema": {}
}
],
"mcp_servers": [
{
"name": "<string>",
"url": "<string>",
"headers": {}
}
],
"skills": [
"<string>"
],
"metadata": {},
"status": "ready",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "model_not_mapped",
"tool": "<string>",
"clashes_with": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "model_not_mapped",
"tool": "<string>",
"clashes_with": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "model_not_mapped",
"tool": "<string>",
"clashes_with": "<string>"
}
}Create an agent
An agent is a model, a system prompt and a set of tools. If the server
uses a gateway provider, model must be in the settings model_map
(else 422 model_not_mapped). Needs role developer or admin.
curl --request POST \
--url http://127.0.0.1:8400/v1/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"model": "<string>",
"instructions": "<string>",
"tools": [
{
"name": "bash",
"description": "<string>",
"input_schema": {}
}
],
"mcp_servers": [
{
"name": "<string>",
"url": "<string>",
"headers": {}
}
],
"skills": [
"<string>"
],
"metadata": {}
}
'import requests
url = "http://127.0.0.1:8400/v1/agents"
payload = {
"name": "<string>",
"model": "<string>",
"instructions": "<string>",
"tools": [
{
"name": "bash",
"description": "<string>",
"input_schema": {}
}
],
"mcp_servers": [
{
"name": "<string>",
"url": "<string>",
"headers": {}
}
],
"skills": ["<string>"],
"metadata": {}
}
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({
name: '<string>',
model: '<string>',
instructions: '<string>',
tools: [{name: 'bash', description: '<string>', input_schema: {}}],
mcp_servers: [{name: '<string>', url: '<string>', headers: {}}],
skills: ['<string>'],
metadata: {}
})
};
fetch('http://127.0.0.1:8400/v1/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_PORT => "8400",
CURLOPT_URL => "http://127.0.0.1:8400/v1/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>',
'model' => '<string>',
'instructions' => '<string>',
'tools' => [
[
'name' => 'bash',
'description' => '<string>',
'input_schema' => [
]
]
],
'mcp_servers' => [
[
'name' => '<string>',
'url' => '<string>',
'headers' => [
]
]
],
'skills' => [
'<string>'
],
'metadata' => [
]
]),
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 := "http://127.0.0.1:8400/v1/agents"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"model\": \"<string>\",\n \"instructions\": \"<string>\",\n \"tools\": [\n {\n \"name\": \"bash\",\n \"description\": \"<string>\",\n \"input_schema\": {}\n }\n ],\n \"mcp_servers\": [\n {\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"headers\": {}\n }\n ],\n \"skills\": [\n \"<string>\"\n ],\n \"metadata\": {}\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("http://127.0.0.1:8400/v1/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"model\": \"<string>\",\n \"instructions\": \"<string>\",\n \"tools\": [\n {\n \"name\": \"bash\",\n \"description\": \"<string>\",\n \"input_schema\": {}\n }\n ],\n \"mcp_servers\": [\n {\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"headers\": {}\n }\n ],\n \"skills\": [\n \"<string>\"\n ],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8400/v1/agents")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"model\": \"<string>\",\n \"instructions\": \"<string>\",\n \"tools\": [\n {\n \"name\": \"bash\",\n \"description\": \"<string>\",\n \"input_schema\": {}\n }\n ],\n \"mcp_servers\": [\n {\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"headers\": {}\n }\n ],\n \"skills\": [\n \"<string>\"\n ],\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "agent",
"name": "<string>",
"instructions": "<string>",
"model": "<string>",
"tools": [
{
"type": "builtin",
"name": "bash",
"description": "<string>",
"input_schema": {}
}
],
"mcp_servers": [
{
"name": "<string>",
"url": "<string>",
"headers": {}
}
],
"skills": [
"<string>"
],
"metadata": {},
"status": "ready",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "model_not_mapped",
"tool": "<string>",
"clashes_with": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "model_not_mapped",
"tool": "<string>",
"clashes_with": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "model_not_mapped",
"tool": "<string>",
"clashes_with": "<string>"
}
}Headers
Up to 255 characters. The key is scoped to the calling principal, the HTTP
method, the path and the key. Only 2xx responses are stored, for 24 hours.
The same key with the same body replays the stored response, with the
response header Idempotency-Replayed: true. The same key with a different
body is 422 idempotency_key_reuse. If the first request is still running,
the answer is 409 idempotency_in_progress; a record in progress for more
than 60 seconds is taken over by the new request. A key that is longer than
255 characters or not printable ASCII is 400 invalid_idempotency_key.
255Body
Response
The new agent.