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

Addresshttps://api.hanzo.ai/v1/agent/sessions/{id}/events
MethodGET
Operationget_agent_sessions_by_id_events
AuthAuthorization: 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.

FieldInTypeRequiredDescription
idpathstringyesID is the session to read, from the path.
afterqueryinteger—After is the seq of the last event already read; the page starts after it.
limitqueryinteger—Limit caps the page.

Response

StatusBodyMeaning
200agent.eventListok
defaultproblem-detailsrefused

200 body — 9 fields.

FieldInTypeAlwaysDescription
eventsbodyagent.eventView[]—Events is the page, in seq order.
events[].actorbodystring—Actor is who produced the turn.
events[].createdAtbodystring—CreatedAt is when the turn was recorded, RFC 3339 in UTC to the second.
events[].idbodystring—ID is the event's own handle, minted as "evt_" + 32 hex characters.
events[].kindbodystring—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[].payloadbodyany—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[].seqbodyinteger (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[].sessionIdbodystring—SessionID is the session this turn belongs to.
nextbodyinteger (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"
         }
       }
     }'

Agent API · All Hanzo APIs · Interactive reference

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.