Skip to main content
PATCH
/
api
/
v1
/
flows
/
executions
/
{execution_id}
Update Execution
curl --request PATCH \
  --url https://agent-studio.thena.ai/api/v1/flows/executions/{execution_id} \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "completed_at": "2023-11-07T05:31:56Z",
  "duration_ms": 123,
  "final_output": {},
  "error_message": "<string>",
  "error_details": {},
  "retry_count": 123,
  "tokens_used": 123,
  "tool_calls_count": 123,
  "cost_estimate": 123,
  "performance_metrics": {},
  "metadata": {}
}
'
import requests

url = "https://agent-studio.thena.ai/api/v1/flows/executions/{execution_id}"

payload = {
"completed_at": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"final_output": {},
"error_message": "<string>",
"error_details": {},
"retry_count": 123,
"tokens_used": 123,
"tool_calls_count": 123,
"cost_estimate": 123,
"performance_metrics": {},
"metadata": {}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
completed_at: '2023-11-07T05:31:56Z',
duration_ms: 123,
final_output: {},
error_message: '<string>',
error_details: {},
retry_count: 123,
tokens_used: 123,
tool_calls_count: 123,
cost_estimate: 123,
performance_metrics: {},
metadata: {}
})
};

fetch('https://agent-studio.thena.ai/api/v1/flows/executions/{execution_id}', 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/executions/{execution_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'completed_at' => '2023-11-07T05:31:56Z',
'duration_ms' => 123,
'final_output' => [

],
'error_message' => '<string>',
'error_details' => [

],
'retry_count' => 123,
'tokens_used' => 123,
'tool_calls_count' => 123,
'cost_estimate' => 123,
'performance_metrics' => [

],
'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/executions/{execution_id}"

payload := strings.NewReader("{\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"duration_ms\": 123,\n \"final_output\": {},\n \"error_message\": \"<string>\",\n \"error_details\": {},\n \"retry_count\": 123,\n \"tokens_used\": 123,\n \"tool_calls_count\": 123,\n \"cost_estimate\": 123,\n \"performance_metrics\": {},\n \"metadata\": {}\n}")

req, _ := http.NewRequest("PATCH", 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.patch("https://agent-studio.thena.ai/api/v1/flows/executions/{execution_id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"duration_ms\": 123,\n \"final_output\": {},\n \"error_message\": \"<string>\",\n \"error_details\": {},\n \"retry_count\": 123,\n \"tokens_used\": 123,\n \"tool_calls_count\": 123,\n \"cost_estimate\": 123,\n \"performance_metrics\": {},\n \"metadata\": {}\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://agent-studio.thena.ai/api/v1/flows/executions/{execution_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"duration_ms\": 123,\n \"final_output\": {},\n \"error_message\": \"<string>\",\n \"error_details\": {},\n \"retry_count\": 123,\n \"tokens_used\": 123,\n \"tool_calls_count\": 123,\n \"cost_estimate\": 123,\n \"performance_metrics\": {},\n \"metadata\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "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"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

x-api-key
string
header
required

Path Parameters

execution_id
string
required

Body

application/json

Model for updating flow execution status.

status
enum<string> | null

Flow execution status enumeration.

Available options:
pending,
queued,
running,
completed,
failed,
cancelled,
timeout,
retrying
completed_at
string<date-time> | null
duration_ms
integer | null
final_output
Final Output · object | null
error_message
string | null
error_details
Error Details · object | null
retry_count
integer | null
tokens_used
integer | null
tool_calls_count
integer | null
cost_estimate
number | null
performance_metrics
Performance Metrics · object | null
metadata
Metadata · object | null

Response

Successful Response

Complete flow execution record.

flow_id
string
required

ID of the executed flow

agent_id
string
required

ID of the agent that owns the flow

organization_id
string
required

Organization ID

execution_number
integer
required

Sequential execution number for this flow

trigger_type
enum<string>
required

How the execution was triggered

Available options:
manual,
event,
scheduled,
api,
webhook,
test
priority
enum<string>
required

Execution priority

Available options:
low,
normal,
high,
urgent
status
enum<string>
required

Current execution status

Available options:
pending,
queued,
running,
completed,
failed,
cancelled,
timeout,
retrying
started_at
string<date-time>
required

When execution started

id
string

Unique execution ID

trigger_data
Trigger Data · object

Original trigger data

variables
Variables · object

Execution variables

completed_at
string<date-time> | null

When execution completed

duration_ms
integer | null

Total execution duration in milliseconds

timeout_seconds
integer
default:300

Execution timeout

steps
FlowExecutionStep · object[]

Execution steps

final_output
Final Output · object

Final execution output

error_message
string | null

Error message if execution failed

error_details
Error Details · object

Detailed error information

retry_count
integer
default:0

Number of retries attempted

max_retries
integer
default:3

Maximum number of retries

parent_execution_id
string | null

Parent execution if this is a retry

tokens_used
integer | null

Total tokens used in LLM calls

tool_calls_count
integer
default:0

Number of tool calls made

cost_estimate
number | null

Estimated cost in USD

performance_metrics
Performance Metrics · object

Performance metrics

metadata
Metadata · object

Additional execution metadata

created_at
string<date-time>

When record was created

updated_at
string<date-time>

When record was last updated