BaseAgent class abstract

Base class for all agent implementations.

Constructors

BaseAgent({required String name, String description = '', List<BaseAgent>? subAgents, Object? beforeAgentCallback, Object? afterAgentCallback})
Creates a base agent with optional lifecycle callbacks and sub-agents.

Properties

afterAgentCallback Object?
Callback(s) invoked after agent execution.
getter/setter pair
beforeAgentCallback Object?
Callback(s) invoked before agent execution.
getter/setter pair
canonicalAfterAgentCallbacks List<AgentLifecycleCallback>
Canonical after-agent callbacks.
no setter
canonicalBeforeAgentCallbacks List<AgentLifecycleCallback>
Canonical before-agent callbacks.
no setter
description String
Human-readable description.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
name String
Agent name.
getter/setter pair
parentAgent BaseAgent?
Parent agent in the hierarchy, if any.
getter/setter pair
rootAgent BaseAgent
The top-most ancestor in this agent hierarchy.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subAgents List<BaseAgent>
Child agents that this agent may delegate to.
getter/setter pair

Methods

clone({Map<String, Object?>? update}) BaseAgent
Returns a clone of this agent with optional update overrides.
cloneFieldValue<T>({required Map<String, Object?> update, required String fieldName, required T currentValue}) → T
Reads typed field overrides for clone operations.
cloneListFieldValue<T>({required Map<String, Object?> update, required String fieldName, required List<T> currentValue}) List<T>
Reads list field overrides for clone operations.
cloneObjectFieldValue({required Map<String, Object?> update, required String fieldName, required Object? currentValue}) Object?
Reads object field overrides while preserving list copy semantics.
cloneSubAgentsField(Map<String, Object?> update) List<BaseAgent>
Resolves cloned sub-agent lists from update or existing sub-agents.
createAgentStateEvent(InvocationContext context) Event
Creates an event containing this agent's latest serialized state.
createInvocationContext(InvocationContext parentContext) InvocationContext
Creates a child invocation context for this agent.
findAgent(String targetName) BaseAgent?
Finds an agent named targetName in this subtree.
findSubAgent(String targetName) BaseAgent?
Finds a descendant agent named targetName.
loadAgentState(InvocationContext context) BaseAgentState?
Loads this agent's serialized state from context, if present.
normalizeCloneUpdate(Map<String, Object?>? update) Map<String, Object?>
Normalizes clone update maps into mutable JSON-like maps.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
relinkClonedSubAgents(BaseAgent clonedAgent) → void
Re-links parent pointers for clonedAgent and its sub-agents.
runAsync(InvocationContext parentContext) Stream<Event>
Runs the agent asynchronously with lifecycle callbacks.
runAsyncImpl(InvocationContext context) Stream<Event>
Runs the agent's async implementation.
runLive(InvocationContext parentContext) Stream<Event>
Runs the agent in live mode with lifecycle callbacks.
runLiveImpl(InvocationContext context) Stream<Event>
Runs the agent's live implementation.
toString() String
A string representation of this object.
inherited
validateCloneUpdateFields({required Map<String, Object?> update, required Set<String> allowedFields}) → void
Validates clone-update update keys against allowedFields.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

baseCloneUpdateFields → const Set<String>
Fields accepted by the default clone update validator.