Execute Agent
POST /api/agents/{id}/execute
Execute a specific agent by ID.
Code Examples
- cURL
- Node.js
- Python
- PHP
- Java
- Go
- .NET
- Ruby
curl --request POST \
--url 'https://tess.pareto.io/api/agents/{id}/execute' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"temperature": "1",
"model": "tess-ai-light",
"messages": [
{ "role": "user", "content": "hello there!" }
],
"tools": "no-tools",
"waitExecution": false
}'
const axios = require('axios');
const data = {
"temperature": "1",
"model": "tess-ai-light",
"messages": [
{ "role": "user", "content": "hello there!" }
],
"tools": "no-tools",
"waitExecution": false
};
const config = {
method: 'post',
url: 'https://tess.pareto.io/api/agents/{id}/execute',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
data: data
};
try {
const response = await axios(config);
console.log(response.data);
} catch (error) {
console.error(error);
}
import requests
import json
url = "https://tess.pareto.io/api/agents/{id}/execute"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"temperature": "1",
"model": "tess-ai-light",
"messages": [
{ "role": "user", "content": "hello there!" }
],
"tools": "no-tools",
"waitExecution": false
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
<?php
$curl = curl_init();
$data = [
"temperature" => "1",
"model" => "tess-ai-light",
"messages" => [
[ "role" => "user", "content" => "hello there!" ]
],
"tools" => "no-tools",
"waitExecution" => false
];
curl_setopt_array($curl, [
CURLOPT_URL => "https://tess.pareto.io/api/agents/{id}/execute",
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($data),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json"
]
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Error: " . $err;
} else {
echo $response;
}
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Map;
public class Main {
public static void main(String[] args) throws Exception {
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> data = Map.of(
"temperature", "1",
"model", "tess-ai-light",
"messages", List.of(Map.of("role", "user", "content", "hello there!")),
"tools", "no-tools",
"waitExecution", false
);
String jsonPayload = mapper.writeValueAsString(data);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://tess.pareto.io/api/agents/{id}/execute"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
package main
import (
"fmt"
"strings"
"io/ioutil"
"net/http"
)
func main() {
payload := `{
"temperature": "1",
"model": "tess-ai-light",
"messages": [
{ "role": "user", "content": "hello there!" }
],
"tools": "no-tools",
"waitExecution": false
}`
client := &http.Client{}
req, err := http.NewRequest("POST", "https://tess.pareto.io/api/agents/{id}/execute", strings.NewReader(payload))
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer YOUR_API_KEY")
req.Header.Add("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Collections.Generic;
class Program
{
static async Task Main(string[] args)
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
var data = new
{
temperature = "1",
model = "tess-ai-light",
messages = new List<object> { new { role = "user", content = "hello there!" } },
tools = "no-tools",
waitExecution = false
};
var jsonPayload = JsonConvert.SerializeObject(data);
var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
try
{
var response = await client.PostAsync("https://tess.pareto.io/api/agents/{id}/execute", content);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine("\nException Caught!");
Console.WriteLine("Message :{0} ", e.Message);
}
}
}
}
require 'uri'
require 'net/http'
require 'json'
uri = URI('https://tess.pareto.io/api/agents/{id}/execute')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = {
"temperature": "1",
"model": "tess-ai-light",
"messages": [
{ "role": "user", "content": "hello there!" }
],
"tools": "no-tools",
"waitExecution": false
}.to_json
response = http.request(request)
puts response.read_body
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | integer | Yes | The agent ID |
Request Body
Parameter | Type | Required | Description |
---|---|---|---|
answers | object | Yes | The agent answers |
messages | array | Only for Chat Agent | The agent messages |
waitExecution | boolean | No | Indicates if the execution should wait until completion. Default: false |
Response
{
"template_id": "8794",
"responses": [
{
"id": 4773337,
"status": "starting",
"input": "hello",
"output": "",
"credits": 0.000337,
"root_id": 4773337,
"created_at": "2025-01-05T19:35:21.000000Z",
"updated_at": "2025-01-05T19:35:21.000000Z",
"template_id": 8794
}
]
}
Try it out!
Authentication
This endpoint requires Bearer token authentication.