AbstractAgent
Base agent implementation with core event handling
AbstractAgent
The AbstractAgent
class provides the foundation for all agent implementations
in the Agent Wire Protocol. It handles the core event stream processing, state
management, and message history.
Configuration
By default, all agents are configured by providing an optional AgentConfig
object to the constructor.
Adding Configuration Options in your Subclass
To add additional configuration options, it is recommended to extend the
AgentConfig
interface and call the super constructor with the extended config
from your subclass like this:
Core Methods
runAgent()
The primary method for executing an agent and receiving the event stream.
Parameters
abortRun()
Cancels the current agent execution.
clone()
Creates a deep copy of the agent instance.
Properties
agentId
: Unique identifier for the agent instancedescription
: Human-readable descriptionthreadId
: Conversation thread identifiermessages
: Array of conversation messagesstate
: Current agent state object
Protected Methods
These methods are meant to be implemented or extended by subclasses:
run()
Executes the agent and returns an observable event stream.
apply()
Processes events from the run and updates the agent state.
prepareRunAgentInput()
Prepares the input parameters for the agent execution.
onError() and onFinalize()
Lifecycle hooks for error handling and cleanup operations.