pub trait AgentCapability: Send + Sync {
Show 33 methods
// Provided methods
fn spec(&self) -> CapabilitySpec { ... }
fn on_run_start<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn on_run_start_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn prepare_run_input<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
input: AgentInput,
) -> Pin<Box<dyn Future<Output = CapabilityResult<AgentInput>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn prepare_run_input_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
input: AgentInput,
) -> Pin<Box<dyn Future<Output = CapabilityResult<AgentInput>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn prepare_model_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
messages: Vec<ModelMessage>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ModelMessage>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn prepare_model_messages_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
messages: Vec<ModelMessage>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ModelMessage>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn prepare_provider_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
messages: Vec<ModelMessage>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ModelMessage>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn prepare_provider_messages_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
messages: Vec<ModelMessage>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ModelMessage>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn prepare_tools<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 AgentRunState,
tools: Vec<ToolDefinition>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ToolDefinition>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn prepare_tools_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 AgentRunState,
_context: &'life2 AgentContext,
tools: Vec<ToolDefinition>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ToolDefinition>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn before_model_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_request: &'life2 mut ModelRequest,
_settings: &'life3 mut Option<ModelSettings>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn before_model_request_with_context<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
context: &'life2 mut AgentContext,
request: &'life3 mut ModelRequest,
settings: &'life4 mut Option<ModelSettings>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
fn after_model_response<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_response: &'life2 mut ModelResponse,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn before_tool_execution<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_tool_context: &'life2 mut ToolContext,
_call: &'life3 ToolCallPart,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn before_tool_execution_with_context<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
tool_context: &'life3 mut ToolContext,
call: &'life4 ToolCallPart,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
fn after_tool_result<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_call: &'life2 ToolCallPart,
_tool_return: &'life3 mut ToolReturnPart,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn after_tool_result_with_context<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
call: &'life3 ToolCallPart,
tool_return: &'life4 mut ToolReturnPart,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
fn after_model_response_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
context: &'life2 mut AgentContext,
response: &'life3 mut ModelResponse,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn before_output_validation<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_output: &'life2 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn before_output_validation_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
output: &'life3 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn validate_output<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_output: &'life2 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn validate_output_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
context: &'life2 mut AgentContext,
output: &'life3 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn after_output_validation<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_output: &'life2 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn after_output_validation_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
output: &'life3 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn on_checkpoint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 AgentRunState,
_checkpoint: &'life2 AgentCheckpoint,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn on_checkpoint_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 AgentRunState,
_context: &'life2 AgentContext,
checkpoint: &'life3 AgentCheckpoint,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn on_retry<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_kind: RetryEventKind,
_retries: usize,
_message: &'life2 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn on_stream_event<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 AgentRunState,
_event: &'life2 AgentStreamRecord,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn on_stream_event_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 AgentRunState,
_context: &'life2 AgentContext,
event: &'life3 AgentStreamRecord,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn on_retry_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
kind: RetryEventKind,
retries: usize,
message: &'life3 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn on_run_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn on_run_complete_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
context: &'life2 mut AgentContext,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Hook interface for runtime extension points.
Provided Methods§
Sourcefn spec(&self) -> CapabilitySpec
fn spec(&self) -> CapabilitySpec
Stable capability spec used for ordering and reconstruction evidence.
Sourcefn on_run_start<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_run_start<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called after a run state is created and before the first request is prepared.
Sourcefn on_run_start_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_run_start_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Context-aware run-start hook.
Sourcefn prepare_run_input<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
input: AgentInput,
) -> Pin<Box<dyn Future<Output = CapabilityResult<AgentInput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn prepare_run_input<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
input: AgentInput,
) -> Pin<Box<dyn Future<Output = CapabilityResult<AgentInput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called after run state is initialized and before the first model request is built.
Sourcefn prepare_run_input_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
input: AgentInput,
) -> Pin<Box<dyn Future<Output = CapabilityResult<AgentInput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn prepare_run_input_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
input: AgentInput,
) -> Pin<Box<dyn Future<Output = CapabilityResult<AgentInput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Context-aware run-input preparation hook.
Sourcefn prepare_model_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
messages: Vec<ModelMessage>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ModelMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn prepare_model_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
messages: Vec<ModelMessage>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ModelMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called after message history is assembled and before provider-bound preparation/model call.
Mutations from this hook are captured in canonical session history. Use this hook
for model-visible context that must remain part of future request prefixes; use
prepare_provider_messages for provider-only transient rewrites. The runtime
context injector is implemented as a built-in capability in this canonical pipeline.
Sourcefn prepare_model_messages_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
messages: Vec<ModelMessage>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ModelMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn prepare_model_messages_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
messages: Vec<ModelMessage>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ModelMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Context-aware model-message preparation hook.
Mutations from this hook are captured in canonical session history. Use this hook
for model-visible context that must remain part of future request prefixes; use
prepare_provider_messages_with_context for provider-only transient rewrites.
Sourcefn prepare_provider_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
messages: Vec<ModelMessage>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ModelMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn prepare_provider_messages<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
messages: Vec<ModelMessage>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ModelMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called after canonical model-message capabilities and durable history capture, before the model call.
Mutations from this hook are provider-bound only and are not copied back into the session message history.
Sourcefn prepare_provider_messages_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
messages: Vec<ModelMessage>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ModelMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn prepare_provider_messages_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
messages: Vec<ModelMessage>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ModelMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Context-aware provider-bound message preparation hook.
Sourcefn prepare_tools<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 AgentRunState,
tools: Vec<ToolDefinition>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ToolDefinition>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn prepare_tools<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 AgentRunState,
tools: Vec<ToolDefinition>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ToolDefinition>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called after tool definitions are collected and before request parameters are finalized.
Sourcefn prepare_tools_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 AgentRunState,
_context: &'life2 AgentContext,
tools: Vec<ToolDefinition>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ToolDefinition>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn prepare_tools_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 AgentRunState,
_context: &'life2 AgentContext,
tools: Vec<ToolDefinition>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<Vec<ToolDefinition>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Context-aware prepare-tools hook.
Sourcefn before_model_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_request: &'life2 mut ModelRequest,
_settings: &'life3 mut Option<ModelSettings>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn before_model_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_request: &'life2 mut ModelRequest,
_settings: &'life3 mut Option<ModelSettings>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Called after a request is prepared and before the model call.
Sourcefn before_model_request_with_context<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
context: &'life2 mut AgentContext,
request: &'life3 mut ModelRequest,
settings: &'life4 mut Option<ModelSettings>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn before_model_request_with_context<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
context: &'life2 mut AgentContext,
request: &'life3 mut ModelRequest,
settings: &'life4 mut Option<ModelSettings>,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Context-aware before-model-request hook.
Sourcefn after_model_response<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_response: &'life2 mut ModelResponse,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn after_model_response<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_response: &'life2 mut ModelResponse,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called after a model response is received.
Sourcefn before_tool_execution<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_tool_context: &'life2 mut ToolContext,
_call: &'life3 ToolCallPart,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn before_tool_execution<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_tool_context: &'life2 mut ToolContext,
_call: &'life3 ToolCallPart,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Called before a tool call is executed.
Sourcefn before_tool_execution_with_context<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
tool_context: &'life3 mut ToolContext,
call: &'life4 ToolCallPart,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn before_tool_execution_with_context<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
tool_context: &'life3 mut ToolContext,
call: &'life4 ToolCallPart,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Context-aware before-tool-execution hook.
Sourcefn after_tool_result<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_call: &'life2 ToolCallPart,
_tool_return: &'life3 mut ToolReturnPart,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn after_tool_result<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_call: &'life2 ToolCallPart,
_tool_return: &'life3 mut ToolReturnPart,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Called after a tool result is produced and before it is applied to run state.
Sourcefn after_tool_result_with_context<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
call: &'life3 ToolCallPart,
tool_return: &'life4 mut ToolReturnPart,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn after_tool_result_with_context<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
call: &'life3 ToolCallPart,
tool_return: &'life4 mut ToolReturnPart,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Context-aware after-tool-result hook.
Sourcefn after_model_response_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
context: &'life2 mut AgentContext,
response: &'life3 mut ModelResponse,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn after_model_response_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
context: &'life2 mut AgentContext,
response: &'life3 mut ModelResponse,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Context-aware after-model-response hook.
Sourcefn before_output_validation<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_output: &'life2 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn before_output_validation<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_output: &'life2 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called before final output validation begins.
Sourcefn before_output_validation_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
output: &'life3 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn before_output_validation_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
output: &'life3 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Context-aware before-output-validation hook.
Sourcefn validate_output<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_output: &'life2 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn validate_output<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_output: &'life2 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called after output text is selected and before finalization.
Sourcefn validate_output_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
context: &'life2 mut AgentContext,
output: &'life3 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn validate_output_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
context: &'life2 mut AgentContext,
output: &'life3 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Context-aware output validation hook.
Sourcefn after_output_validation<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_output: &'life2 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn after_output_validation<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_output: &'life2 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called after output validation accepts the output.
Sourcefn after_output_validation_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
output: &'life3 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn after_output_validation_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
output: &'life3 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Context-aware after-output-validation hook.
Sourcefn on_checkpoint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 AgentRunState,
_checkpoint: &'life2 AgentCheckpoint,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_checkpoint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 AgentRunState,
_checkpoint: &'life2 AgentCheckpoint,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called after an executor checkpoint is emitted.
Sourcefn on_checkpoint_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 AgentRunState,
_context: &'life2 AgentContext,
checkpoint: &'life3 AgentCheckpoint,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn on_checkpoint_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 AgentRunState,
_context: &'life2 AgentContext,
checkpoint: &'life3 AgentCheckpoint,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Context-aware checkpoint hook.
Sourcefn on_retry<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_kind: RetryEventKind,
_retries: usize,
_message: &'life2 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_retry<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
_kind: RetryEventKind,
_retries: usize,
_message: &'life2 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when semantic retry is scheduled.
Sourcefn on_stream_event<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 AgentRunState,
_event: &'life2 AgentStreamRecord,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_stream_event<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_state: &'life1 AgentRunState,
_event: &'life2 AgentStreamRecord,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called after a stream event is recorded.
Sourcefn on_stream_event_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 AgentRunState,
_context: &'life2 AgentContext,
event: &'life3 AgentStreamRecord,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn on_stream_event_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 AgentRunState,
_context: &'life2 AgentContext,
event: &'life3 AgentStreamRecord,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Context-aware stream observer hook.
Sourcefn on_retry_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
kind: RetryEventKind,
retries: usize,
message: &'life3 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn on_retry_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
_context: &'life2 mut AgentContext,
kind: RetryEventKind,
retries: usize,
message: &'life3 str,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Context-aware retry hook.
Sourcefn on_run_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_run_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 mut AgentRunState,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when a run completes.
Sourcefn on_run_complete_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
context: &'life2 mut AgentContext,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_run_complete_with_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut AgentRunState,
context: &'life2 mut AgentContext,
) -> Pin<Box<dyn Future<Output = CapabilityResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Context-aware run-complete hook.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".