curl "$ATAI_API_URL/agents/instances/agt_01jc9q8v5nm3ry7t2bkz4dhs6f/events?limit=50" \
-H "Authorization: Bearer $ATAI_API_KEY"
curl "$ATAI_API_URL/agents/instances/agt_01jc9q8v5nm3ry7t2bkz4dhs6f/events?after=evt_01jc9q9m2x" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_URL"]
api_key = os.environ["ATAI_API_KEY"]
headers = {"Authorization": f"Bearer {api_key}"}
events_url = f"{base_url}/agents/instances/agt_01jc9q8v5nm3ry7t2bkz4dhs6f/events"
cursor = None
while True:
params = {"limit": 100}
if cursor:
params["after"] = cursor
response = requests.get(events_url, headers=headers, params=params)
if response.status_code != 200:
print(f"Error: {response.json()['errors']}")
break
page = response.json()
for event in page["data"]:
print(f"[{event['level']}] {event['created_at']} {event['message']}")
if not page["has_more"]:
break
cursor = page["next_cursor"]
const response = await fetch(
`${process.env.ATAI_API_URL}/agents/instances/agt_01jc9q8v5nm3ry7t2bkz4dhs6f/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.level}] ${event.created_at} ${event.message}`);
});
} else {
console.error('Error:', body.errors);
}
{
"data": [
{
"id": "evt_01jc9q9m2x",
"level": "info",
"message": "Run dispatched to executor.",
"created_at": "2026-08-11T15:10:04Z"
},
{
"id": "evt_01jc9q8w7b",
"level": "info",
"message": "Run created.",
"created_at": "2026-08-11T15:10:00Z"
}
],
"has_more": false,
"next_cursor": null,
"prev_cursor": null
}
{
"data": [],
"has_more": false,
"next_cursor": null,
"prev_cursor": null
}
{
"errors": [
{
"code": "<error_code>",
"message": "Invalid cursor.",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "<error_code>",
"message": "Agent not found.",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
Instances
List Agent Events
Page through an agent run’s event log
GET
/
agents
/
instances
/
{agent_id}
/
events
curl "$ATAI_API_URL/agents/instances/agt_01jc9q8v5nm3ry7t2bkz4dhs6f/events?limit=50" \
-H "Authorization: Bearer $ATAI_API_KEY"
curl "$ATAI_API_URL/agents/instances/agt_01jc9q8v5nm3ry7t2bkz4dhs6f/events?after=evt_01jc9q9m2x" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_URL"]
api_key = os.environ["ATAI_API_KEY"]
headers = {"Authorization": f"Bearer {api_key}"}
events_url = f"{base_url}/agents/instances/agt_01jc9q8v5nm3ry7t2bkz4dhs6f/events"
cursor = None
while True:
params = {"limit": 100}
if cursor:
params["after"] = cursor
response = requests.get(events_url, headers=headers, params=params)
if response.status_code != 200:
print(f"Error: {response.json()['errors']}")
break
page = response.json()
for event in page["data"]:
print(f"[{event['level']}] {event['created_at']} {event['message']}")
if not page["has_more"]:
break
cursor = page["next_cursor"]
const response = await fetch(
`${process.env.ATAI_API_URL}/agents/instances/agt_01jc9q8v5nm3ry7t2bkz4dhs6f/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.level}] ${event.created_at} ${event.message}`);
});
} else {
console.error('Error:', body.errors);
}
{
"data": [
{
"id": "evt_01jc9q9m2x",
"level": "info",
"message": "Run dispatched to executor.",
"created_at": "2026-08-11T15:10:04Z"
},
{
"id": "evt_01jc9q8w7b",
"level": "info",
"message": "Run created.",
"created_at": "2026-08-11T15:10:00Z"
}
],
"has_more": false,
"next_cursor": null,
"prev_cursor": null
}
{
"data": [],
"has_more": false,
"next_cursor": null,
"prev_cursor": null
}
{
"errors": [
{
"code": "<error_code>",
"message": "Invalid cursor.",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "<error_code>",
"message": "Agent not found.",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
Requires version 1.1.9 or later of the Archetype platform.
Overview
This endpoint returns a page of an agent’s event log, newest first. Events are the agent-side log: an id, a three-level severity, a message, and a timestamp. For the executor’s own log lines, useGET /agents/instances/{agent_id}/logs.
Request
string
required
Agent
agt_ id.integer
default:"100"
Page size. Minimum
1, maximum 1000.string
Forward cursor: return events older than the one with this id. Pass the
next_cursor of the previous page to fetch the next page. Mutually exclusive with before.string
Backward cursor: return events newer than the one with this id. Pass the
prev_cursor of the current page to walk back. Mutually exclusive with after.Response
array
required
The page, newest first. Each entry is an event.
boolean
required
True when more events exist beyond this page in the direction of travel.
string
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.string
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
string
required
Event id — the keyset cursor value for
after/before.string
required
Event severity for the agent event log:
info, warning, or error.string
required
The event message.
string
required
When the event was recorded (date-time).
curl "$ATAI_API_URL/agents/instances/agt_01jc9q8v5nm3ry7t2bkz4dhs6f/events?limit=50" \
-H "Authorization: Bearer $ATAI_API_KEY"
curl "$ATAI_API_URL/agents/instances/agt_01jc9q8v5nm3ry7t2bkz4dhs6f/events?after=evt_01jc9q9m2x" \
-H "Authorization: Bearer $ATAI_API_KEY"
import os
import requests
base_url = os.environ["ATAI_API_URL"]
api_key = os.environ["ATAI_API_KEY"]
headers = {"Authorization": f"Bearer {api_key}"}
events_url = f"{base_url}/agents/instances/agt_01jc9q8v5nm3ry7t2bkz4dhs6f/events"
cursor = None
while True:
params = {"limit": 100}
if cursor:
params["after"] = cursor
response = requests.get(events_url, headers=headers, params=params)
if response.status_code != 200:
print(f"Error: {response.json()['errors']}")
break
page = response.json()
for event in page["data"]:
print(f"[{event['level']}] {event['created_at']} {event['message']}")
if not page["has_more"]:
break
cursor = page["next_cursor"]
const response = await fetch(
`${process.env.ATAI_API_URL}/agents/instances/agt_01jc9q8v5nm3ry7t2bkz4dhs6f/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.level}] ${event.created_at} ${event.message}`);
});
} else {
console.error('Error:', body.errors);
}
{
"data": [
{
"id": "evt_01jc9q9m2x",
"level": "info",
"message": "Run dispatched to executor.",
"created_at": "2026-08-11T15:10:04Z"
},
{
"id": "evt_01jc9q8w7b",
"level": "info",
"message": "Run created.",
"created_at": "2026-08-11T15:10:00Z"
}
],
"has_more": false,
"next_cursor": null,
"prev_cursor": null
}
{
"data": [],
"has_more": false,
"next_cursor": null,
"prev_cursor": null
}
{
"errors": [
{
"code": "<error_code>",
"message": "Invalid cursor.",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "<error_code>",
"message": "Agent not found.",
"suggestion": null,
"error_uid": "err-xxxxxxxx"
}
]
}
Important Notes
- Pass the
next_cursorof the previous page asafterto fetch the next page, and theprev_cursorof the current page asbeforeto walk back. afterandbeforeare mutually exclusive — send at most one of them.- Events use the agent-side severity vocabulary (
info,warning,error), which is narrower than the executor log levels returned by/logs.
Was this page helpful?