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,
)
Returns JSON Raises HttpResponseError

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 (or cursor) 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 what doctl agents logs uses; paginate it with replay_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_id string required

Example: a1b2c3d4-e5f6-7890-abcd-ef1234567890

The session UUID.

replay_only boolean optional

Example: False

Write 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.

Default: False

replay_from string optional

Event-id pagination cursor for the replay_only lane 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.

cursor string optional

Query-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_id string optional

Query-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_id string optional

Example: 01K9YQ0R2M4A7X

The 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_uuid string optional

Example: d1e2f3a4-b5c6-7890-abcd-ef1234567890

A 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.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.