Register a background agent
POST
/
background
/
agents
Register a background agent
curl --request POST \
--url http://localhost:8000/background/agents \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"replace": false,
"spec": {
"agent_id": "<string>",
"agent_config": {},
"created_at": "2023-11-07T05:31:56Z",
"local_tools_ref": "<string>",
"mcp_tools": [
{}
],
"metadata": {},
"model_config": {},
"name": "<string>",
"system_instruction": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"workspace_config": {}
}
}
'import requests
url = "http://localhost:8000/background/agents"
payload = {
"agent_id": "<string>",
"replace": False,
"spec": {
"agent_id": "<string>",
"agent_config": {},
"created_at": "2023-11-07T05:31:56Z",
"local_tools_ref": "<string>",
"mcp_tools": [{}],
"metadata": {},
"model_config": {},
"name": "<string>",
"system_instruction": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"workspace_config": {}
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '<string>',
replace: false,
spec: {
agent_id: '<string>',
agent_config: {},
created_at: '2023-11-07T05:31:56Z',
local_tools_ref: '<string>',
mcp_tools: [{}],
metadata: {},
model_config: {},
name: '<string>',
system_instruction: '<string>',
updated_at: '2023-11-07T05:31:56Z',
workspace_config: {}
}
})
};
fetch('http://localhost:8000/background/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 => "8000",
CURLOPT_URL => "http://localhost:8000/background/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_id' => '<string>',
'replace' => false,
'spec' => [
'agent_id' => '<string>',
'agent_config' => [
],
'created_at' => '2023-11-07T05:31:56Z',
'local_tools_ref' => '<string>',
'mcp_tools' => [
[
]
],
'metadata' => [
],
'model_config' => [
],
'name' => '<string>',
'system_instruction' => '<string>',
'updated_at' => '2023-11-07T05:31:56Z',
'workspace_config' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"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://localhost:8000/background/agents"
payload := strings.NewReader("{\n \"agent_id\": \"<string>\",\n \"replace\": false,\n \"spec\": {\n \"agent_id\": \"<string>\",\n \"agent_config\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"local_tools_ref\": \"<string>\",\n \"mcp_tools\": [\n {}\n ],\n \"metadata\": {},\n \"model_config\": {},\n \"name\": \"<string>\",\n \"system_instruction\": \"<string>\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"workspace_config\": {}\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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://localhost:8000/background/agents")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"replace\": false,\n \"spec\": {\n \"agent_id\": \"<string>\",\n \"agent_config\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"local_tools_ref\": \"<string>\",\n \"mcp_tools\": [\n {}\n ],\n \"metadata\": {},\n \"model_config\": {},\n \"name\": \"<string>\",\n \"system_instruction\": \"<string>\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"workspace_config\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/background/agents")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"<string>\",\n \"replace\": false,\n \"spec\": {\n \"agent_id\": \"<string>\",\n \"agent_config\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"local_tools_ref\": \"<string>\",\n \"mcp_tools\": [\n {}\n ],\n \"metadata\": {},\n \"model_config\": {},\n \"name\": \"<string>\",\n \"system_instruction\": \"<string>\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"workspace_config\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"agent_id": "<string>",
"agent_config": {},
"created_at": "2023-11-07T05:31:56Z",
"local_tools_ref": "<string>",
"mcp_tools": [
{}
],
"metadata": {},
"model_config": {},
"name": "<string>",
"system_instruction": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"workspace_config": {}
}{
"detail": "<unknown>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}{
"detail": "<unknown>"
}Body
application/json
Register the served agent or an agent spec for background work.
Response
Successful Response
⌘I
Register a background agent
curl --request POST \
--url http://localhost:8000/background/agents \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"replace": false,
"spec": {
"agent_id": "<string>",
"agent_config": {},
"created_at": "2023-11-07T05:31:56Z",
"local_tools_ref": "<string>",
"mcp_tools": [
{}
],
"metadata": {},
"model_config": {},
"name": "<string>",
"system_instruction": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"workspace_config": {}
}
}
'import requests
url = "http://localhost:8000/background/agents"
payload = {
"agent_id": "<string>",
"replace": False,
"spec": {
"agent_id": "<string>",
"agent_config": {},
"created_at": "2023-11-07T05:31:56Z",
"local_tools_ref": "<string>",
"mcp_tools": [{}],
"metadata": {},
"model_config": {},
"name": "<string>",
"system_instruction": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"workspace_config": {}
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '<string>',
replace: false,
spec: {
agent_id: '<string>',
agent_config: {},
created_at: '2023-11-07T05:31:56Z',
local_tools_ref: '<string>',
mcp_tools: [{}],
metadata: {},
model_config: {},
name: '<string>',
system_instruction: '<string>',
updated_at: '2023-11-07T05:31:56Z',
workspace_config: {}
}
})
};
fetch('http://localhost:8000/background/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 => "8000",
CURLOPT_URL => "http://localhost:8000/background/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_id' => '<string>',
'replace' => false,
'spec' => [
'agent_id' => '<string>',
'agent_config' => [
],
'created_at' => '2023-11-07T05:31:56Z',
'local_tools_ref' => '<string>',
'mcp_tools' => [
[
]
],
'metadata' => [
],
'model_config' => [
],
'name' => '<string>',
'system_instruction' => '<string>',
'updated_at' => '2023-11-07T05:31:56Z',
'workspace_config' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"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://localhost:8000/background/agents"
payload := strings.NewReader("{\n \"agent_id\": \"<string>\",\n \"replace\": false,\n \"spec\": {\n \"agent_id\": \"<string>\",\n \"agent_config\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"local_tools_ref\": \"<string>\",\n \"mcp_tools\": [\n {}\n ],\n \"metadata\": {},\n \"model_config\": {},\n \"name\": \"<string>\",\n \"system_instruction\": \"<string>\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"workspace_config\": {}\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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://localhost:8000/background/agents")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"replace\": false,\n \"spec\": {\n \"agent_id\": \"<string>\",\n \"agent_config\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"local_tools_ref\": \"<string>\",\n \"mcp_tools\": [\n {}\n ],\n \"metadata\": {},\n \"model_config\": {},\n \"name\": \"<string>\",\n \"system_instruction\": \"<string>\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"workspace_config\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/background/agents")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"<string>\",\n \"replace\": false,\n \"spec\": {\n \"agent_id\": \"<string>\",\n \"agent_config\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"local_tools_ref\": \"<string>\",\n \"mcp_tools\": [\n {}\n ],\n \"metadata\": {},\n \"model_config\": {},\n \"name\": \"<string>\",\n \"system_instruction\": \"<string>\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"workspace_config\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"agent_id": "<string>",
"agent_config": {},
"created_at": "2023-11-07T05:31:56Z",
"local_tools_ref": "<string>",
"mcp_tools": [
{}
],
"metadata": {},
"model_config": {},
"name": "<string>",
"system_instruction": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"workspace_config": {}
}{
"detail": "<unknown>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}{
"detail": "<unknown>"
}