Execute Reasoning Agent Completion
curl --request POST \
--url https://api.swarms.world/v1/reasoning-agent/completions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"agent_name": "reasoning-agent",
"description": "A reasoning agent that can answer questions and help with tasks.",
"model_name": "claude-sonnet-5",
"system_prompt": "<string>",
"max_loops": 1,
"swarm_type": "self-consistency",
"num_samples": 1,
"memory_capacity": 123,
"task": "<string>"
}
'import requests
url = "https://api.swarms.world/v1/reasoning-agent/completions"
payload = {
"agent_name": "reasoning-agent",
"description": "A reasoning agent that can answer questions and help with tasks.",
"model_name": "claude-sonnet-5",
"system_prompt": "<string>",
"max_loops": 1,
"swarm_type": "self-consistency",
"num_samples": 1,
"memory_capacity": 123,
"task": "<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_name: 'reasoning-agent',
description: 'A reasoning agent that can answer questions and help with tasks.',
model_name: 'claude-sonnet-5',
system_prompt: '<string>',
max_loops: 1,
swarm_type: 'self-consistency',
num_samples: 1,
memory_capacity: 123,
task: '<string>'
})
};
fetch('https://api.swarms.world/v1/reasoning-agent/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/reasoning-agent/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_name' => 'reasoning-agent',
'description' => 'A reasoning agent that can answer questions and help with tasks.',
'model_name' => 'claude-sonnet-5',
'system_prompt' => '<string>',
'max_loops' => 1,
'swarm_type' => 'self-consistency',
'num_samples' => 1,
'memory_capacity' => 123,
'task' => '<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/reasoning-agent/completions"
payload := strings.NewReader("{\n \"agent_name\": \"reasoning-agent\",\n \"description\": \"A reasoning agent that can answer questions and help with tasks.\",\n \"model_name\": \"claude-sonnet-5\",\n \"system_prompt\": \"<string>\",\n \"max_loops\": 1,\n \"swarm_type\": \"self-consistency\",\n \"num_samples\": 1,\n \"memory_capacity\": 123,\n \"task\": \"<string>\"\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/reasoning-agent/completions")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"reasoning-agent\",\n \"description\": \"A reasoning agent that can answer questions and help with tasks.\",\n \"model_name\": \"claude-sonnet-5\",\n \"system_prompt\": \"<string>\",\n \"max_loops\": 1,\n \"swarm_type\": \"self-consistency\",\n \"num_samples\": 1,\n \"memory_capacity\": 123,\n \"task\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swarms.world/v1/reasoning-agent/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 \"agent_name\": \"reasoning-agent\",\n \"description\": \"A reasoning agent that can answer questions and help with tasks.\",\n \"model_name\": \"claude-sonnet-5\",\n \"system_prompt\": \"<string>\",\n \"max_loops\": 1,\n \"swarm_type\": \"self-consistency\",\n \"num_samples\": 1,\n \"memory_capacity\": 123,\n \"task\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"outputs": "<unknown>",
"timestamp": "<string>",
"agent_name": "<string>",
"agent_type": "<string>",
"agent_id": "<string>",
"usage": {},
"status": "success"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Reasoning Agents
Execute Reasoning Agent Completion
Execute a reasoning agent with advanced cognitive capabilities for complex problem-solving tasks. This is a premium-only feature.
POST
/
v1
/
reasoning-agent
/
completions
Execute Reasoning Agent Completion
curl --request POST \
--url https://api.swarms.world/v1/reasoning-agent/completions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"agent_name": "reasoning-agent",
"description": "A reasoning agent that can answer questions and help with tasks.",
"model_name": "claude-sonnet-5",
"system_prompt": "<string>",
"max_loops": 1,
"swarm_type": "self-consistency",
"num_samples": 1,
"memory_capacity": 123,
"task": "<string>"
}
'import requests
url = "https://api.swarms.world/v1/reasoning-agent/completions"
payload = {
"agent_name": "reasoning-agent",
"description": "A reasoning agent that can answer questions and help with tasks.",
"model_name": "claude-sonnet-5",
"system_prompt": "<string>",
"max_loops": 1,
"swarm_type": "self-consistency",
"num_samples": 1,
"memory_capacity": 123,
"task": "<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_name: 'reasoning-agent',
description: 'A reasoning agent that can answer questions and help with tasks.',
model_name: 'claude-sonnet-5',
system_prompt: '<string>',
max_loops: 1,
swarm_type: 'self-consistency',
num_samples: 1,
memory_capacity: 123,
task: '<string>'
})
};
fetch('https://api.swarms.world/v1/reasoning-agent/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/reasoning-agent/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_name' => 'reasoning-agent',
'description' => 'A reasoning agent that can answer questions and help with tasks.',
'model_name' => 'claude-sonnet-5',
'system_prompt' => '<string>',
'max_loops' => 1,
'swarm_type' => 'self-consistency',
'num_samples' => 1,
'memory_capacity' => 123,
'task' => '<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/reasoning-agent/completions"
payload := strings.NewReader("{\n \"agent_name\": \"reasoning-agent\",\n \"description\": \"A reasoning agent that can answer questions and help with tasks.\",\n \"model_name\": \"claude-sonnet-5\",\n \"system_prompt\": \"<string>\",\n \"max_loops\": 1,\n \"swarm_type\": \"self-consistency\",\n \"num_samples\": 1,\n \"memory_capacity\": 123,\n \"task\": \"<string>\"\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/reasoning-agent/completions")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"reasoning-agent\",\n \"description\": \"A reasoning agent that can answer questions and help with tasks.\",\n \"model_name\": \"claude-sonnet-5\",\n \"system_prompt\": \"<string>\",\n \"max_loops\": 1,\n \"swarm_type\": \"self-consistency\",\n \"num_samples\": 1,\n \"memory_capacity\": 123,\n \"task\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.swarms.world/v1/reasoning-agent/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 \"agent_name\": \"reasoning-agent\",\n \"description\": \"A reasoning agent that can answer questions and help with tasks.\",\n \"model_name\": \"claude-sonnet-5\",\n \"system_prompt\": \"<string>\",\n \"max_loops\": 1,\n \"swarm_type\": \"self-consistency\",\n \"num_samples\": 1,\n \"memory_capacity\": 123,\n \"task\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"outputs": "<unknown>",
"timestamp": "<string>",
"agent_name": "<string>",
"agent_type": "<string>",
"agent_id": "<string>",
"usage": {},
"status": "success"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Body
application/json
Response
Successful Response
Was this page helpful?