Skip to content

agents / Exports / ErrorHandlingPlugin

Class: ErrorHandlingPlugin

Plugin for handling errors with configurable strategies Provides error recovery, retry mechanisms, and circuit breaker patterns

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ErrorHandlingPlugin(options): ErrorHandlingPlugin

Parameters

NameType
optionsErrorHandlingPluginOptions

Returns

ErrorHandlingPlugin

Overrides

BasePlugin.constructor

Defined in

packages/agents/src/plugins/error-handling/error-handling-plugin.ts:27

Properties

enabled

enabled: boolean = true

Plugin enabled state

Inherited from

BasePlugin.enabled

Defined in

packages/agents/src/abstracts/base-plugin.ts:297


category

category: PluginCategory = PluginCategory.CUSTOM

Plugin category for classification

Inherited from

BasePlugin.category

Defined in

packages/agents/src/abstracts/base-plugin.ts:300


priority

priority: number = PluginPriority.NORMAL

Plugin priority for execution order

Inherited from

BasePlugin.priority

Defined in

packages/agents/src/abstracts/base-plugin.ts:303


name

name: string = 'ErrorHandlingPlugin'

Plugin name

Overrides

BasePlugin.name

Defined in

packages/agents/src/plugins/error-handling/error-handling-plugin.ts:18


version

version: string = '1.0.0'

Plugin version

Overrides

BasePlugin.version

Defined in

packages/agents/src/plugins/error-handling/error-handling-plugin.ts:19

Methods

initialize

initialize(options?): Promise<void>

Initialize the plugin with type-safe options

Parameters

NameType
options?ErrorHandlingPluginOptions

Returns

Promise<void>

Inherited from

BasePlugin.initialize

Defined in

packages/agents/src/abstracts/base-plugin.ts:328


subscribeToModuleEvents

subscribeToModuleEvents(eventEmitter): Promise<void>

Subscribe to module events through EventEmitter

Parameters

NameType
eventEmitterEventEmitterPlugin

Returns

Promise<void>

Inherited from

BasePlugin.subscribeToModuleEvents

Defined in

packages/agents/src/abstracts/base-plugin.ts:356


unsubscribeFromModuleEvents

unsubscribeFromModuleEvents(eventEmitter): Promise<void>

Unsubscribe from module events

Parameters

NameType
eventEmitterEventEmitterPlugin

Returns

Promise<void>

Inherited from

BasePlugin.unsubscribeFromModuleEvents

Defined in

packages/agents/src/abstracts/base-plugin.ts:415


dispose

dispose(): Promise<void>

Cleanup plugin resources

Returns

Promise<void>

Inherited from

BasePlugin.dispose

Defined in

packages/agents/src/abstracts/base-plugin.ts:430


enable

enable(): void

Enable the plugin

Returns

void

Inherited from

BasePlugin.enable

Defined in

packages/agents/src/abstracts/base-plugin.ts:442


disable

disable(): void

Disable the plugin

Returns

void

Inherited from

BasePlugin.disable

Defined in

packages/agents/src/abstracts/base-plugin.ts:449


isEnabled

isEnabled(): boolean

Check if plugin is enabled

Returns

boolean

Inherited from

BasePlugin.isEnabled

Defined in

packages/agents/src/abstracts/base-plugin.ts:456


getConfig

getConfig(): PluginConfig

Get plugin configuration

Returns

PluginConfig

Inherited from

BasePlugin.getConfig

Defined in

packages/agents/src/abstracts/base-plugin.ts:463


updateConfig

updateConfig(_config): void

Update plugin configuration

Parameters

NameType
_configPluginConfig

Returns

void

Inherited from

BasePlugin.updateConfig

Defined in

packages/agents/src/abstracts/base-plugin.ts:470


getData

getData(): PluginData

Get plugin data - enhanced with classification information

Returns

PluginData

Inherited from

BasePlugin.getData

Defined in

packages/agents/src/abstracts/base-plugin.ts:477


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

BasePlugin.clearData

Defined in

packages/agents/src/abstracts/base-plugin.ts:497


getStatus

getStatus(): Object

Get plugin status - enhanced with classification information

Returns

Object

NameType
namestring
versionstring
enabledboolean
initializedboolean
categoryPluginCategory
prioritynumber
subscribedEventsCountnumber
hasEventEmitterboolean

Inherited from

BasePlugin.getStatus

Defined in

packages/agents/src/abstracts/base-plugin.ts:502


beforeRun

beforeRun(input, options?): Promise<void>

Called before agent run

Parameters

NameType
inputstring
options?RunOptions

Returns

Promise<void>

Inherited from

BasePlugin.beforeRun

Defined in

packages/agents/src/abstracts/base-plugin.ts:556


afterRun

afterRun(input, response, options?): Promise<void>

Called after agent run

Parameters

NameType
inputstring
responsestring
options?RunOptions

Returns

Promise<void>

Inherited from

BasePlugin.afterRun

Defined in

packages/agents/src/abstracts/base-plugin.ts:557


beforeExecution

beforeExecution(context): Promise<void>

Called before execution with context

Parameters

NameType
contextBaseExecutionContext

Returns

Promise<void>

Inherited from

BasePlugin.beforeExecution

Defined in

packages/agents/src/abstracts/base-plugin.ts:558


afterExecution

afterExecution(context, result): Promise<void>

Called after execution with context and result

Parameters

NameType
contextBaseExecutionContext
resultBaseExecutionResult

Returns

Promise<void>

Inherited from

BasePlugin.afterExecution

Defined in

packages/agents/src/abstracts/base-plugin.ts:559


beforeConversation

beforeConversation(context): Promise<void>

Called before conversation with context

Parameters

