Session Observer Protocol • AI Agent SDK
SessionObserverProtocol: Protocol for attaching multiple observers to one live session.
SessionObserverProtocol
Defined in the protocols module.
AI Agent
Protocol for attaching multiple observers to one live session.
Extends the single-owner :class:GatewaySessionProtocol model so that a session can fan its live turn stream (tokens, tool calls, results, final) out to more than one authorised client. Implementations live in the wrapper Gateway; the contract lives here so every client agrees on the attach/detach/enumerate surface.
Default behaviour is unchanged: a `PRIVATE session keeps a single OWNER` observer (today’s 1:1 model).
Methods
Attach `client_id to session_id` with the given role.
Detach `client_id from session_id` (stop observing).
Return `(client_id, role)` pairs currently attached to the session.
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 315