Sessions
Record Turn Action
Attach the real outcome of an approved action to its turn.
POST
/
v1
/
api
/
sessions
/
{id}
/
turns
/
{turn_id}
/
action
Record Turn Action
curl --request POST \
--url https://api.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action \
--header 'Content-Type: application/json' \
--data '
{
"action": {
"success": true,
"exit_code": 123,
"stdout": "<string>",
"stderr": "<string>",
"extra": {}
},
"files_modified": [
"<string>"
]
}
'import requests
url = "https://api.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action"
payload = {
"action": {
"success": True,
"exit_code": 123,
"stdout": "<string>",
"stderr": "<string>",
"extra": {}
},
"files_modified": ["<string>"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
action: {
success: true,
exit_code: 123,
stdout: '<string>',
stderr: '<string>',
extra: {}
},
files_modified: ['<string>']
})
};
fetch('https://api.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action', 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.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action",
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([
'action' => [
'success' => true,
'exit_code' => 123,
'stdout' => '<string>',
'stderr' => '<string>',
'extra' => [
]
],
'files_modified' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action"
payload := strings.NewReader("{\n \"action\": {\n \"success\": true,\n \"exit_code\": 123,\n \"stdout\": \"<string>\",\n \"stderr\": \"<string>\",\n \"extra\": {}\n },\n \"files_modified\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action")
.header("Content-Type", "application/json")
.body("{\n \"action\": {\n \"success\": true,\n \"exit_code\": 123,\n \"stdout\": \"<string>\",\n \"stderr\": \"<string>\",\n \"extra\": {}\n },\n \"files_modified\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": {\n \"success\": true,\n \"exit_code\": 123,\n \"stdout\": \"<string>\",\n \"stderr\": \"<string>\",\n \"extra\": {}\n },\n \"files_modified\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyThe agent plugin calls this after running the tool that a human approved, so reviewers can see what actually happened (exit code, stdout/stderr excerpt, files touched) — not just what was proposed.
Body
object
required
string[]
Paths the tool touched.
Response
The updated turn withaction_taken populated.⌘I
Record Turn Action
curl --request POST \
--url https://api.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action \
--header 'Content-Type: application/json' \
--data '
{
"action": {
"success": true,
"exit_code": 123,
"stdout": "<string>",
"stderr": "<string>",
"extra": {}
},
"files_modified": [
"<string>"
]
}
'import requests
url = "https://api.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action"
payload = {
"action": {
"success": True,
"exit_code": 123,
"stdout": "<string>",
"stderr": "<string>",
"extra": {}
},
"files_modified": ["<string>"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
action: {
success: true,
exit_code: 123,
stdout: '<string>',
stderr: '<string>',
extra: {}
},
files_modified: ['<string>']
})
};
fetch('https://api.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action', 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.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action",
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([
'action' => [
'success' => true,
'exit_code' => 123,
'stdout' => '<string>',
'stderr' => '<string>',
'extra' => [
]
],
'files_modified' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action"
payload := strings.NewReader("{\n \"action\": {\n \"success\": true,\n \"exit_code\": 123,\n \"stdout\": \"<string>\",\n \"stderr\": \"<string>\",\n \"extra\": {}\n },\n \"files_modified\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action")
.header("Content-Type", "application/json")
.body("{\n \"action\": {\n \"success\": true,\n \"exit_code\": 123,\n \"stdout\": \"<string>\",\n \"stderr\": \"<string>\",\n \"extra\": {}\n },\n \"files_modified\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hitl.sh/v1/api/sessions/{id}/turns/{turn_id}/action")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": {\n \"success\": true,\n \"exit_code\": 123,\n \"stdout\": \"<string>\",\n \"stderr\": \"<string>\",\n \"extra\": {}\n },\n \"files_modified\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body