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.

EventData TypeDescription
startReActAgentStartEventTriggered when the agent begins execution.
errorReActAgentErrorEventTriggered when the agent encounters an error.
retryReActAgentRetryEventTriggered when the agent is retrying an operation.
successReActAgentSuccessEventTriggered when the agent successfully completes execution.
update and partial_updateReActAgentUpdateEventTriggered when the agent updates its state.
tool_startReActAgentToolEventTriggered when the agent begins using a tool.
tool_successReActAgentToolEventTriggered when a tool operation completes successfully.
tool_errorReActAgentToolEventTriggered when a tool operation fails.

ChatModel events

The following events can be observed when calling ChatModel.create or ChatModel.create_structure.

EventData TypeDescription
new_tokenChatModelNewTokenEventTriggered when a new token is generated during streaming.
successChatModelSuccessEventTriggered when the model generation completes successfully.
startChatModelStartEventTriggered when model generation begins.
errorChatModelErrorEventTriggered when model generation encounters an error.
finishNoneTriggered when model generation finishes (regardless of success or error).

Tool events

The following events can be observed when calling Tool.run.

EventData TypeDescription
startToolStartEventTriggered when a tool starts executing.
successToolSuccessEventTriggered when a tool completes execution successfully.
errorToolErrorEventTriggered when a tool encounters an error.
retryToolRetryEventTriggered when a tool operation is being retried.
finishNoneTriggered when tool execution finishes (regardless of success or error).

Workflow events

The following events can be observed when calling Workflow.run.

EventData TypeDescription
startWorkflowStartEventTriggered when a workflow step begins execution.
successWorkflowSuccessEventTriggered when a workflow step completes successfully.
errorWorkflowErrorEventTriggered when a workflow step encounters an error.

ToolCallingAgent events

The following events can be observed calling ToolCallingAgent.run.

EventData TypeDescription
startToolCallingAgentStartEventTriggered when the agent begins execution.
successToolCallingAgentSuccessEventTriggered when the agent successfully completes execution.

Internal events

These events are primarily used for internal framework operations and debugging. They are not typically meant for end-users.

RunContext events

The following events are for internal debugging of run contexts.

EventData TypeDescription
startNoneTriggered when the run starts.
success<Run return object>Triggered when the run succeeds.
errorFrameworkErrorTriggered when an error occurs.
finishNoneTriggered when the run finishes.

LinePrefixParser events

The following events are caught internally by the line prefix parser.

EventData TypeDescription
updateLinePrefixParserUpdateTriggered when an update occurs.
partial_updateLinePrefixParserUpdateTriggered when a partial update occurs.