agents / Exports / PluginHooks
Interface: PluginHooks
Plugin lifecycle hooks
Implemented by
Table of contents
Methods
- beforeRun
- afterRun
- beforeExecution
- afterExecution
- beforeConversation
- afterConversation
- beforeToolCall
- beforeToolExecution
- afterToolCall
- afterToolExecution
- beforeProviderCall
- afterProviderCall
- onStreamingChunk
- onError
- onMessageAdded
- onModuleEvent
Methods
beforeRun
▸ beforeRun(input, options?): void | Promise<void>
Called before agent run
Parameters
| Name | Type |
|---|---|
input | string |
options? | RunOptions |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:197
afterRun
▸ afterRun(input, response, options?): void | Promise<void>
Called after agent run
Parameters
| Name | Type |
|---|---|
input | string |
response | string |
options? | RunOptions |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:202
beforeExecution
▸ beforeExecution(context): void | Promise<void>
Called before execution with context
Parameters
| Name | Type |
|---|---|
context | BaseExecutionContext |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:207
afterExecution
▸ afterExecution(context, result): void | Promise<void>
Called after execution with context and result
Parameters
| Name | Type |
|---|---|
context | BaseExecutionContext |
result | BaseExecutionResult |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:212
beforeConversation
▸ beforeConversation(context): void | Promise<void>
Called before conversation with context
Parameters
| Name | Type |
|---|---|
context | BaseExecutionContext |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:217
afterConversation
▸ afterConversation(context, result): void | Promise<void>
Called after conversation with context and result
Parameters
| Name | Type |
|---|---|
context | BaseExecutionContext |
result | BaseExecutionResult |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:222
beforeToolCall
▸ beforeToolCall(toolName, parameters): void | Promise<void>
Called before tool execution
Parameters
| Name | Type |
|---|---|
toolName | string |
parameters | ToolParameters |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:227
beforeToolExecution
▸ beforeToolExecution(context, toolData): void | Promise<void>
Called before tool execution with context
Parameters
| Name | Type |
|---|---|
context | BaseExecutionContext |
toolData | ToolExecutionContext |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:232
afterToolCall
▸ afterToolCall(toolName, parameters, result): void | Promise<void>
Called after tool execution
Parameters
| Name | Type |
|---|---|
toolName | string |
parameters | ToolParameters |
result | ToolExecutionResult |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:237
afterToolExecution
▸ afterToolExecution(context, toolResults): void | Promise<void>
Called after tool execution with context
Parameters
| Name | Type |
|---|---|
context | BaseExecutionContext |
toolResults | BaseExecutionResult |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:242
beforeProviderCall
▸ beforeProviderCall(messages): void | Promise<void>
Called before AI provider call
Parameters
| Name | Type |
|---|---|
messages | UniversalMessage[] |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:247
afterProviderCall
▸ afterProviderCall(messages, response): void | Promise<void>
Called after AI provider call
Parameters
| Name | Type |
|---|---|
messages | UniversalMessage[] |
response | UniversalMessage |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:252
onStreamingChunk
▸ onStreamingChunk(chunk): void | Promise<void>
Called on streaming chunk
Parameters
| Name | Type |
|---|---|
chunk | UniversalMessage |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:257
onError
▸ onError(error, context?): void | Promise<void>
Called on error
Parameters
| Name | Type |
|---|---|
error | Error |
context? | ErrorContext |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:262
onMessageAdded
▸ onMessageAdded(message): void | Promise<void>
Called on message added to history
Parameters
| Name | Type |
|---|---|
message | Message |
Returns
void | Promise<void>
Defined in
packages/agents/src/abstracts/base-plugin.ts:267
onModuleEvent
▸ onModuleEvent(eventType, eventData): void | Promise<void>
Called when module events are received
Parameters
| Name | Type |
|---|---|
eventType | EventType |
eventData | EventData |
Returns
void | Promise<void>