<!--
 ⚠️  AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
 This file is automatically generated by scripts/docs-generator.js
 To make changes, edit the source TypeScript files or update the generator script
-->

[sessions](../../) / [Exports](../modules) / SessionManager

# Class: SessionManager

SessionManager - manages multiple independent AI agents in isolated workspaces

Core responsibilities:

- Create and manage multiple sessions (workspaces)
- Create and manage multiple chat instances (AI agents) per session
- Provide workspace isolation between sessions
- Handle basic session lifecycle and limits

## Table of contents

### Constructors

- [constructor](SessionManager#constructor)

### Methods

- [createSession](SessionManager#createsession)
- [createChat](SessionManager#createchat)
- [getChat](SessionManager#getchat)
- [getSession](SessionManager#getsession)
- [getSessionChats](SessionManager#getsessionchats)
- [switchChat](SessionManager#switchchat)
- [deleteChat](SessionManager#deletechat)
- [deleteSession](SessionManager#deletesession)
- [listSessions](SessionManager#listsessions)

## Constructors

### constructor

• **new SessionManager**(`config?`): [`SessionManager`](SessionManager)

#### Parameters

| Name     | Type                                                         |
| :------- | :----------------------------------------------------------- |
| `config` | [`SessionManagerConfig`](../interfaces/SessionManagerConfig) |

#### Returns

[`SessionManager`](SessionManager)

#### Defined in

[sessions/src/session/session-manager.ts:29](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/session/session-manager.ts#L29)

## Methods

### createSession

▸ **createSession**(`options?`): `string`

Create a new session (workspace)

#### Parameters

| Name      | Type                                                         |
| :-------- | :----------------------------------------------------------- |
| `options` | [`CreateSessionOptions`](../interfaces/CreateSessionOptions) |

#### Returns

`string`

#### Defined in

[sessions/src/session/session-manager.ts:43](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/session/session-manager.ts#L43)

---

### createChat

▸ **createChat**(`sessionId`, `options`): `Promise`\<`string`\>

Create a new chat (AI agent) within a session

#### Parameters

| Name        | Type                                                   |
| :---------- | :----------------------------------------------------- |
| `sessionId` | `string`                                               |
| `options`   | [`CreateChatOptions`](../interfaces/CreateChatOptions) |

#### Returns

`Promise`\<`string`\>

#### Defined in

[sessions/src/session/session-manager.ts:70](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/session/session-manager.ts#L70)

---

### getChat

▸ **getChat**(`chatId`): `undefined` \| [`ChatInstance`](ChatInstance)

Get a chat instance

#### Parameters

| Name     | Type     |
| :------- | :------- |
| `chatId` | `string` |

#### Returns

`undefined` \| [`ChatInstance`](ChatInstance)

#### Defined in

[sessions/src/session/session-manager.ts:124](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/session/session-manager.ts#L124)

---

### getSession

▸ **getSession**(`sessionId`): `undefined` \| [`SessionInfo`](../interfaces/SessionInfo)

Get session information

#### Parameters

| Name        | Type     |
| :---------- | :------- |
| `sessionId` | `string` |

#### Returns

`undefined` \| [`SessionInfo`](../interfaces/SessionInfo)

#### Defined in

[sessions/src/session/session-manager.ts:131](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/session/session-manager.ts#L131)

---

### getSessionChats

▸ **getSessionChats**(`sessionId`): [`ChatInfo`](../interfaces/ChatInfo)[]

List all chats in a session

#### Parameters

| Name        | Type     |
| :---------- | :------- |
| `sessionId` | `string` |

#### Returns

[`ChatInfo`](../interfaces/ChatInfo)[]

#### Defined in

[sessions/src/session/session-manager.ts:138](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/session/session-manager.ts#L138)

---

### switchChat

▸ **switchChat**(`sessionId`, `chatId`): `boolean`

Switch active chat in session

#### Parameters

| Name        | Type     |
| :---------- | :------- |
| `sessionId` | `string` |
| `chatId`    | `string` |

#### Returns

`boolean`

#### Defined in

[sessions/src/session/session-manager.ts:162](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/session/session-manager.ts#L162)

---

### deleteChat

▸ **deleteChat**(`chatId`): `boolean`

Delete a chat

#### Parameters

| Name     | Type     |
| :------- | :------- |
| `chatId` | `string` |

#### Returns

`boolean`

#### Defined in

[sessions/src/session/session-manager.ts:187](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/session/session-manager.ts#L187)

---

### deleteSession

▸ **deleteSession**(`sessionId`): `boolean`

Delete a session and all its chats

#### Parameters

| Name        | Type     |
| :---------- | :------- |
| `sessionId` | `string` |

#### Returns

`boolean`

#### Defined in

[sessions/src/session/session-manager.ts:214](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/session/session-manager.ts#L214)

---

### listSessions

▸ **listSessions**(): [`SessionInfo`](../interfaces/SessionInfo)[]

List all sessions

#### Returns

[`SessionInfo`](../interfaces/SessionInfo)[]

#### Defined in

[sessions/src/session/session-manager.ts:236](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/session/session-manager.ts#L236)
