<!--
 ⚠️  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) / ChatInstance

# Class: ChatInstance

Simple ChatInstance implementation - wrapper around Robota

Focuses on the core purpose: managing a single AI agent instance
within a session context. Delegates conversation management to Robota.

## Implements

- `IChatInstance`

## Table of contents

### Constructors

- [constructor](ChatInstance#constructor)

### Properties

- [metadata](ChatInstance#metadata)
- [config](ChatInstance#config)
- [robota](ChatInstance#robota)

### Methods

- [sendMessage](ChatInstance#sendmessage)
- [regenerateResponse](ChatInstance#regenerateresponse)
- [updateRobotaConfig](ChatInstance#updaterobotaconfig)
- [getRobotaConfig](ChatInstance#getrobotaconfig)
- [upgradeToTemplate](ChatInstance#upgradetotemplate)
- [getTemplateManager](ChatInstance#gettemplatemanager)
- [activate](ChatInstance#activate)
- [deactivate](ChatInstance#deactivate)
- [getHistory](ChatInstance#gethistory)
- [clearHistory](ChatInstance#clearhistory)
- [save](ChatInstance#save)
- [load](ChatInstance#load)
- [getStats](ChatInstance#getstats)
- [updateConfig](ChatInstance#updateconfig)

## Constructors

### constructor

• **new ChatInstance**(`metadata`, `config`, `robota`): [`ChatInstance`](ChatInstance)

#### Parameters

| Name       | Type                                           |
| :--------- | :--------------------------------------------- |
| `metadata` | [`IChatMetadata`](../interfaces/IChatMetadata) |
| `config`   | [`IChatConfig`](../interfaces/IChatConfig)     |
| `robota`   | `Robota`                                       |

#### Returns

[`ChatInstance`](ChatInstance)

#### Defined in

[sessions/src/chat/chat-instance.ts:24](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L24)

## Properties

### metadata

• `Readonly` **metadata**: [`IChatMetadata`](../interfaces/IChatMetadata)

#### Implementation of

IChatInstance.metadata

#### Defined in

[sessions/src/chat/chat-instance.ts:19](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L19)

---

### config

• `Readonly` **config**: [`IChatConfig`](../interfaces/IChatConfig)

#### Implementation of

IChatInstance.config

#### Defined in

[sessions/src/chat/chat-instance.ts:20](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L20)

---

### robota

• `Readonly` **robota**: `Robota`

#### Implementation of

IChatInstance.robota

#### Defined in

[sessions/src/chat/chat-instance.ts:21](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L21)

## Methods

### sendMessage

▸ **sendMessage**(`content`): `Promise`\<`string`\>

Send a message and get AI response

#### Parameters

| Name      | Type     |
| :-------- | :------- |
| `content` | `string` |

#### Returns

`Promise`\<`string`\>

#### Implementation of

IChatInstance.sendMessage

#### Defined in

[sessions/src/chat/chat-instance.ts:38](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L38)

---

### regenerateResponse

▸ **regenerateResponse**(): `Promise`\<`string`\>

Regenerate the last response

#### Returns

`Promise`\<`string`\>

#### Implementation of

IChatInstance.regenerateResponse

#### Defined in

[sessions/src/chat/chat-instance.ts:52](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L52)

---

### updateRobotaConfig

▸ **updateRobotaConfig**(`config`): `Promise`\<`void`\>

Update robota configuration

#### Parameters

| Name     | Type          |
| :------- | :------------ |
| `config` | `AgentConfig` |

#### Returns

`Promise`\<`void`\>

#### Implementation of

IChatInstance.updateRobotaConfig

#### Defined in

[sessions/src/chat/chat-instance.ts:66](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L66)

---

### getRobotaConfig

▸ **getRobotaConfig**(): `AgentConfig`

Get current robota configuration

#### Returns

`AgentConfig`

#### Implementation of

IChatInstance.getRobotaConfig

#### Defined in

[sessions/src/chat/chat-instance.ts:79](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L79)

---

### upgradeToTemplate

▸ **upgradeToTemplate**(`templateName`): `Promise`\<`void`\>

Upgrade to use an agent template

#### Parameters

| Name           | Type     |
| :------------- | :------- |
| `templateName` | `string` |

#### Returns

`Promise`\<`void`\>

#### Implementation of

IChatInstance.upgradeToTemplate

#### Defined in

[sessions/src/chat/chat-instance.ts:86](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L86)

---

### getTemplateManager

▸ **getTemplateManager**(): [`ITemplateManager`](../interfaces/ITemplateManager)

Get template manager instance

#### Returns

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

#### Implementation of

IChatInstance.getTemplateManager

#### Defined in

[sessions/src/chat/chat-instance.ts:99](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L99)

---

### activate

▸ **activate**(): `void`

Activate this chat session

#### Returns

`void`

#### Implementation of

IChatInstance.activate

#### Defined in

[sessions/src/chat/chat-instance.ts:106](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L106)

---

### deactivate

▸ **deactivate**(): `void`

Deactivate this chat session

#### Returns

`void`

#### Implementation of

IChatInstance.deactivate

#### Defined in

[sessions/src/chat/chat-instance.ts:114](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L114)

---

### getHistory

▸ **getHistory**(): [`TUniversalMessage`](../modules#tuniversalmessage)[]

Get conversation history - delegate to Robota

#### Returns

[`TUniversalMessage`](../modules#tuniversalmessage)[]

#### Implementation of

IChatInstance.getHistory

#### Defined in

[sessions/src/chat/chat-instance.ts:121](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L121)

---

### clearHistory

▸ **clearHistory**(): `void`

Clear conversation history - delegate to Robota

#### Returns

`void`

#### Implementation of

IChatInstance.clearHistory

#### Defined in

[sessions/src/chat/chat-instance.ts:128](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L128)

---

### save

▸ **save**(): `Promise`\<`void`\>

Save chat state

#### Returns

`Promise`\<`void`\>

#### Implementation of

IChatInstance.save

#### Defined in

[sessions/src/chat/chat-instance.ts:137](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L137)

---

### load

▸ **load**(): `Promise`\<`void`\>

Load chat state

#### Returns

`Promise`\<`void`\>

#### Implementation of

IChatInstance.load

#### Defined in

[sessions/src/chat/chat-instance.ts:145](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L145)

---

### getStats

▸ **getStats**(): [`IChatStats`](../interfaces/IChatStats)

Get chat statistics

#### Returns

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

#### Implementation of

IChatInstance.getStats

#### Defined in

[sessions/src/chat/chat-instance.ts:153](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L153)

---

### updateConfig

▸ **updateConfig**(`config`): `void`

Update chat configuration

#### Parameters

| Name     | Type                                                    |
| :------- | :------------------------------------------------------ |
| `config` | `Partial`\<[`IChatConfig`](../interfaces/IChatConfig)\> |

#### Returns

`void`

#### Implementation of

IChatInstance.updateConfig

#### Defined in

[sessions/src/chat/chat-instance.ts:165](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/sessions/src/chat/chat-instance.ts#L165)
