Skip to main content

Follow what one child agent run is doing

GET 

/session/agents/:agentRunId/events

Returns one child agent run's stored events in order, read from the database, so the answer is complete even after a restart. These are the same agent.run.* steps connected WebSocket clients receive live, such as agent.run.started, agent.run.text.delta, agent.run.tool.use, agent.run.tool.result, agent.run.question, and the terminal agent.run.completed, agent.run.failed, or agent.run.cancelled. They are not part of GET /session/events, which lists only root-turn events.

Each run numbers its events from 1. To follow a run, start with cursor=0, then pass each page's nextCursor back as cursor. Poll again while hasMore is true or the run's state is still running.

  • Select the session with the X-Session-ID header.
  • Returns 404 with code SESSION_NOT_FOUND when the session does not exist, 404 with code NOT_FOUND (agent run not found) when the run does not belong to it, and 400 with code VALIDATION_FAILED for an out-of-range cursor or limit.

Request​

Responses​

One page of the run's events, oldest first, with the cursor to continue from.

Response Headers
    X-Session-ID

    The session this response belongs to. For session-scoped requests it echoes the X-Session-ID request header; for POST /sessions/open and POST /sessions/system it is the session that was opened or created.

    X-Request-ID

    The request's correlation ID. When the request carried an X-Request-ID header holding a UUID, Peen echoes it; otherwise Peen generates a new UUID. The controller log records the same value for this request.