curl "$ATAI_API_ENDPOINT/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/events?limit=50" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]
response = requests.get(
f"{base_url}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/events",
headers={"Authorization": f"Bearer {api_key}"},
params={"limit": 50},
)
if response.status_code == 200:
for event in response.json()["data"]:
print(event["created_at"], event["level"], event["message"])
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_ENDPOINT}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/events?limit=50`,
{
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
const body = await response.json();
if (response.ok) {
body.data.forEach((event) => console.log(event.created_at, event.level, event.message));
} else {
console.error('Error:', body.errors);
}
{
"data": [
{
"level": "info",
"message": "session opened",
"created_at": "2026-10-29T16:05:00Z"
}
],
"has_more": false,
"next_cursor": null,
"prev_cursor": null
}
Sessions
List Session Events
Page through a session’s lifecycle events
GET
/
api
/
agents
/
sessions
/
{session_id}
/
events
curl "$ATAI_API_ENDPOINT/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/events?limit=50" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]
response = requests.get(
f"{base_url}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/events",
headers={"Authorization": f"Bearer {api_key}"},
params={"limit": 50},
)
if response.status_code == 200:
for event in response.json()["data"]:
print(event["created_at"], event["level"], event["message"])
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_ENDPOINT}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/events?limit=50`,
{
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
const body = await response.json();
if (response.ok) {
body.data.forEach((event) => console.log(event.created_at, event.level, event.message));
} else {
console.error('Error:', body.errors);
}
{
"data": [
{
"level": "info",
"message": "session opened",
"created_at": "2026-10-29T16:05:00Z"
}
],
"has_more": false,
"next_cursor": null,
"prev_cursor": null
}
Requires version 2.0.1 or later of the Archetype platform.
Overview
This endpoint returns a page of a session’s lifecycle events, newest first. The platform records an event when the session is opened, dispatched, finished, or cancelled, and when it fails, with why. Aserving session’s events also say why it ended when its deployment ended it.
Request
Forward cursor: return events older than this page. Pass the previous page’s
next_cursor. The
cursor is opaque: never compute on it. Mutually exclusive with before.Backward cursor: return events newer than this page. Opaque, as
after is. Mutually exclusive
with after.Response
Cursor for the next page in the same direction. Pass it as
after when paging forward, or as
before when you supplied before. null when has_more is false.Cursor to step back the way this page was reached. Pass it as
before after a forward page, or
as after after a backward one. null when the request carried no cursor.Event object
What happened: the session was dispatched, finished, was cancelled, or failed and why.
curl "$ATAI_API_ENDPOINT/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/events?limit=50" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_ENDPOINT"]
api_key = os.environ["ATAI_API_KEY"]
response = requests.get(
f"{base_url}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/events",
headers={"Authorization": f"Bearer {api_key}"},
params={"limit": 50},
)
if response.status_code == 200:
for event in response.json()["data"]:
print(event["created_at"], event["level"], event["message"])
else:
print(f"Error: {response.json()['errors']}")
const response = await fetch(
`${process.env.ATAI_API_ENDPOINT}/agents/sessions/ses_01jcf4p9r6wy3nv8s5m7jcae0b/events?limit=50`,
{
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`
}
}
);
const body = await response.json();
if (response.ok) {
body.data.forEach((event) => console.log(event.created_at, event.level, event.message));
} else {
console.error('Error:', body.errors);
}
{
"data": [
{
"level": "info",
"message": "session opened",
"created_at": "2026-10-29T16:05:00Z"
}
],
"has_more": false,
"next_cursor": null,
"prev_cursor": null
}
Important Notes
- Passing both
afterandbeforereturns400, as does a malformed cursor. - A
404means the session does not exist, belongs to another organization, or is in a project you cannot see. - Events are the platform’s record of the session’s lifecycle, not its job’s log lines.
Was this page helpful?