Session feedback
curl --request POST \
--url https://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"success": true,
"message": "<string>"
}
'import requests
url = "https://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback"
payload = {
"success": True,
"message": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({success: true, message: '<string>'})
};
fetch('https://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback', 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://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback",
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([
'success' => true,
'message' => '<string>'
]),
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://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback"
payload := strings.NewReader("{\n \"success\": true,\n \"message\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"success\": true,\n \"message\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"success\": true,\n \"message\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyManage
Session feedback
Submit feedback on a session or individual event.
POST
/
api
/
v2
/
sessions
/
{id}
/
feedback
Session feedback
curl --request POST \
--url https://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"success": true,
"message": "<string>"
}
'import requests
url = "https://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback"
payload = {
"success": True,
"message": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({success: true, message: '<string>'})
};
fetch('https://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback', 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://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback",
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([
'success' => true,
'message' => '<string>'
]),
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://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback"
payload := strings.NewReader("{\n \"success\": true,\n \"message\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"success\": true,\n \"message\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/sessions/{id}/feedback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"success\": true,\n \"message\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodySubmit feedback on a session you own. Use this to report whether the agent completed its task successfully.
Returns
Same body, with
204 No Content.
Path parameters
The session ID.
Request body
Whether the session completed its task successfully.
Optional feedback message with details.
Examples
Session feedback
curl -X POST https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/feedback \
-H "Authorization: Bearer $HAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"success": true,
"message": "Task completed correctly"
}'
from hai_agents import Client
client = Client()
client.sessions.submit_session_feedback(
session_id,
success=True,
message="Task completed correctly",
)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
await client.sessions.submitSessionFeedback({
id: sessionId,
body: {
success: true,
message: "Task completed correctly",
},
});
Event feedback
You can also submit feedback on a specific event within the session:PUT /api/v2/sessions/{id}/events/{event_index}/feedback
event_index identifying the event by its position in the session’s event list. Returns 204 No Content, or 404 when the index is out of range.
curl -X PUT https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/events/5/feedback \
-H "Authorization: Bearer $HAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"success": false,
"message": "Agent clicked the wrong button at this step"
}'
from hai_agents import Client
client = Client()
client.sessions.submit_event_feedback(
session_id,
5,
success=False,
message="Agent clicked the wrong button at this step",
)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
await client.sessions.submitEventFeedback({
id: sessionId,
eventIndex: 5,
body: {
success: false,
message: "Agent clicked the wrong button at this step",
},
});
Was this page helpful?
⌘I