Stop a fleet turn
curl --request PATCH \
--url https://api.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "cancelled"
}
'import requests
url = "https://api.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_id}"
payload = { "status": "cancelled" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: 'cancelled'})
};
fetch('https://api.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_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://api.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_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([
'status' => 'cancelled'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_id}"
payload := strings.NewReader("{\n \"status\": \"cancelled\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"cancelled\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"cancelled\"\n}"
response = http.request(request)
puts response.read_body{
"actor": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"event_type": "<string>",
"fleet_id": "<string>",
"request_json": "<string>",
"status": "<string>",
"turn_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"workspace_id": "<string>",
"cost_nanos": "<string>",
"durable_task_activity": {
"items": [
{
"kind": "durable_task_decision_started",
"progress": {
"activity_id": "<string>",
"completed": 1,
"operation": "goal",
"phase": "starting",
"bytes": {
"acknowledged": 1,
"missing": 1,
"reused": 1
},
"durable_task_id": "<string>",
"model": "<string>",
"provider": "<string>",
"sequence": 1,
"source_turn_id": "<string>",
"total": 1
}
}
]
},
"failure_detail": "<string>",
"failure_label": "<string>",
"response_text": "<string>",
"resumes_turn_id": "<string>",
"tokens": 123,
"tool_calls": {
"calls": [
{
"arguments": {},
"call_id": "<string>",
"duration_ms": 1,
"name": "<string>",
"status": "succeeded",
"changes": [
{
"added": 1,
"path": "<string>",
"removed": 1
}
],
"exit_code": 123,
"output_head": "<string>",
"output_line_count": 1,
"output_tail": "<string>",
"sources": [
{
"url": "<string>",
"title": "<string>"
}
]
}
],
"sources_in_items": true
},
"wall_ms": 123
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}Fleet events
Stop a fleet turn
Stops a turn with {"status":"cancelled"}. A queued turn is cancelled and never runs. A running turn is cancelled with every turn its run serves. The runner ends the run within one renewal interval. Its usage is billed, and it gets no answer. A waiting turn’s open approval closes. Repeating the call answers the same state. A turn that already finished answers 409 and keeps its answer. Requires fleet:write.
PATCH
/
v1
/
workspaces
/
{workspace_id}
/
fleets
/
{fleet_id}
/
turns
/
{turn_id}
Stop a fleet turn
curl --request PATCH \
--url https://api.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "cancelled"
}
'import requests
url = "https://api.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_id}"
payload = { "status": "cancelled" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: 'cancelled'})
};
fetch('https://api.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_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://api.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_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([
'status' => 'cancelled'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_id}"
payload := strings.NewReader("{\n \"status\": \"cancelled\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"cancelled\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agentsfleet.net/v1/workspaces/{workspace_id}/fleets/{fleet_id}/turns/{turn_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"cancelled\"\n}"
response = http.request(request)
puts response.read_body{
"actor": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"event_type": "<string>",
"fleet_id": "<string>",
"request_json": "<string>",
"status": "<string>",
"turn_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"workspace_id": "<string>",
"cost_nanos": "<string>",
"durable_task_activity": {
"items": [
{
"kind": "durable_task_decision_started",
"progress": {
"activity_id": "<string>",
"completed": 1,
"operation": "goal",
"phase": "starting",
"bytes": {
"acknowledged": 1,
"missing": 1,
"reused": 1
},
"durable_task_id": "<string>",
"model": "<string>",
"provider": "<string>",
"sequence": 1,
"source_turn_id": "<string>",
"total": 1
}
}
]
},
"failure_detail": "<string>",
"failure_label": "<string>",
"response_text": "<string>",
"resumes_turn_id": "<string>",
"tokens": 123,
"tool_calls": {
"calls": [
{
"arguments": {},
"call_id": "<string>",
"duration_ms": 1,
"name": "<string>",
"status": "succeeded",
"changes": [
{
"added": 1,
"path": "<string>",
"removed": 1
}
],
"exit_code": 123,
"output_head": "<string>",
"output_line_count": 1,
"output_tail": "<string>",
"sources": [
{
"url": "<string>",
"title": "<string>"
}
]
}
],
"sources_in_items": true
},
"wall_ms": 123
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"local_read_permitted": true,
"outcome": "<string>",
"resolved_at": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"user_message": "<string>"
}Authorizations
Path Parameters
Body
application/json
Response
OK
One turn as the expanded view renders it — bodies included.