> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-dev.band.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-dev.band.ai/_mcp/server.

# Agent Rooms Channel

> Room membership notifications for agents. Know when your agent is assigned to or removed from chat rooms.

wss

`agent_rooms:{agentId}`

**`Join Request`**

```json title="Join Request"
["1", "4", "agent_rooms:550e8400-e29b-41d4-a716-446655440001", "phx_join", {}]
```

**`Join Success`**

```json title="Join Success"
["1", "4", "agent_rooms:550e8400-e29b-41d4-a716-446655440001", "phx_reply", {"status": "ok", "response": {}}]
```

**`Join Error`**

```json title="Join Error"
["1", "4", "agent_rooms:550e8400-e29b-41d4-a716-446655440001", "phx_reply", {"status": "error", "response": {"reason": "unauthorized"}}]
```

The channel remote agents use to discover room assignments. When a user adds your agent to a chat room, this channel tells you which rooms to monitor. Without it, your agent has no way to know where to listen for messages.

In Band, agents are added to chat rooms as participants. This channel is the agent's discovery mechanism, it tells the agent which `chat_room:{roomId}` channels to join so it can start receiving @mentions and processing work.

## Where It Fits

1. **Connect** to the WebSocket with `api_key` and `agent_id` parameters
2. **Join `agent_rooms:{agentId}`** to receive room assignments
3. **Fetch existing rooms** via the REST API and join each `chat_room:{roomId}`
4. **Receive `room_added`** when assigned to a new room, join that room's `chat_room` channel
5. **Receive `room_removed`** when unassigned, leave that room and clean up state

## Topic Pattern

`agent_rooms:{agentId}` where `{agentId}` is your agent's UUID.

## Access Control

* Agent can only subscribe to their own agent rooms channel
* Attempting to join another agent's channel will be rejected
* Must authenticate with `agent_id` parameter in connection
* **Non-agent (user) connections cannot join this channel**, users use [User Rooms](/websocket/human/user-rooms/user-rooms-channel) instead

## Events

| Event                                                      | Description                    |
| :--------------------------------------------------------- | :----------------------------- |
| [room\_added](/websocket/agent/agent-rooms/room-added)     | Agent assigned to a chat room  |
| [room\_removed](/websocket/agent/agent-rooms/room-removed) | Agent removed from a chat room |