curl --request POST \
--url https://api.swarms.world/v1/agent/batch/completions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
[
{
"agent_config": {
"agent_name": "<string>",
"description": "<string>",
"system_prompt": "<string>",
"marketplace_prompt_id": "<string>",
"model_name": "gpt-4.1",
"auto_generate_prompt": false,
"max_tokens": 8192,
"temperature": 123,
"role": "worker",
"max_loops": 1,
"tools_list_dictionary": [
{}
],
"selected_tools": "<string>",
"mcp_url": "<string>",
"streaming_on": false,
"llm_args": {},
"dynamic_temperature_enabled": true,
"mcp_config": {
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
},
"mcp_configs": {
"connections": [
{
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
}
]
},
"tool_call_summary": true,
"reasoning_effort": "low",
"thinking_tokens": 123,
"reasoning_enabled": false,
"publish_to_marketplace": false,
"use_cases": [
{}
],
"tags": [
"<string>"
],
"capabilities": [
"<string>"
],
"category": "<string>",
"is_free": true,
"price_usd": 123,
"handoffs": [
"<unknown>"
]
},
"task": "<string>",
"history": {},
"img": "<string>",
"imgs": [
"<string>"
],
"tools_enabled": [
"<string>"
]
}
]
'import requests
url = "https://api.swarms.world/v1/agent/batch/completions"
payload = [
{
"agent_config": {
"agent_name": "<string>",
"description": "<string>",
"system_prompt": "<string>",
"marketplace_prompt_id": "<string>",
"model_name": "gpt-4.1",
"auto_generate_prompt": False,
"max_tokens": 8192,
"temperature": 123,
"role": "worker",
"max_loops": 1,
"tools_list_dictionary": [{}],
"selected_tools": "<string>",
"mcp_url": "<string>",
"streaming_on": False,
"llm_args": {},
"dynamic_temperature_enabled": True,
"mcp_config": {
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
},
"mcp_configs": { "connections": [
{
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
}
] },
"tool_call_summary": True,
"reasoning_effort": "low",
"thinking_tokens": 123,
"reasoning_enabled": False,
"publish_to_marketplace": False,
"use_cases": [{}],
"tags": ["<string>"],
"capabilities": ["<string>"],
"category": "<string>",
"is_free": True,
"price_usd": 123,
"handoffs": ["<unknown>"]
},
"task": "<string>",
"history": {},
"img": "<string>",
"imgs": ["<string>"],
"tools_enabled": ["<string>"]
}
]
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
agent_config: {
agent_name: '<string>',
description: '<string>',
system_prompt: '<string>',
marketplace_prompt_id: '<string>',
model_name: 'gpt-4.1',
auto_generate_prompt: false,
max_tokens: 8192,
temperature: 123,
role: 'worker',
max_loops: 1,
tools_list_dictionary: [{}],
selected_tools: '<string>',
mcp_url: '<string>',
streaming_on: false,
llm_args: {},
dynamic_temperature_enabled: true,
mcp_config: {
type: 'mcp',
url: 'http://localhost:8000/mcp',
tool_configurations: {},
authorization_token: '<string>',
transport: 'streamable_http',
headers: {},
timeout: 10
},
mcp_configs: {
connections: [
{
type: 'mcp',
url: 'http://localhost:8000/mcp',
tool_configurations: {},
authorization_token: '<string>',
transport: 'streamable_http',
headers: {},
timeout: 10
}
]
},
tool_call_summary: true,
reasoning_effort: 'low',
thinking_tokens: 123,
reasoning_enabled: false,
publish_to_marketplace: false,
use_cases: [{}],
tags: ['<string>'],
capabilities: ['<string>'],
category: '<string>',
is_free: true,
price_usd: 123,
handoffs: ['<unknown>']
},
task: '<string>',
history: {},
img: '<string>',
imgs: ['<string>'],
tools_enabled: ['<string>']
}
])
};
fetch('https://api.swarms.world/v1/agent/batch/completions', 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.swarms.world/v1/agent/batch/completions",
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_config' => [
'agent_name' => '<string>',
'description' => '<string>',
'system_prompt' => '<string>',
'marketplace_prompt_id' => '<string>',
'model_name' => 'gpt-4.1',
'auto_generate_prompt' => false,
'max_tokens' => 8192,
'temperature' => 123,
'role' => 'worker',
'max_loops' => 1,
'tools_list_dictionary' => [
[
]
],
'selected_tools' => '<string>',
'mcp_url' => '<string>',
'streaming_on' => false,
'llm_args' => [
],
'dynamic_temperature_enabled' => true,
'mcp_config' => [
'type' => 'mcp',
'url' => 'http://localhost:8000/mcp',
'tool_configurations' => [
],
'authorization_token' => '<string>',
'transport' => 'streamable_http',
'headers' => [
],
'timeout' => 10
],
'mcp_configs' => [
'connections' => [
[
'type' => 'mcp',
'url' => 'http://localhost:8000/mcp',
'tool_configurations' => [
],
'authorization_token' => '<string>',
'transport' => 'streamable_http',
'headers' => [
],
'timeout' => 10
]
]
],
'tool_call_summary' => true,
'reasoning_effort' => 'low',
'thinking_tokens' => 123,
'reasoning_enabled' => false,
'publish_to_marketplace' => false,
'use_cases' => [
[
]
],
'tags' => [
'<string>'
],
'capabilities' => [
'<string>'
],
'category' => '<string>',
'is_free' => true,
'price_usd' => 123,
'handoffs' => [
'<unknown>'
]
],
'task' => '<string>',
'history' => [
],
'img' => '<string>',
'imgs' => [
'<string>'
],
'tools_enabled' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-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://api.swarms.world/v1/agent/batch/completions"
payload := strings.NewReader("[\n {\n \"agent_config\": {\n \"agent_name\": \"<string>\",\n \"description\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"marketplace_prompt_id\": \"<string>\",\n \"model_name\": \"gpt-4.1\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 8192,\n \"temperature\": 123,\n \"role\": \"worker\",\n \"max_loops\": 1,\n \"tools_list_dictionary\": [\n {}\n ],\n \"selected_tools\": \"<string>\",\n \"mcp_url\": \"<string>\",\n \"streaming_on\": false,\n \"llm_args\": {},\n \"dynamic_temperature_enabled\": true,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n }\n ]\n },\n \"tool_call_summary\": true,\n \"reasoning_effort\": \"low\",\n \"thinking_tokens\": 123,\n \"reasoning_enabled\": false,\n \"publish_to_marketplace\": false,\n \"use_cases\": [\n {}\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"capabilities\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"is_free\": true,\n \"price_usd\": 123,\n \"handoffs\": [\n \"<unknown>\"\n ]\n },\n \"task\": \"<string>\",\n \"history\": {},\n \"img\": \"<string>\",\n \"imgs\": [\n \"<string>\"\n ],\n \"tools_enabled\": [\n \"<string>\"\n ]\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-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://api.swarms.world/v1/agent/batch/completions")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"agent_config\": {\n \"agent_name\": \"<string>\",\n \"description\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"marketplace_prompt_id\": \"<string>\",\n \"model_name\": \"gpt-4.1\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 8192,\n \"temperature\": 123,\n \"role\": \"worker\",\n \"max_loops\": 1,\n \"tools_list_dictionary\": [\n {}\n ],\n \"selected_tools\": \"<string>\",\n \"mcp_url\": \"<string>\",\n \"streaming_on\": false,\n \"llm_args\": {},\n \"dynamic_temperature_enabled\": true,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n }\n ]\n },\n \"tool_call_summary\": true,\n \"reasoning_effort\": \"low\",\n \"thinking_tokens\": 123,\n \"reasoning_enabled\": false,\n \"publish_to_marketplace\": false,\n \"use_cases\": [\n {}\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"capabilities\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"is_free\": true,\n \"price_usd\": 123,\n \"handoffs\": [\n \"<unknown>\"\n ]\n },\n \"task\": \"<string>\",\n \"history\": {},\n \"img\": \"<string>\",\n \"imgs\": [\n \"<string>\"\n ],\n \"tools_enabled\": [\n \"<string>\"\n ]\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swarms.world/v1/agent/batch/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"agent_config\": {\n \"agent_name\": \"<string>\",\n \"description\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"marketplace_prompt_id\": \"<string>\",\n \"model_name\": \"gpt-4.1\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 8192,\n \"temperature\": 123,\n \"role\": \"worker\",\n \"max_loops\": 1,\n \"tools_list_dictionary\": [\n {}\n ],\n \"selected_tools\": \"<string>\",\n \"mcp_url\": \"<string>\",\n \"streaming_on\": false,\n \"llm_args\": {},\n \"dynamic_temperature_enabled\": true,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n }\n ]\n },\n \"tool_call_summary\": true,\n \"reasoning_effort\": \"low\",\n \"thinking_tokens\": 123,\n \"reasoning_enabled\": false,\n \"publish_to_marketplace\": false,\n \"use_cases\": [\n {}\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"capabilities\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"is_free\": true,\n \"price_usd\": 123,\n \"handoffs\": [\n \"<unknown>\"\n ]\n },\n \"task\": \"<string>\",\n \"history\": {},\n \"img\": \"<string>\",\n \"imgs\": [\n \"<string>\"\n ],\n \"tools_enabled\": [\n \"<string>\"\n ]\n }\n]"
response = http.request(request)
puts response.read_body{
"batch_id": "<string>",
"total_requests": 123,
"results": "<unknown>",
"execution_time": 123,
"timestamp": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Execute Batch Agent Completions
Execute multiple agent completions concurrently using optimized thread pool execution. This is a premium-only feature.
curl --request POST \
--url https://api.swarms.world/v1/agent/batch/completions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
[
{
"agent_config": {
"agent_name": "<string>",
"description": "<string>",
"system_prompt": "<string>",
"marketplace_prompt_id": "<string>",
"model_name": "gpt-4.1",
"auto_generate_prompt": false,
"max_tokens": 8192,
"temperature": 123,
"role": "worker",
"max_loops": 1,
"tools_list_dictionary": [
{}
],
"selected_tools": "<string>",
"mcp_url": "<string>",
"streaming_on": false,
"llm_args": {},
"dynamic_temperature_enabled": true,
"mcp_config": {
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
},
"mcp_configs": {
"connections": [
{
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
}
]
},
"tool_call_summary": true,
"reasoning_effort": "low",
"thinking_tokens": 123,
"reasoning_enabled": false,
"publish_to_marketplace": false,
"use_cases": [
{}
],
"tags": [
"<string>"
],
"capabilities": [
"<string>"
],
"category": "<string>",
"is_free": true,
"price_usd": 123,
"handoffs": [
"<unknown>"
]
},
"task": "<string>",
"history": {},
"img": "<string>",
"imgs": [
"<string>"
],
"tools_enabled": [
"<string>"
]
}
]
'import requests
url = "https://api.swarms.world/v1/agent/batch/completions"
payload = [
{
"agent_config": {
"agent_name": "<string>",
"description": "<string>",
"system_prompt": "<string>",
"marketplace_prompt_id": "<string>",
"model_name": "gpt-4.1",
"auto_generate_prompt": False,
"max_tokens": 8192,
"temperature": 123,
"role": "worker",
"max_loops": 1,
"tools_list_dictionary": [{}],
"selected_tools": "<string>",
"mcp_url": "<string>",
"streaming_on": False,
"llm_args": {},
"dynamic_temperature_enabled": True,
"mcp_config": {
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
},
"mcp_configs": { "connections": [
{
"type": "mcp",
"url": "http://localhost:8000/mcp",
"tool_configurations": {},
"authorization_token": "<string>",
"transport": "streamable_http",
"headers": {},
"timeout": 10
}
] },
"tool_call_summary": True,
"reasoning_effort": "low",
"thinking_tokens": 123,
"reasoning_enabled": False,
"publish_to_marketplace": False,
"use_cases": [{}],
"tags": ["<string>"],
"capabilities": ["<string>"],
"category": "<string>",
"is_free": True,
"price_usd": 123,
"handoffs": ["<unknown>"]
},
"task": "<string>",
"history": {},
"img": "<string>",
"imgs": ["<string>"],
"tools_enabled": ["<string>"]
}
]
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
agent_config: {
agent_name: '<string>',
description: '<string>',
system_prompt: '<string>',
marketplace_prompt_id: '<string>',
model_name: 'gpt-4.1',
auto_generate_prompt: false,
max_tokens: 8192,
temperature: 123,
role: 'worker',
max_loops: 1,
tools_list_dictionary: [{}],
selected_tools: '<string>',
mcp_url: '<string>',
streaming_on: false,
llm_args: {},
dynamic_temperature_enabled: true,
mcp_config: {
type: 'mcp',
url: 'http://localhost:8000/mcp',
tool_configurations: {},
authorization_token: '<string>',
transport: 'streamable_http',
headers: {},
timeout: 10
},
mcp_configs: {
connections: [
{
type: 'mcp',
url: 'http://localhost:8000/mcp',
tool_configurations: {},
authorization_token: '<string>',
transport: 'streamable_http',
headers: {},
timeout: 10
}
]
},
tool_call_summary: true,
reasoning_effort: 'low',
thinking_tokens: 123,
reasoning_enabled: false,
publish_to_marketplace: false,
use_cases: [{}],
tags: ['<string>'],
capabilities: ['<string>'],
category: '<string>',
is_free: true,
price_usd: 123,
handoffs: ['<unknown>']
},
task: '<string>',
history: {},
img: '<string>',
imgs: ['<string>'],
tools_enabled: ['<string>']
}
])
};
fetch('https://api.swarms.world/v1/agent/batch/completions', 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.swarms.world/v1/agent/batch/completions",
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_config' => [
'agent_name' => '<string>',
'description' => '<string>',
'system_prompt' => '<string>',
'marketplace_prompt_id' => '<string>',
'model_name' => 'gpt-4.1',
'auto_generate_prompt' => false,
'max_tokens' => 8192,
'temperature' => 123,
'role' => 'worker',
'max_loops' => 1,
'tools_list_dictionary' => [
[
]
],
'selected_tools' => '<string>',
'mcp_url' => '<string>',
'streaming_on' => false,
'llm_args' => [
],
'dynamic_temperature_enabled' => true,
'mcp_config' => [
'type' => 'mcp',
'url' => 'http://localhost:8000/mcp',
'tool_configurations' => [
],
'authorization_token' => '<string>',
'transport' => 'streamable_http',
'headers' => [
],
'timeout' => 10
],
'mcp_configs' => [
'connections' => [
[
'type' => 'mcp',
'url' => 'http://localhost:8000/mcp',
'tool_configurations' => [
],
'authorization_token' => '<string>',
'transport' => 'streamable_http',
'headers' => [
],
'timeout' => 10
]
]
],
'tool_call_summary' => true,
'reasoning_effort' => 'low',
'thinking_tokens' => 123,
'reasoning_enabled' => false,
'publish_to_marketplace' => false,
'use_cases' => [
[
]
],
'tags' => [
'<string>'
],
'capabilities' => [
'<string>'
],
'category' => '<string>',
'is_free' => true,
'price_usd' => 123,
'handoffs' => [
'<unknown>'
]
],
'task' => '<string>',
'history' => [
],
'img' => '<string>',
'imgs' => [
'<string>'
],
'tools_enabled' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-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://api.swarms.world/v1/agent/batch/completions"
payload := strings.NewReader("[\n {\n \"agent_config\": {\n \"agent_name\": \"<string>\",\n \"description\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"marketplace_prompt_id\": \"<string>\",\n \"model_name\": \"gpt-4.1\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 8192,\n \"temperature\": 123,\n \"role\": \"worker\",\n \"max_loops\": 1,\n \"tools_list_dictionary\": [\n {}\n ],\n \"selected_tools\": \"<string>\",\n \"mcp_url\": \"<string>\",\n \"streaming_on\": false,\n \"llm_args\": {},\n \"dynamic_temperature_enabled\": true,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n }\n ]\n },\n \"tool_call_summary\": true,\n \"reasoning_effort\": \"low\",\n \"thinking_tokens\": 123,\n \"reasoning_enabled\": false,\n \"publish_to_marketplace\": false,\n \"use_cases\": [\n {}\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"capabilities\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"is_free\": true,\n \"price_usd\": 123,\n \"handoffs\": [\n \"<unknown>\"\n ]\n },\n \"task\": \"<string>\",\n \"history\": {},\n \"img\": \"<string>\",\n \"imgs\": [\n \"<string>\"\n ],\n \"tools_enabled\": [\n \"<string>\"\n ]\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-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://api.swarms.world/v1/agent/batch/completions")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"agent_config\": {\n \"agent_name\": \"<string>\",\n \"description\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"marketplace_prompt_id\": \"<string>\",\n \"model_name\": \"gpt-4.1\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 8192,\n \"temperature\": 123,\n \"role\": \"worker\",\n \"max_loops\": 1,\n \"tools_list_dictionary\": [\n {}\n ],\n \"selected_tools\": \"<string>\",\n \"mcp_url\": \"<string>\",\n \"streaming_on\": false,\n \"llm_args\": {},\n \"dynamic_temperature_enabled\": true,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n }\n ]\n },\n \"tool_call_summary\": true,\n \"reasoning_effort\": \"low\",\n \"thinking_tokens\": 123,\n \"reasoning_enabled\": false,\n \"publish_to_marketplace\": false,\n \"use_cases\": [\n {}\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"capabilities\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"is_free\": true,\n \"price_usd\": 123,\n \"handoffs\": [\n \"<unknown>\"\n ]\n },\n \"task\": \"<string>\",\n \"history\": {},\n \"img\": \"<string>\",\n \"imgs\": [\n \"<string>\"\n ],\n \"tools_enabled\": [\n \"<string>\"\n ]\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swarms.world/v1/agent/batch/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"agent_config\": {\n \"agent_name\": \"<string>\",\n \"description\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"marketplace_prompt_id\": \"<string>\",\n \"model_name\": \"gpt-4.1\",\n \"auto_generate_prompt\": false,\n \"max_tokens\": 8192,\n \"temperature\": 123,\n \"role\": \"worker\",\n \"max_loops\": 1,\n \"tools_list_dictionary\": [\n {}\n ],\n \"selected_tools\": \"<string>\",\n \"mcp_url\": \"<string>\",\n \"streaming_on\": false,\n \"llm_args\": {},\n \"dynamic_temperature_enabled\": true,\n \"mcp_config\": {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n },\n \"mcp_configs\": {\n \"connections\": [\n {\n \"type\": \"mcp\",\n \"url\": \"http://localhost:8000/mcp\",\n \"tool_configurations\": {},\n \"authorization_token\": \"<string>\",\n \"transport\": \"streamable_http\",\n \"headers\": {},\n \"timeout\": 10\n }\n ]\n },\n \"tool_call_summary\": true,\n \"reasoning_effort\": \"low\",\n \"thinking_tokens\": 123,\n \"reasoning_enabled\": false,\n \"publish_to_marketplace\": false,\n \"use_cases\": [\n {}\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"capabilities\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"is_free\": true,\n \"price_usd\": 123,\n \"handoffs\": [\n \"<unknown>\"\n ]\n },\n \"task\": \"<string>\",\n \"history\": {},\n \"img\": \"<string>\",\n \"imgs\": [\n \"<string>\"\n ],\n \"tools_enabled\": [\n \"<string>\"\n ]\n }\n]"
response = http.request(request)
puts response.read_body{
"batch_id": "<string>",
"total_requests": 123,
"results": "<unknown>",
"execution_time": 123,
"timestamp": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Headers
Body
The configuration of the agent to be completed.
Show child attributes
Show child attributes
The task to be completed by the agent.
The history of the agent's previous tasks and responses. Can be either a dictionary or a list of message objects.
- History · object
- History · object[]
A base64 encoded image for the agent to process. Encode your image file to base64 and pass it here.
A list of base64 encoded images for the agent to process. Encode your image files to base64 and pass them here.
A list of tools that the agent should use to complete its task.
Response
Successful Response
The unique identifier for the agent batch completion.
The total number of requests in the batch.
The outputs generated by the agent.
The execution time of the agent batch completion.
The timestamp when the agent batch completion was created.
Was this page helpful?