<!--
 ⚠️  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
-->

[agents](../../) / [Exports](../modules) / EventEmitterPlugin

# Class: EventEmitterPlugin

Plugin for event detection and propagation
Emits events during agent execution lifecycle

## Hierarchy

- [`AbstractPlugin`](AbstractPlugin)\<[`EventEmitterPluginOptions`](../interfaces/EventEmitterPluginOptions), `EventEmitterPluginStats`\>

  ↳ **`EventEmitterPlugin`**

## Table of contents

### Constructors

- [constructor](EventEmitterPlugin#constructor)

### Properties

- [enabled](EventEmitterPlugin#enabled)
- [category](EventEmitterPlugin#category)
- [priority](EventEmitterPlugin#priority)
- [name](EventEmitterPlugin#name)
- [version](EventEmitterPlugin#version)

### Methods

- [initialize](EventEmitterPlugin#initialize)
- [subscribeToModuleEvents](EventEmitterPlugin#subscribetomoduleevents)
- [unsubscribeFromModuleEvents](EventEmitterPlugin#unsubscribefrommoduleevents)
- [dispose](EventEmitterPlugin#dispose)
- [enable](EventEmitterPlugin#enable)
- [disable](EventEmitterPlugin#disable)
- [isEnabled](EventEmitterPlugin#isenabled)
- [getConfig](EventEmitterPlugin#getconfig)
- [updateConfig](EventEmitterPlugin#updateconfig)
- [getData](EventEmitterPlugin#getdata)
- [clearData](EventEmitterPlugin#cleardata)
- [getStatus](EventEmitterPlugin#getstatus)
- [beforeRun](EventEmitterPlugin#beforerun)
- [afterRun](EventEmitterPlugin#afterrun)
- [beforeToolCall](EventEmitterPlugin#beforetoolcall)
- [afterToolCall](EventEmitterPlugin#aftertoolcall)
- [beforeProviderCall](EventEmitterPlugin#beforeprovidercall)
- [afterProviderCall](EventEmitterPlugin#afterprovidercall)
- [onStreamingChunk](EventEmitterPlugin#onstreamingchunk)
- [onMessageAdded](EventEmitterPlugin#onmessageadded)
- [onModuleEvent](EventEmitterPlugin#onmoduleevent)
- [beforeExecution](EventEmitterPlugin#beforeexecution)
- [afterExecution](EventEmitterPlugin#afterexecution)
- [beforeConversation](EventEmitterPlugin#beforeconversation)
- [afterConversation](EventEmitterPlugin#afterconversation)
- [beforeToolExecution](EventEmitterPlugin#beforetoolexecution)
- [afterToolExecution](EventEmitterPlugin#aftertoolexecution)
- [onError](EventEmitterPlugin#onerror)
- [on](EventEmitterPlugin#on)
- [once](EventEmitterPlugin#once)
- [off](EventEmitterPlugin#off)
- [emit](EventEmitterPlugin#emit)
- [flushBuffer](EventEmitterPlugin#flushbuffer)
- [getStats](EventEmitterPlugin#getstats)
- [clearAllListeners](EventEmitterPlugin#clearalllisteners)
- [destroy](EventEmitterPlugin#destroy)

## Constructors

### constructor

• **new EventEmitterPlugin**(`options?`): [`EventEmitterPlugin`](EventEmitterPlugin)

#### Parameters

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

#### Returns

[`EventEmitterPlugin`](EventEmitterPlugin)

#### Overrides

[AbstractPlugin](AbstractPlugin).[constructor](AbstractPlugin#constructor)

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:265](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L265)

## Properties

### enabled

• **enabled**: `boolean` = `true`

Plugin enabled state

#### Inherited from

[AbstractPlugin](AbstractPlugin).[enabled](AbstractPlugin#enabled)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:307](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L307)

---

### category

• **category**: [`PluginCategory`](../enums/PluginCategory) = `PluginCategory.CUSTOM`

Plugin category for classification

#### Inherited from

[AbstractPlugin](AbstractPlugin).[category](AbstractPlugin#category)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:310](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L310)

---

### priority

• **priority**: `number` = `PluginPriority.NORMAL`

Plugin priority for execution order

#### Inherited from

[AbstractPlugin](AbstractPlugin).[priority](AbstractPlugin#priority)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:313](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L313)

---

### name

• **name**: `string` = `'EventEmitterPlugin'`

Plugin name

#### Overrides

[AbstractPlugin](AbstractPlugin).[name](AbstractPlugin#name)

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:254](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L254)

---

### version

• **version**: `string` = `'1.0.0'`

Plugin version

#### Overrides

[AbstractPlugin](AbstractPlugin).[version](AbstractPlugin#version)

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:255](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L255)

## Methods

### initialize

▸ **initialize**(`options?`): `Promise`\<`void`\>

Initialize the plugin with type-safe options

#### Parameters

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

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[initialize](AbstractPlugin#initialize)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:338](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L338)

---

### subscribeToModuleEvents

▸ **subscribeToModuleEvents**(`eventEmitter`): `Promise`\<`void`\>

Subscribe to module events through EventEmitter

#### Parameters

| Name           | Type                                       |
| :------------- | :----------------------------------------- |
| `eventEmitter` | [`EventEmitterPlugin`](EventEmitterPlugin) |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[subscribeToModuleEvents](AbstractPlugin#subscribetomoduleevents)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:366](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L366)

---

### unsubscribeFromModuleEvents

▸ **unsubscribeFromModuleEvents**(`eventEmitter`): `Promise`\<`void`\>

Unsubscribe from module events

#### Parameters

| Name           | Type                                       |
| :------------- | :----------------------------------------- |
| `eventEmitter` | [`EventEmitterPlugin`](EventEmitterPlugin) |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[unsubscribeFromModuleEvents](AbstractPlugin#unsubscribefrommoduleevents)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:423](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L423)

---

### dispose

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

Cleanup plugin resources

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[dispose](AbstractPlugin#dispose)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:438](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L438)

---

### enable

▸ **enable**(): `void`

Enable the plugin

#### Returns

`void`

#### Inherited from

[AbstractPlugin](AbstractPlugin).[enable](AbstractPlugin#enable)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:450](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L450)

---

### disable

▸ **disable**(): `void`

Disable the plugin

#### Returns

`void`

#### Inherited from

[AbstractPlugin](AbstractPlugin).[disable](AbstractPlugin#disable)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:457](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L457)

---

### isEnabled

▸ **isEnabled**(): `boolean`

Check if plugin is enabled

#### Returns

`boolean`

#### Inherited from

[AbstractPlugin](AbstractPlugin).[isEnabled](AbstractPlugin#isenabled)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:464](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L464)

---

### getConfig

▸ **getConfig**(): [`IPluginConfig`](../interfaces/IPluginConfig)

Get plugin configuration

#### Returns

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

#### Inherited from

[AbstractPlugin](AbstractPlugin).[getConfig](AbstractPlugin#getconfig)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:471](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L471)

---

### updateConfig

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

Update plugin configuration

#### Parameters

| Name      | Type                                           |
| :-------- | :--------------------------------------------- |
| `_config` | [`IPluginConfig`](../interfaces/IPluginConfig) |

#### Returns

`void`

#### Inherited from

[AbstractPlugin](AbstractPlugin).[updateConfig](AbstractPlugin#updateconfig)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:478](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L478)

---

### getData

▸ **getData**(): [`IPluginData`](../interfaces/IPluginData)

Get plugin data - enhanced with classification information

#### Returns

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

#### Inherited from

[AbstractPlugin](AbstractPlugin).[getData](AbstractPlugin#getdata)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:485](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L485)

---

### clearData

▸ **clearData**(): `void`

Clear plugin data - common interface for all plugins
This method should be implemented by plugins that store data

#### Returns

`void`

#### Inherited from

[AbstractPlugin](AbstractPlugin).[clearData](AbstractPlugin#cleardata)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:505](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L505)

---

### getStatus

▸ **getStatus**(): `Object`

Get plugin status - enhanced with classification information

#### Returns

`Object`

| Name                    | Type                                        |
| :---------------------- | :------------------------------------------ |
| `name`                  | `string`                                    |
| `version`               | `string`                                    |
| `enabled`               | `boolean`                                   |
| `initialized`           | `boolean`                                   |
| `category`              | [`PluginCategory`](../enums/PluginCategory) |
| `priority`              | `number`                                    |
| `subscribedEventsCount` | `number`                                    |
| `hasEventEmitter`       | `boolean`                                   |

#### Inherited from

[AbstractPlugin](AbstractPlugin).[getStatus](AbstractPlugin#getstatus)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:510](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L510)

---

### beforeRun

▸ **beforeRun**(`input`, `options?`): `Promise`\<`void`\>

Called before agent run

#### Parameters

| Name       | Type                                       |
| :--------- | :----------------------------------------- |
| `input`    | `string`                                   |
| `options?` | [`IRunOptions`](../interfaces/IRunOptions) |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[beforeRun](AbstractPlugin#beforerun)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:564](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L564)

---

### afterRun

▸ **afterRun**(`input`, `response`, `options?`): `Promise`\<`void`\>

Called after agent run

#### Parameters

| Name       | Type                                       |
| :--------- | :----------------------------------------- |
| `input`    | `string`                                   |
| `response` | `string`                                   |
| `options?` | [`IRunOptions`](../interfaces/IRunOptions) |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[afterRun](AbstractPlugin#afterrun)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:565](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L565)

---

### beforeToolCall

▸ **beforeToolCall**(`toolName`, `parameters`): `Promise`\<`void`\>

Called before tool execution

#### Parameters

| Name         | Type                                            |
| :----------- | :---------------------------------------------- |
| `toolName`   | `string`                                        |
| `parameters` | [`TToolParameters`](../modules#ttoolparameters) |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[beforeToolCall](AbstractPlugin#beforetoolcall)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:570](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L570)

---

### afterToolCall

▸ **afterToolCall**(`toolName`, `parameters`, `result`): `Promise`\<`void`\>

Called after tool execution

#### Parameters

| Name         | Type                                                         |
| :----------- | :----------------------------------------------------------- |
| `toolName`   | `string`                                                     |
| `parameters` | [`TToolParameters`](../modules#ttoolparameters)              |
| `result`     | [`IToolExecutionResult`](../interfaces/IToolExecutionResult) |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[afterToolCall](AbstractPlugin#aftertoolcall)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:572](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L572)

---

### beforeProviderCall

▸ **beforeProviderCall**(`messages`): `Promise`\<`void`\>

Called before AI provider call

#### Parameters

| Name       | Type                                                  |
| :--------- | :---------------------------------------------------- |
| `messages` | [`TUniversalMessage`](../modules#tuniversalmessage)[] |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[beforeProviderCall](AbstractPlugin#beforeprovidercall)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:574](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L574)

---

### afterProviderCall

▸ **afterProviderCall**(`messages`, `response`): `Promise`\<`void`\>

Called after AI provider call

#### Parameters

| Name       | Type                                                  |
| :--------- | :---------------------------------------------------- |
| `messages` | [`TUniversalMessage`](../modules#tuniversalmessage)[] |
| `response` | [`TUniversalMessage`](../modules#tuniversalmessage)   |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[afterProviderCall](AbstractPlugin#afterprovidercall)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:575](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L575)

---

### onStreamingChunk

▸ **onStreamingChunk**(`chunk`): `Promise`\<`void`\>

Called on streaming chunk

#### Parameters

| Name    | Type                                                |
| :------ | :-------------------------------------------------- |
| `chunk` | [`TUniversalMessage`](../modules#tuniversalmessage) |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[onStreamingChunk](AbstractPlugin#onstreamingchunk)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:576](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L576)

---

### onMessageAdded

▸ **onMessageAdded**(`message`): `Promise`\<`void`\>

Called on message added to history

#### Parameters

| Name      | Type                                                |
| :-------- | :-------------------------------------------------- |
| `message` | [`TUniversalMessage`](../modules#tuniversalmessage) |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[onMessageAdded](AbstractPlugin#onmessageadded)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:578](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L578)

---

### onModuleEvent

▸ **onModuleEvent**(`eventType`, `eventData`): `Promise`\<`void`\>

Called when module events are received

#### Parameters

| Name        | Type                                   |
| :---------- | :------------------------------------- |
| `eventType` | [`EventType`](../modules#eventtype)    |
| `eventData` | [`EventData`](../interfaces/EventData) |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[AbstractPlugin](AbstractPlugin).[onModuleEvent](AbstractPlugin#onmoduleevent)

#### Defined in

[packages/agents/src/abstracts/abstract-plugin.ts:579](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/abstracts/abstract-plugin.ts#L579)

---

### beforeExecution

▸ **beforeExecution**(`context`): `Promise`\<`void`\>

Before execution starts

#### Parameters

| Name      | Type                                                               |
| :-------- | :----------------------------------------------------------------- |
| `context` | [`IPluginExecutionContext`](../interfaces/IPluginExecutionContext) |

#### Returns

`Promise`\<`void`\>

#### Overrides

[AbstractPlugin](AbstractPlugin).[beforeExecution](AbstractPlugin#beforeexecution)

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:315](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L315)

---

### afterExecution

▸ **afterExecution**(`context`, `result`): `Promise`\<`void`\>

After execution completes

#### Parameters

| Name      | Type                                                               |
| :-------- | :----------------------------------------------------------------- |
| `context` | [`IPluginExecutionContext`](../interfaces/IPluginExecutionContext) |
| `result`  | [`IPluginExecutionResult`](../interfaces/IPluginExecutionResult)   |

#### Returns

`Promise`\<`void`\>

#### Overrides

[AbstractPlugin](AbstractPlugin).[afterExecution](AbstractPlugin#afterexecution)

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:330](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L330)

---

### beforeConversation

▸ **beforeConversation**(`context`): `Promise`\<`void`\>

Before conversation starts

#### Parameters

| Name      | Type                                                               |
| :-------- | :----------------------------------------------------------------- |
| `context` | [`IPluginExecutionContext`](../interfaces/IPluginExecutionContext) |

#### Returns

`Promise`\<`void`\>

#### Overrides

[AbstractPlugin](AbstractPlugin).[beforeConversation](AbstractPlugin#beforeconversation)

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:347](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L347)

---

### afterConversation

▸ **afterConversation**(`context`, `result`): `Promise`\<`void`\>

After conversation completes

#### Parameters

| Name      | Type                                                               |
| :-------- | :----------------------------------------------------------------- |
| `context` | [`IPluginExecutionContext`](../interfaces/IPluginExecutionContext) |
| `result`  | [`IPluginExecutionResult`](../interfaces/IPluginExecutionResult)   |

#### Returns

`Promise`\<`void`\>

#### Overrides

[AbstractPlugin](AbstractPlugin).[afterConversation](AbstractPlugin#afterconversation)

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:366](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L366)

---

### beforeToolExecution

▸ **beforeToolExecution**(`context`, `toolData`): `Promise`\<`void`\>

Before tool execution - emits tool.beforeExecute event

#### Parameters

| Name       | Type                                                               |
| :--------- | :----------------------------------------------------------------- |
| `context`  | [`IPluginExecutionContext`](../interfaces/IPluginExecutionContext) |
| `toolData` | [`IToolExecutionContext`](../interfaces/IToolExecutionContext)     |

#### Returns

`Promise`\<`void`\>

#### Overrides

[AbstractPlugin](AbstractPlugin).[beforeToolExecution](AbstractPlugin#beforetoolexecution)

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:387](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L387)

---

### afterToolExecution

▸ **afterToolExecution**(`context`, `toolResults`): `Promise`\<`void`\>

After tool execution - emits tool.success or tool.error events

#### Parameters

| Name          | Type                                                               |
| :------------ | :----------------------------------------------------------------- |
| `context`     | [`IPluginExecutionContext`](../interfaces/IPluginExecutionContext) |
| `toolResults` | [`IPluginExecutionResult`](../interfaces/IPluginExecutionResult)   |

#### Returns

`Promise`\<`void`\>

#### Overrides

[AbstractPlugin](AbstractPlugin).[afterToolExecution](AbstractPlugin#aftertoolexecution)

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:410](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L410)

---

### onError

▸ **onError**(`error`, `context?`): `Promise`\<`void`\>

On error

REASON: Error context structure varies by execution phase and error type, needs flexible handling
ALTERNATIVES_CONSIDERED:

1. Strict error context interface (breaks error handling flexibility)
2. Union types (insufficient for dynamic error contexts)
3. Generic constraints (too complex for error handling)
4. Interface definitions (too rigid for varied error contexts)
5. Type assertions (decreases type safety)
   TODO: Consider standardized error context interface

#### Parameters

| Name       | Type                                                       |
| :--------- | :--------------------------------------------------------- |
| `error`    | `Error`                                                    |
| `context?` | [`IPluginErrorContext`](../interfaces/IPluginErrorContext) |

#### Returns

`Promise`\<`void`\>

#### Overrides

[AbstractPlugin](AbstractPlugin).[onError](AbstractPlugin#onerror)

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:458](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L458)

---

### on

▸ **on**(`eventType`, `listener`, `options?`): `string`

Register event listener

#### Parameters

| Name              | Type                                                           |
| :---------------- | :------------------------------------------------------------- |
| `eventType`       | [`EventType`](../modules#eventtype)                            |
| `listener`        | [`EventListener`](../modules#eventlistener)                    |
| `options?`        | `Object`                                                       |
| `options.once?`   | `boolean`                                                      |
| `options.filter?` | (`event`: [`EventData`](../interfaces/EventData)) => `boolean` |

#### Returns

`string`

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:473](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L473)

---

### once

▸ **once**(`eventType`, `listener`, `filter?`): `string`

Register one-time event listener

#### Parameters

| Name        | Type                                                           |
| :---------- | :------------------------------------------------------------- |
| `eventType` | [`EventType`](../modules#eventtype)                            |
| `listener`  | [`EventListener`](../modules#eventlistener)                    |
| `filter?`   | (`event`: [`EventData`](../interfaces/EventData)) => `boolean` |

#### Returns

`string`

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:513](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L513)

---

### off

▸ **off**(`eventType`, `handlerIdOrListener`): `boolean`

Remove event listener

#### Parameters

| Name                  | Type                                                    |
| :-------------------- | :------------------------------------------------------ |
| `eventType`           | [`EventType`](../modules#eventtype)                     |
| `handlerIdOrListener` | `string` \| [`EventListener`](../modules#eventlistener) |

#### Returns

`boolean`

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:523](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L523)

---

### emit

▸ **emit**(`eventType`, `eventData?`): `Promise`\<`void`\>

Emit an event

#### Parameters

| Name        | Type                                                |
| :---------- | :-------------------------------------------------- |
| `eventType` | [`EventType`](../modules#eventtype)                 |
| `eventData` | `Partial`\<[`EventData`](../interfaces/EventData)\> |

#### Returns

`Promise`\<`void`\>

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:550](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L550)

---

### flushBuffer

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

Flush buffered events

#### Returns

`Promise`\<`void`\>

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:664](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L664)

---

### getStats

▸ **getStats**(): `EventEmitterPluginStats`

Get event emitter statistics

#### Returns

`EventEmitterPluginStats`

#### Overrides

[AbstractPlugin](AbstractPlugin).[getStats](AbstractPlugin#getstats)

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:682](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L682)

---

### clearAllListeners

▸ **clearAllListeners**(): `void`

Clear all listeners

#### Returns

`void`

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:706](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L706)

---

### destroy

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

Cleanup on plugin destruction

#### Returns

`Promise`\<`void`\>

#### Defined in

[packages/agents/src/plugins/event-emitter-plugin.ts:714](https://github.com/woojubb/robota/blob/4f4c8a3197e92ddd43d12dc9186b0771983054c9/packages/agents/src/plugins/event-emitter-plugin.ts#L714)
