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

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**SessionObserverProtocol**](../classes/SessionObserverProtocol) class in the [**protocols**](../modules/protocols) 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

<ParamField query="session_id" type="str" required={true}>
  No description available.
</ParamField>

<ParamField query="client_id" type="str" required={true}>
  No description available.
</ParamField>

<ParamField query="role" type="SessionSharingRole" required={false} default="SessionSharingRole.VIEWER">
  No description available.
</ParamField>

## Source

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