NameType
contextBaseExecutionContext

Returns

Promise<void>

Inherited from

BasePlugin.beforeConversation

Defined in

packages/agents/src/abstracts/base-plugin.ts:560


afterConversation

afterConversation(context, result): Promise<void>

Called after conversation with context and result

Parameters

NameType
contextBaseExecutionContext
resultBaseExecutionResult

Returns

Promise<void>

Inherited from

BasePlugin.afterConversation

Defined in

packages/agents/src/abstracts/base-plugin.ts:561


beforeToolCall

beforeToolCall(toolName, parameters): Promise<void>

Called before tool execution

Parameters

NameType
toolNamestring
parametersToolParameters

Returns

Promise<void>

Inherited from

BasePlugin.beforeToolCall

Defined in

packages/agents/src/abstracts/base-plugin.ts:562


beforeToolExecution

beforeToolExecution(context, toolData): Promise<void>

Called before tool execution with context

Parameters

NameType
contextBaseExecutionContext
toolDataToolExecutionContext

Returns

Promise<void>

Inherited from

BasePlugin.beforeToolExecution

Defined in

packages/agents/src/abstracts/base-plugin.ts:563


afterToolCall

afterToolCall(toolName, parameters, result): Promise<void>

Called after tool execution

Parameters

NameType
toolNamestring
parametersToolParameters
resultToolExecutionResult

Returns

Promise<void>

Inherited from

BasePlugin.afterToolCall

Defined in

packages/agents/src/abstracts/base-plugin.ts:564


afterToolExecution

afterToolExecution(context, toolResults): Promise<void>

Called after tool execution with context

Parameters

NameType
contextBaseExecutionContext
toolResultsBaseExecutionResult

Returns

Promise<void>

Inherited from

BasePlugin.afterToolExecution

Defined in

packages/agents/src/abstracts/base-plugin.ts:565


beforeProviderCall

beforeProviderCall(messages): Promise<void>

Called before AI provider call

Parameters

NameType
messagesUniversalMessage[]

Returns

Promise<void>

Inherited from

BasePlugin.beforeProviderCall

Defined in

packages/agents/src/abstracts/base-plugin.ts:566


afterProviderCall

afterProviderCall(messages, response): Promise<void>

Called after AI provider call

Parameters

NameType
messagesUniversalMessage[]
responseUniversalMessage

Returns

Promise<void>

Inherited from

BasePlugin.afterProviderCall

Defined in

packages/agents/src/abstracts/base-plugin.ts:567


onStreamingChunk

onStreamingChunk(chunk): Promise<void>

Called on streaming chunk

Parameters

NameType
chunkUniversalMessage

Returns

Promise<void>

Inherited from

BasePlugin.onStreamingChunk

Defined in

packages/agents/src/abstracts/base-plugin.ts:568


onError

onError(error, context?): Promise<void>

Called on error

Parameters

NameType
errorError
context?ErrorContext

Returns

Promise<void>

Inherited from

BasePlugin.onError

Defined in

packages/agents/src/abstracts/base-plugin.ts:569


onMessageAdded

onMessageAdded(message): Promise<void>

Called on message added to history

Parameters

NameType
messageMessage

Returns

Promise<void>

Inherited from

BasePlugin.onMessageAdded

Defined in

packages/agents/src/abstracts/base-plugin.ts:570


onModuleEvent

onModuleEvent(eventType, eventData): Promise<void>

Called when module events are received

Parameters

NameType
eventTypeEventType
eventDataEventData

Returns

Promise<void>

Inherited from

BasePlugin.onModuleEvent

Defined in

packages/agents/src/abstracts/base-plugin.ts:571


handleError

handleError(error, context?): Promise<void>

Handle an error with the configured strategy

Parameters

NameType
errorError
contextErrorHandlingContextData

Returns

Promise<void>

Defined in

packages/agents/src/plugins/error-handling/error-handling-plugin.ts:61


executeWithRetry

executeWithRetry<T>(fn, context?): Promise<T>

Execute a function with error handling and retry logic REASON: PluginError constructor requires ErrorContextData which has different type constraints than ErrorHandlingContextData, causing multiple type compatibility issues ALTERNATIVES_CONSIDERED: Union types (breaks existing error context interfaces), interface definition (creates circular dependencies), generic types (complex type propagation through error handling chain), conditional types (breaks existing plugin interfaces), mapped types (incompatible with error constructor signatures), type guards (runtime only, doesn't solve constructor compatibility), custom declarations (breaks PluginError interface contract), code refactoring (would require redesigning entire error handling system across all plugins),

Type parameters

Name
T

Parameters

NameType
fn() => Promise<T>
contextErrorHandlingContextData

Returns

Promise<T>

Types

packages (none available for this specific use case), external library integration (no standard error context type systems available), utility types (Pick/Omit create new compatibility issues) TODO: Create unified error context type system that bridges ErrorHandlingContextData and ErrorContextData requirements, or redesign PluginError to accept more flexible context types

Defined in

packages/agents/src/plugins/error-handling/error-handling-plugin.ts:108


resetCircuitBreaker

resetCircuitBreaker(): void

Reset circuit breaker state

Returns

void

Defined in

packages/agents/src/plugins/error-handling/error-handling-plugin.ts:169


getStats

getStats(): ErrorHandlingPluginStats

Get error handling statistics

Returns

ErrorHandlingPluginStats

Overrides

BasePlugin.getStats

Defined in

packages/agents/src/plugins/error-handling/error-handling-plugin.ts:179


destroy

destroy(): Promise<void>

Cleanup resources

Returns

Promise<void>

Defined in

packages/agents/src/plugins/error-handling/error-handling-plugin.ts:192

Released under the MIT License.