Execute Flow
curl --request POST \
--url https://agent-studio.thena.ai/api/v1/flows/execute \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"flow_id": "<string>",
"trigger_data": {},
"variables": {},
"priority": "normal",
"scheduled_at": "2023-11-07T05:31:56Z",
"timeout_seconds": 300,
"retry_config": {},
"metadata": {}
}
'import requests
url = "https://agent-studio.thena.ai/api/v1/flows/execute"
payload = {
"flow_id": "<string>",
"trigger_data": {},
"variables": {},
"priority": "normal",
"scheduled_at": "2023-11-07T05:31:56Z",
"timeout_seconds": 300,
"retry_config": {},
"metadata": {}
}
headers = {
"x-api-key": "<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': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
flow_id: '<string>',
trigger_data: {},
variables: {},
priority: 'normal',
scheduled_at: '2023-11-07T05:31:56Z',
timeout_seconds: 300,
retry_config: {},
metadata: {}
})
};
fetch('https://agent-studio.thena.ai/api/v1/flows/execute', 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://agent-studio.thena.ai/api/v1/flows/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([
'flow_id' => '<string>',
'trigger_data' => [
],
'variables' => [
],
'priority' => 'normal',
'scheduled_at' => '2023-11-07T05:31:56Z',
'timeout_seconds' => 300,
'retry_config' => [
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://agent-studio.thena.ai/api/v1/flows/execute"
payload := strings.NewReader("{\n \"flow_id\": \"<string>\",\n \"trigger_data\": {},\n \"variables\": {},\n \"priority\": \"normal\",\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"timeout_seconds\": 300,\n \"retry_config\": {},\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://agent-studio.thena.ai/api/v1/flows/execute")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"flow_id\": \"<string>\",\n \"trigger_data\": {},\n \"variables\": {},\n \"priority\": \"normal\",\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"timeout_seconds\": 300,\n \"retry_config\": {},\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agent-studio.thena.ai/api/v1/flows/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"flow_id\": \"<string>\",\n \"trigger_data\": {},\n \"variables\": {},\n \"priority\": \"normal\",\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"timeout_seconds\": 300,\n \"retry_config\": {},\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"execution": {
"flow_id": "<string>",
"agent_id": "<string>",
"organization_id": "<string>",
"execution_number": 123,
"started_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"trigger_data": {},
"variables": {},
"completed_at": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"timeout_seconds": 300,
"steps": [
{
"step_id": "<string>",
"step_name": "<string>",
"step_type": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"tool_name": "<string>",
"input_data": {},
"output_data": {},
"error_message": "<string>",
"completed_at": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"retry_count": 0,
"metadata": {}
}
],
"final_output": {},
"error_message": "<string>",
"error_details": {},
"retry_count": 0,
"max_retries": 3,
"parent_execution_id": "<string>",
"tokens_used": 123,
"tool_calls_count": 0,
"cost_estimate": 123,
"performance_metrics": {},
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Flow execution
Execute Flow
Execute a flow immediately or queue for background execution.
- flow_id: ID of the flow to execute
- trigger_type: How the execution was triggered
- variables: Input variables for the flow
- priority: Execution priority (urgent, high, normal, low)
- scheduled_at: Optional datetime to schedule execution for later
POST
/
api
/
v1
/
flows
/
execute
Execute Flow
curl --request POST \
--url https://agent-studio.thena.ai/api/v1/flows/execute \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"flow_id": "<string>",
"trigger_data": {},
"variables": {},
"priority": "normal",
"scheduled_at": "2023-11-07T05:31:56Z",
"timeout_seconds": 300,
"retry_config": {},
"metadata": {}
}
'import requests
url = "https://agent-studio.thena.ai/api/v1/flows/execute"
payload = {
"flow_id": "<string>",
"trigger_data": {},
"variables": {},
"priority": "normal",
"scheduled_at": "2023-11-07T05:31:56Z",
"timeout_seconds": 300,
"retry_config": {},
"metadata": {}
}
headers = {
"x-api-key": "<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': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
flow_id: '<string>',
trigger_data: {},
variables: {},
priority: 'normal',
scheduled_at: '2023-11-07T05:31:56Z',
timeout_seconds: 300,
retry_config: {},
metadata: {}
})
};
fetch('https://agent-studio.thena.ai/api/v1/flows/execute', 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://agent-studio.thena.ai/api/v1/flows/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([
'flow_id' => '<string>',
'trigger_data' => [
],
'variables' => [
],
'priority' => 'normal',
'scheduled_at' => '2023-11-07T05:31:56Z',
'timeout_seconds' => 300,
'retry_config' => [
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://agent-studio.thena.ai/api/v1/flows/execute"
payload := strings.NewReader("{\n \"flow_id\": \"<string>\",\n \"trigger_data\": {},\n \"variables\": {},\n \"priority\": \"normal\",\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"timeout_seconds\": 300,\n \"retry_config\": {},\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://agent-studio.thena.ai/api/v1/flows/execute")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"flow_id\": \"<string>\",\n \"trigger_data\": {},\n \"variables\": {},\n \"priority\": \"normal\",\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"timeout_seconds\": 300,\n \"retry_config\": {},\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agent-studio.thena.ai/api/v1/flows/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"flow_id\": \"<string>\",\n \"trigger_data\": {},\n \"variables\": {},\n \"priority\": \"normal\",\n \"scheduled_at\": \"2023-11-07T05:31:56Z\",\n \"timeout_seconds\": 300,\n \"retry_config\": {},\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"execution": {
"flow_id": "<string>",
"agent_id": "<string>",
"organization_id": "<string>",
"execution_number": 123,
"started_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"trigger_data": {},
"variables": {},
"completed_at": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"timeout_seconds": 300,
"steps": [
{
"step_id": "<string>",
"step_name": "<string>",
"step_type": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"tool_name": "<string>",
"input_data": {},
"output_data": {},
"error_message": "<string>",
"completed_at": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"retry_count": 0,
"metadata": {}
}
],
"final_output": {},
"error_message": "<string>",
"error_details": {},
"retry_count": 0,
"max_retries": 3,
"parent_execution_id": "<string>",
"tokens_used": 123,
"tool_calls_count": 0,
"cost_estimate": 123,
"performance_metrics": {},
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
application/json
Request model for creating a flow execution.
ID of the flow to execute
How the execution was triggered
Available options:
manual, event, scheduled, api, webhook, test Data from the trigger event
Additional variables for execution
Execution priority
Available options:
low, normal, high, urgent When to execute (for scheduled executions)
Execution timeout in seconds
Retry configuration
Additional execution metadata
⌘I