Overview
BeeAI framework uses an event-driven architecture that allows you to observe and respond to various events throughout the execution lifecycle. This document outlines the standard events emitted by different components and their data structures.
All events in the framework follow a consistent pattern:
- Each event has a name (e.g., “start”, “success”, “error”)
- Each event contains a data payload with a defined datatype
- Events can be observed by attaching listeners to the appropriate emitter
Supported in Python and TypeScript.
Event types
ReActAgent events
The following events can be observed calling ReActAgent.run
.
Event | Data Type | Description |
---|
start | ReActAgentStartEvent | Triggered when the agent begins execution. |
error | ReActAgentErrorEvent | Triggered when the agent encounters an error. |
retry | ReActAgentRetryEvent | Triggered when the agent is retrying an operation. |
success | ReActAgentSuccessEvent | Triggered when the agent successfully completes execution. |
update and partial_update | ReActAgentUpdateEvent | Triggered when the agent updates its state. |
tool_start | ReActAgentToolEvent | Triggered when the agent begins using a tool. |
tool_success | ReActAgentToolEvent | Triggered when a tool operation completes successfully. |
tool_error | ReActAgentToolEvent | Triggered when a tool operation fails. |
Check out the in-code definition the in-code definition.
ChatModel events
The following events can be observed when calling ChatModel.create
or ChatModel.create_structure
.
Event | Data Type | Description |
---|
new_token | ChatModelNewTokenEvent | Triggered when a new token is generated during streaming. |
success | ChatModelSuccessEvent | Triggered when the model generation completes successfully. |
start | ChatModelStartEvent | Triggered when model generation begins. |
error | ChatModelErrorEvent | Triggered when model generation encounters an error. |
finish | None | Triggered when model generation finishes (regardless of success or error). |
Check out the in-code definition the in-code definition.
The following events can be observed when calling Tool.run
.
Event | Data Type | Description |
---|
start | ToolStartEvent | Triggered when a tool starts executing. |
success | ToolSuccessEvent | Triggered when a tool completes execution successfully. |
error | ToolErrorEvent | Triggered when a tool encounters an error. |
retry | ToolRetryEvent | Triggered when a tool operation is being retried. |
finish | None | Triggered when tool execution finishes (regardless of success or error). |
Check out the in-code definition the in-code definition.
Workflow events
The following events can be observed when calling Workflow.run
.
Event | Data Type | Description |
---|
start | WorkflowStartEvent | Triggered when a workflow step begins execution. |
success | WorkflowSuccessEvent | Triggered when a workflow step completes successfully. |
error | WorkflowErrorEvent | Triggered when a workflow step encounters an error. |
Check out the in-code definition the in-code definition.
The following events can be observed calling ToolCallingAgent.run
.
Event | Data Type | Description |
---|
start | ToolCallingAgentStartEvent | Triggered when the agent begins execution. |
success | ToolCallingAgentSuccessEvent | Triggered when the agent successfully completes execution. |
Check out the in-code definition the in-code definition.
RequirementAgent events
Event | Data Type | Description |
---|
start | RequirementAgentStartEvent | Triggered when the agent begins execution. |
success | RequirementAgentSuccessEvent | Triggered when the agent successfully completes execution. |
Check out the in-code definition the in-code definition.
RunContext events (internal)
Special events that are emitted before the target’s handler gets executed.
A run event contains .run.
in its event’s path and has internal
set to true in event’s context object.
Event | Data Type | Description |
---|
start | None | Triggered when the run starts. |
success | <Run return object> | Triggered when the run succeeds. |
error | FrameworkError | Triggered when an error occurs. |
finish | None | Triggered when the run finishes. |
Check out the in-code definition the in-code definition.
LinePrefixParser events
The following events are caught internally by the line prefix parser.
Event | Data Type | Description |
---|
update | LinePrefixParserUpdate | Triggered when an update occurs. |
partial_update | LinePrefixParserUpdate | Triggered when a partial update occurs. |
Check out the in-code definition the in-code definition.