pub trait ToolExecutionStore: Send + Sync {
// Required methods
fn get_execution<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_call_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ToolExecution>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn record_execution<'life0, 'async_trait>(
&'life0 self,
execution: ToolExecution,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_execution<'life0, 'async_trait>(
&'life0 self,
execution: ToolExecution,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_execution_by_operation_id<'life0, 'life1, 'async_trait>(
&'life0 self,
operation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ToolExecution>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Store for tracking tool executions (idempotency).
This trait enables write-ahead execution tracking to ensure tool idempotency. The pattern is:
- Record execution intent BEFORE calling the tool (
record_execution) - Update with result AFTER completion (
update_execution) - On retry, check if execution exists and return cached result
Required Methods§
Sourcefn get_execution<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_call_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ToolExecution>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_execution<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_call_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ToolExecution>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn record_execution<'life0, 'async_trait>(
&'life0 self,
execution: ToolExecution,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn record_execution<'life0, 'async_trait>(
&'life0 self,
execution: ToolExecution,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Record a new execution (write-ahead, before calling tool).
§Errors
Returns an error if the execution cannot be recorded.
Sourcefn update_execution<'life0, 'async_trait>(
&'life0 self,
execution: ToolExecution,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_execution<'life0, 'async_trait>(
&'life0 self,
execution: ToolExecution,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update an existing execution (after completion or to set operation_id).
§Errors
Returns an error if the execution cannot be updated.
Sourcefn get_execution_by_operation_id<'life0, 'life1, 'async_trait>(
&'life0 self,
operation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ToolExecution>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_execution_by_operation_id<'life0, 'life1, 'async_trait>(
&'life0 self,
operation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ToolExecution>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get execution by operation_id (for async tool resume).
§Errors
Returns an error if the execution cannot be retrieved.