pub trait AgentLifecycle: Send + Sync {
// Provided methods
fn on_wait(&self, _state: &AgentState) -> Effect<()> { ... }
fn on_resume(&self, _state: &AgentState) -> Effect<()> { ... }
fn on_goal_created(
&self,
_goal_id: GoalId,
_description: &str,
) -> Effect<()> { ... }
fn on_goal_activated(&self, _goal_id: GoalId) -> Effect<()> { ... }
fn on_goal_achieved(&self, _goal_id: GoalId) -> Effect<()> { ... }
fn on_goal_failed(&self, _goal_id: GoalId, _reason: &str) -> Effect<()> { ... }
fn on_plan_created(&self, _plan_id: PlanId, _goal_id: GoalId) -> Effect<()> { ... }
fn on_plan_completed(&self, _plan_id: PlanId) -> Effect<()> { ... }
fn on_belief_updated(
&self,
_belief_id: BeliefId,
_confidence: f32,
) -> Effect<()> { ... }
fn on_belief_superseded(&self, _old: BeliefId, _new: BeliefId) -> Effect<()> { ... }
fn on_drift_detected(
&self,
_other_agent: AgentId,
_composite_score: f64,
) -> Effect<()> { ... }
}Expand description
Lifecycle hooks for agent state transitions and BDI events.
All methods have default no-op implementations so consumers only
override the hooks they care about. Return Effect::Err(...) to
signal that the hook vetoed the transition (caller decides policy).
Provided Methods§
Sourcefn on_wait(&self, _state: &AgentState) -> Effect<()>
fn on_wait(&self, _state: &AgentState) -> Effect<()>
Called when the agent enters a wait state (checkpoint).
Sourcefn on_resume(&self, _state: &AgentState) -> Effect<()>
fn on_resume(&self, _state: &AgentState) -> Effect<()>
Called when the agent resumes from a wait state.
Sourcefn on_goal_created(&self, _goal_id: GoalId, _description: &str) -> Effect<()>
fn on_goal_created(&self, _goal_id: GoalId, _description: &str) -> Effect<()>
A new goal was created for this agent.
Sourcefn on_goal_activated(&self, _goal_id: GoalId) -> Effect<()>
fn on_goal_activated(&self, _goal_id: GoalId) -> Effect<()>
A goal transitioned to Active.
Sourcefn on_goal_achieved(&self, _goal_id: GoalId) -> Effect<()>
fn on_goal_achieved(&self, _goal_id: GoalId) -> Effect<()>
A goal was achieved (all criteria satisfied).
Sourcefn on_goal_failed(&self, _goal_id: GoalId, _reason: &str) -> Effect<()>
fn on_goal_failed(&self, _goal_id: GoalId, _reason: &str) -> Effect<()>
A goal failed (deadline, max retries, or explicit failure).
Sourcefn on_plan_created(&self, _plan_id: PlanId, _goal_id: GoalId) -> Effect<()>
fn on_plan_created(&self, _plan_id: PlanId, _goal_id: GoalId) -> Effect<()>
A new plan was created for a goal.
Sourcefn on_plan_completed(&self, _plan_id: PlanId) -> Effect<()>
fn on_plan_completed(&self, _plan_id: PlanId) -> Effect<()>
A plan completed (all steps done).
Sourcefn on_belief_updated(
&self,
_belief_id: BeliefId,
_confidence: f32,
) -> Effect<()>
fn on_belief_updated( &self, _belief_id: BeliefId, _confidence: f32, ) -> Effect<()>
A belief was created or its confidence was updated.