Event feedback
curl --request PUT \
--url https://agp.eu.hcompany.ai/api/v2/sessions/{id}/events/{event_index}/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}/events/{event_index}/feedback"
payload = {
"success": True,
"message": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
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}/events/{event_index}/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}/events/{event_index}/feedback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
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}/events/{event_index}/feedback"
payload := strings.NewReader("{\n \"success\": true,\n \"message\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://agp.eu.hcompany.ai/api/v2/sessions/{id}/events/{event_index}/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}/events/{event_index}/feedback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.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_bodySessions
Event feedback
Submit feedback on one event within a session to flag a wrong or good step.
PUT
/
api
/
v2
/
sessions
/
{id}
/
events
/
{event_index}
/
feedback
Event feedback
curl --request PUT \
--url https://agp.eu.hcompany.ai/api/v2/sessions/{id}/events/{event_index}/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}/events/{event_index}/feedback"
payload = {
"success": True,
"message": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
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}/events/{event_index}/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}/events/{event_index}/feedback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
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}/events/{event_index}/feedback"
payload := strings.NewReader("{\n \"success\": true,\n \"message\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://agp.eu.hcompany.ai/api/v2/sessions/{id}/events/{event_index}/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}/events/{event_index}/feedback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.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_bodySubmits feedback on one event in a session you own, for example to flag the step where the agent went wrong. For the whole run, use Session feedback.
Returns
204 No Content.
Path parameters
string
required
The session ID.
integer
required
The event’s position in the session’s event list.
Request body
boolean
required
Whether this step was correct.
string
Details on the feedback.
Examples
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",
},
});
Errors
| Status | Cause |
|---|---|
404 | event_index is out of range. |
Was this page helpful?