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

# attach • AI Agent SDK

> attach: Attach ``client_id`` to ``session_id`` with the given role.

# attach

Method

> This is a method of the [**SessionObserverProtocol**](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/SessionObserverProtocol.md) class in the [**protocols**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/protocols.md) module.

Attach `client_id` to `session_id` with the given role.

Adds an observer rather than re-pointing ownership, so a second
client can watch a session without hijacking it.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def attach(session_id: str, client_id: str, role: SessionSharingRole) -> None
```

## Parameters

**session\_id** `str` *required*

No description available.

**client\_id** `str` *required*

No description available.

**role** `SessionSharingRole` (default: SessionSharingRole.VIEWER)

No description available.

## Source

> **[View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L326)**
>
> `praisonaiagents/gateway/protocols.py` at line 326


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.