pub struct ToolExecution {
pub id: Uuid,
pub session_id: Uuid,
pub message_id: Uuid,
pub call_id: String,
pub tool_name: String,
pub arguments: Value,
pub result: Option<Value>,
pub status: ToolExecutionStatus,
pub error: Option<String>,
pub duration: Duration,
pub created_at: DateTime<Utc>,
}Expand description
Persisted record of a single tool invocation.
Captures the full lifecycle: input arguments, output result, execution status, wall-clock duration, and any error message on failure.
Fields§
§id: UuidUnique execution identifier.
session_id: UuidSession this execution belongs to.
message_id: UuidMessage that triggered the tool call.
call_id: StringTool call identifier from the provider.
tool_name: StringTool name that was executed.
arguments: ValueJSON arguments passed to the tool.
result: Option<Value>Tool output value, if execution succeeded.
status: ToolExecutionStatusExecution status.
error: Option<String>Human-readable error message when status is Failed.
duration: DurationWall-clock execution duration.
created_at: DateTime<Utc>When the execution started.
Implementations§
Source§impl ToolExecution
impl ToolExecution
Sourcepub fn new(
session_id: Uuid,
message_id: Uuid,
call_id: impl Into<String>,
tool_name: impl Into<String>,
arguments: Value,
) -> Self
pub fn new( session_id: Uuid, message_id: Uuid, call_id: impl Into<String>, tool_name: impl Into<String>, arguments: Value, ) -> Self
Creates a new tool execution record with a generated UUIDv7 ID and current timestamp.
The execution starts with Pending status, no result, no error,
and zero duration.
Sourcepub fn with_success(self, result: Value, duration: Duration) -> Self
pub fn with_success(self, result: Value, duration: Duration) -> Self
Marks the execution as successful with the given result and duration, consuming and returning self.
Sourcepub fn with_failure(self, error: impl Into<String>, duration: Duration) -> Self
pub fn with_failure(self, error: impl Into<String>, duration: Duration) -> Self
Marks the execution as failed with the given error message and duration, consuming and returning self.
Trait Implementations§
Source§impl Clone for ToolExecution
impl Clone for ToolExecution
Source§fn clone(&self) -> ToolExecution
fn clone(&self) -> ToolExecution
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToolExecution
impl Debug for ToolExecution
Source§impl<'de> Deserialize<'de> for ToolExecution
impl<'de> Deserialize<'de> for ToolExecution
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ToolExecution
impl PartialEq for ToolExecution
Source§fn eq(&self, other: &ToolExecution) -> bool
fn eq(&self, other: &ToolExecution) -> bool
self and other values to be equal, and is used by ==.