agents / Exports / ExecutionAnalyticsPlugin
Class: ExecutionAnalyticsPlugin
Plugin for tracking execution analytics automatically Integrates with agent lifecycle to track performance without manual intervention
Hierarchy
BasePlugin<ExecutionAnalyticsOptions,ExecutionAnalyticsPluginStats>↳
ExecutionAnalyticsPlugin
Table of contents
Constructors
Properties
Methods
- initialize
- subscribeToModuleEvents
- unsubscribeFromModuleEvents
- dispose
- enable
- disable
- isEnabled
- getConfig
- updateConfig
- getData
- clearData
- beforeExecution
- afterExecution
- beforeConversation
- afterConversation
- beforeToolExecution
- afterToolExecution
- onStreamingChunk
- onMessageAdded
- onModuleEvent
- beforeRun
- afterRun
- beforeProviderCall
- afterProviderCall
- beforeToolCall
- afterToolCall
- onError
- getExecutionStats
- getAggregatedStats
- clearStats
- getActiveExecutions
- getPluginStats
- destroy
- getExecutionData
- getAnalyticsStats
- clearExecutionData
- getStatus
- getStats
Constructors
constructor
• new ExecutionAnalyticsPlugin(options?): ExecutionAnalyticsPlugin
Parameters
| Name | Type |
|---|---|
options | ExecutionAnalyticsOptions |
Returns
Overrides
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:31
Properties
enabled
• enabled: boolean = true
Plugin enabled state
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:297
category
• category: PluginCategory = PluginCategory.CUSTOM
Plugin category for classification
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:300
priority
• priority: number = PluginPriority.NORMAL
Plugin priority for execution order
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:303
name
• name: string = 'ExecutionAnalyticsPlugin'
Plugin name
Overrides
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:21
version
• version: string = '1.0.0'
Plugin version
Overrides
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:22
Methods
initialize
▸ initialize(options?): Promise<void>
Initialize the plugin with type-safe options
Parameters
| Name | Type |
|---|---|
options? | ExecutionAnalyticsOptions |
Returns
Promise<void>
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:328
subscribeToModuleEvents
▸ subscribeToModuleEvents(eventEmitter): Promise<void>
Subscribe to module events through EventEmitter
Parameters
| Name | Type |
|---|---|
eventEmitter | EventEmitterPlugin |
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
| Name | Type |
|---|---|
eventEmitter | EventEmitterPlugin |
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
Defined in
packages/agents/src/abstracts/base-plugin.ts:430
enable
▸ enable(): void
Enable the plugin
Returns
void
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:442
disable
▸ disable(): void
Disable the plugin
Returns
void
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:449
isEnabled
▸ isEnabled(): boolean
Check if plugin is enabled
Returns
boolean
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:456
getConfig
▸ getConfig(): PluginConfig
Get plugin configuration
Returns
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:463
updateConfig
▸ updateConfig(_config): void
Update plugin configuration
Parameters
| Name | Type |
|---|---|
_config | PluginConfig |
Returns
void
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:470
getData
▸ getData(): PluginData
Get plugin data - enhanced with classification information
Returns
Inherited from
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
Defined in
packages/agents/src/abstracts/base-plugin.ts:497
beforeExecution
▸ beforeExecution(context): Promise<void>
Called before execution with context
Parameters
| Name | Type |
|---|---|
context | BaseExecutionContext |
Returns
Promise<void>
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:558
afterExecution
▸ afterExecution(context, result): Promise<void>
Called after execution with context and result
Parameters
| Name | Type |
|---|---|
context | BaseExecutionContext |
result | BaseExecutionResult |
Returns
Promise<void>
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:559
beforeConversation
▸ beforeConversation(context): Promise<void>
Called before conversation with context
Parameters
| Name | Type |
|---|---|
context | BaseExecutionContext |
Returns
Promise<void>
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:560
afterConversation
▸ afterConversation(context, result): Promise<void>
Called after conversation with context and result
Parameters
| Name | Type |
|---|---|
context | BaseExecutionContext |
result | BaseExecutionResult |
Returns
Promise<void>
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:561
beforeToolExecution
▸ beforeToolExecution(context, toolData): Promise<void>
Called before tool execution with context
Parameters
| Name | Type |
|---|---|
context | BaseExecutionContext |
toolData | ToolExecutionContext |
Returns
Promise<void>
Inherited from
BasePlugin.beforeToolExecution
Defined in
packages/agents/src/abstracts/base-plugin.ts:563
afterToolExecution
▸ afterToolExecution(context, toolResults): Promise<void>
Called after tool execution with context
Parameters
| Name | Type |
|---|---|
context | BaseExecutionContext |
toolResults | BaseExecutionResult |
Returns
Promise<void>
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:565
onStreamingChunk
▸ onStreamingChunk(chunk): Promise<void>
Called on streaming chunk
Parameters
| Name | Type |
|---|---|
chunk | UniversalMessage |
Returns
Promise<void>
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:568
onMessageAdded
▸ onMessageAdded(message): Promise<void>
Called on message added to history
Parameters
| Name | Type |
|---|---|
message | Message |
Returns
Promise<void>
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:570
onModuleEvent
▸ onModuleEvent(eventType, eventData): Promise<void>
Called when module events are received
Parameters
| Name | Type |
|---|---|
eventType | EventType |
eventData | EventData |
Returns
Promise<void>
Inherited from
Defined in
packages/agents/src/abstracts/base-plugin.ts:571
beforeRun
▸ beforeRun(input, options?): Promise<void>
Called before agent run - start tracking
Parameters
| Name | Type |
|---|---|
input | string |
options? | RunOptions |
Returns
Promise<void>
Overrides
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:73
afterRun
▸ afterRun(input, response, options?): Promise<void>
Called after agent run - end tracking
Parameters
| Name | Type |
|---|---|
input | string |
response | string |
options? | RunOptions |
Returns
Promise<void>
Overrides
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:92
beforeProviderCall
▸ beforeProviderCall(messages): Promise<void>
Called before provider call - start tracking
Parameters
| Name | Type |
|---|---|
messages | UniversalMessage[] |
Returns
Promise<void>
Overrides
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:143
afterProviderCall
▸ afterProviderCall(messages, response): Promise<void>
Called after provider call - end tracking
Parameters
| Name | Type |
|---|---|
messages | UniversalMessage[] |
response | UniversalMessage |
Returns
Promise<void>
Overrides
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:161
beforeToolCall
▸ beforeToolCall(toolName, parameters): Promise<void>
Called before tool call - start tracking
Parameters
| Name | Type |
|---|---|
toolName | string |
parameters | ToolParameters |
Returns
Promise<void>
Overrides
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:210
afterToolCall
▸ afterToolCall(toolName, parameters, result): Promise<void>
Called after tool call - end tracking
Parameters
| Name | Type |
|---|---|
toolName | string |
parameters | ToolParameters |
result | ToolExecutionResult |
Returns
Promise<void>
Overrides
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:229
onError
▸ onError(error, context?): Promise<void>
Called on error - end tracking with error
Parameters
| Name | Type |
|---|---|
error | Error |
context? | ErrorContext |
Returns
Promise<void>
Overrides
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:279
getExecutionStats
▸ getExecutionStats(operation?, timeRange?): ExecutionStats[]
Get execution statistics
Parameters
| Name | Type |
|---|---|
operation? | string |
timeRange? | Object |
timeRange.start | Date |
timeRange.end | Date |
Returns
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:328
getAggregatedStats
▸ getAggregatedStats(timeRange?): AggregatedExecutionStats
Get aggregated execution statistics
Parameters
| Name | Type |
|---|---|
timeRange? | Object |
timeRange.start | Date |
timeRange.end | Date |
Returns
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:347
clearStats
▸ clearStats(): void
Clear all statistics
Returns
void
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:440
getActiveExecutions
▸ getActiveExecutions(): { executionId: string ; operation: string ; duration: number }[]
Get currently active executions
Returns
{ executionId: string ; operation: string ; duration: number }[]
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:450
getPluginStats
▸ getPluginStats(): Object
Get plugin performance statistics
Returns
Object
| Name | Type |
|---|---|
totalRecorded | number |
activeExecutions | number |
memoryUsage | number |
oldestRecord? | Date |
newestRecord? | Date |
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:462
destroy
▸ destroy(): Promise<void>
Clean up resources
Returns
Promise<void>
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:498
getExecutionData
▸ getExecutionData(): ExecutionStats[]
Get execution data for export
Returns
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:506
getAnalyticsStats
▸ getAnalyticsStats(): AggregatedExecutionStats
Get analytics statistics
Returns
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:513
clearExecutionData
▸ clearExecutionData(): void
Clear execution data
Returns
void
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:520
getStatus
▸ getStatus(): Object
Get plugin status
Returns
Object
| Name | Type |
|---|---|
name | string |
version | string |
enabled | boolean |
initialized | boolean |
category | PluginCategory |
priority | number |
subscribedEventsCount | number |
hasEventEmitter | boolean |
Overrides
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:527
getStats
▸ getStats(): ExecutionAnalyticsPluginStats
Get plugin statistics
Returns
Overrides
Defined in
packages/agents/src/plugins/execution/execution-analytics-plugin.ts:552