pydo.harness.get_session_events()
Generated on 6 Nov 2026
from pydo version
v0.45.0
Usage
client.harness.get_session_events(
session_id="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
replay_only=False,
replay_from=None,
cursor=None,
device_id=None,
last_event_id=None,
x_device_uuid=None,
)Description
Opens a text/event-stream of the session’s canonical events, served by the MARS data plane (OHP).
Each frame is event: <type> plus a data: line holding a JSON event envelope; comment lines
(: keepalive) arrive about every 15s and must be ignored. Decode every data: with one envelope
parser and dispatch on the envelope’s type. Every stream opens with a stream.state control frame
(its data is a stream_state).
Delivery is at-least-once: clients MUST de-duplicate and order by event_id (a ULID), never by
seq. The same path serves two modes:
- live attach (default): recent context, then an open stream that stays live until the client
disconnects. Pass
Last-Event-ID(orcursor) to resume strictly after the last event the client already rendered, suppressing the last-N context floor. - finite replay (
replay_only=true): writes a bounded slice of the stored transcript and closes. This is whatdoctl agents logsuses; paginate it withreplay_from.
OHP serves recent history only (bounded by Kafka retention and an event window); it is not an
archive. OHP’s own errors (404/429/500/503) use the DO-standard JSON {id, message, request_id}
envelope (cthulhu#179797 / MARSOHS-2065); the 401 comes from the edge.
Parameters
session_idstring requiredExample:
a1b2c3d4-e5f6-7890-abcd-ef1234567890The session UUID.
replay_onlyboolean optionalExample:
FalseWrite the selected history and then close the stream, rather than going live. Does not advance the device's delivery cursor, so it never supersedes a live attach from the same device.
replay_fromstring optionalEvent-id pagination cursor for the
replay_onlylane only; return events after this one. There is no last-N floor, so a cursor already at the head yields nothing. Ignored on a live attach.cursorstring optionalQuery-param equivalent of
Last-Event-ID, because a browser EventSource cannot set request headers. Takes precedence over the header when both are present. Live-attach lane only.device_idstring optionalQuery-param equivalent of
X-Device-UUID. Identifies one client install so its delivery cursor and live slot are its own; a second attach from the same device supersedes the first.last_event_idstring optionalExample:
01K9YQ0R2M4A7XThe last event this client rendered (not merely received). Its presence marks the request a reconnect, so OHP serves strictly what follows it with no last-N floor. Persist it only after rendering.
x_device_uuidstring optionalExample:
d1e2f3a4-b5c6-7890-abcd-ef1234567890A stable per-install device id. See
device_id.
More Information
See /v2/agents/sessions/{session_id}/events in the API reference for additional detail on responses, headers, parameters, and more.