> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Session Observer Protocol • AI Agent SDK

> SessionObserverProtocol: Protocol for attaching multiple observers to one live session.

# SessionObserverProtocol

> Defined in the [**protocols**](../modules/protocols) module.

<Badge color="blue">AI Agent</Badge>

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

<CardGroup cols={2}>
  <Card title="attach()" icon="function" href="../functions/SessionObserverProtocol-attach">
    Attach `client_id` to `session_id` with the given role.
  </Card>

  <Card title="detach()" icon="function" href="../functions/SessionObserverProtocol-detach">
    Detach `client_id` from `session_id` (stop observing).
  </Card>

  <Card title="observers()" icon="function" href="../functions/SessionObserverProtocol-observers">
    Return `(client_id, role)` pairs currently attached to the session.
  </Card>
</CardGroup>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L312">
  `praisonaiagents/gateway/protocols.py` at line 312
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Session Management" icon="clock" href="/docs/docs/concepts/session-management" />

  <Card title="Sessions Feature" icon="folder" href="/docs/docs/features/sessions" />

  <Card title="Session Persistence" icon="database" href="/docs/docs/features/session-persistence" />
</CardGroup>
