pub trait AgentLifecycleHook: Send + Sync {
// Provided methods
fn before_step<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_ctx: &'life2 InvestigationContext,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn before_skill<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_skill_id: &'life2 str,
_applies: bool,
_confidence: f32,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn after_skill<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_skill_id: &'life2 str,
_outcome: &'life3 SkillOutcome,
_confidence: f32,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn after_step<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_result: &'life2 AgentStepResult,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn on_step_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_error: &'life2 KernelError,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Lifecycle hook around GenericAgent step and skill execution.
Hooks are producer-neutral: they do not depend on any telemetry backend.
Downstream crates can implement this trait to emit tracing events, collect
deterministic test records, or account for per-skill work without changing
the Agent trait itself.
Provided Methods§
Sourcefn before_step<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_ctx: &'life2 InvestigationContext,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn before_step<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_ctx: &'life2 InvestigationContext,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called before a GenericAgent step starts.
Sourcefn before_skill<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_skill_id: &'life2 str,
_applies: bool,
_confidence: f32,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn before_skill<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_skill_id: &'life2 str,
_applies: bool,
_confidence: f32,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when a skill is considered by the agent loop.
Sourcefn after_skill<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_skill_id: &'life2 str,
_outcome: &'life3 SkillOutcome,
_confidence: f32,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn after_skill<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_skill_id: &'life2 str,
_outcome: &'life3 SkillOutcome,
_confidence: f32,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Called after an applicable skill executes.
Sourcefn after_step<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_result: &'life2 AgentStepResult,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn after_step<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_result: &'life2 AgentStepResult,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when a step completed successfully.
Sourcefn on_step_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_error: &'life2 KernelError,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_step_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_agent: &'life1 GenericAgent,
_error: &'life2 KernelError,
) -> Pin<Box<dyn Future<Output = Result<(), KernelError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when the agent loop is aborting because a skill or hook failed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".