List events
Reads a session's log in order, a page at a time: everything after the seq a reader last saw, so a poll resumes exactly where it stopped.
GET /v1/agent/sessions/{id}/events
| Address | https://api.hanzo.ai/v1/agent/sessions/{id}/events |
| Method | GET |
| Operation | get_agent_sessions_by_id_events |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Reads a session's log in order, a page at a time: everything after the seq a reader last saw, so a poll resumes exactly where it stopped. It is how to see what a run did and why it ended — each model turn, tool call, status and log line, as the run wrote them. A run whose process went away is ended first, with its reason as the last event.
Request
3 fields.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | ID is the session to read, from the path. |
after | query | integer | — | After is the seq of the last event already read; the page starts after it. |
limit | query | integer | — | Limit caps the page. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | agent.eventList | ok |
default | problem-details | refused |
200 body — 9 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
events | body | agent.eventView[] | — | Events is the page, in seq order. |
events[].actor | body | string | — | Actor is who produced the turn. |
events[].createdAt | body | string | — | CreatedAt is when the turn was recorded, RFC 3339 in UTC to the second. |
events[].id | body | string | — | ID is the event's own handle, minted as "evt_" + 32 hex characters. |
events[].kind | body | string | — | Kind is what the turn IS, from a closed six: message (a model turn), tool-call, spawn (a subagent started), log, status, control (a steering command the running surface consumes). |
events[].payload | body | any | — | Payload is the turn's body, embedded as JSON rather than as a string — whatever the writer sent, up to 64 KiB, checked for well-formedness and scanned for credentials before it was stored. |
events[].seq | body | integer (int64) | — | Seq is the turn's position in this session's log: monotonic from 1, assigned by the store inside the insert, and unique PER SESSION rather than globally. |
events[].sessionId | body | string | — | SessionID is the session this turn belongs to. |
next | body | integer (int64) | — | Next is the seq to pass as after for the page beyond this one; absent when this page reached the end of the log as it stands now. |
Failure carries the platform error shape — see Errors.
Examples
hanzo agent sessions events get <id>import { Configuration, AgentApi } from 'hanzoai';
const api = new AgentApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getAgentSessionsByIdEvents({ id: 'id' });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AgentApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AgentApi(client).get_agent_sessions_by_id_events(id='id')cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.AgentAPI.GetAgentSessionsByIdEvents(context.Background()).Execute()
if err != nil {
return err
}use hanzo_client::apis::{configuration::Configuration, agent_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = agent_api::get_agent_sessions_by_id_events(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AgentApi;
ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));
var result = new AgentApi(client).getAgentSessionsByIdEvents();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl https://api.hanzo.ai/v1/agent/sessions/<id>/events \
-H "Authorization: Bearer $HANZO_API_KEY"MCP reaches agent through the agent tool, which names its 51 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_agents"
}
}
}'