Skip to main content

ToolAuditOutcome

Enum ToolAuditOutcome 

Source
#[non_exhaustive]
pub enum ToolAuditOutcome { Blocked { reason: String, }, RequiresConfirmation { description: String, listen_context: Option<ListenExecutionContext>, }, Cached { result: ToolResult, }, Replayed { result: ToolResult, }, Invalidated { reason: String, }, Completed { result: ToolResult, }, PersistenceFailed { result: Option<ToolResult>, error: String, }, }
Expand description

Lifecycle outcome for a single tool call.

Every variant is an authoritative terminal state the server must persist — including paths that bypass tool execution entirely (blocked, confirmation, cached replay) or that fail persistence after the tool already ran.

Variants are ordered roughly by lifecycle position: policy check → cache lookup → execution → post-execution persistence.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Blocked

The policy hook rejected the tool call.

The tool never executed. The reason is the string returned by ToolDecision::Block.

Fields

§reason: String

Reason provided by the policy hook.

§

RequiresConfirmation

The policy hook yielded for user approval.

The tool is paused pending a resume decision. The turn loop will emit a follow-up record on resume (either Completed after execution or Blocked if policy now rejects).

Fields

§description: String

Human-readable confirmation description shown to the user.

§listen_context: Option<ListenExecutionContext>

Optional listen-context captured at confirmation time.

§

Cached

The execution store already held a completed result for this tool call — the idempotency layer replayed the cached outcome instead of calling the tool again.

Fields

§result: ToolResult

The cached ToolResult that was replayed.

§

Replayed

The caller resubmitted external tool results for an already processed handoff, and the SDK served the previously recorded result rather than re-accepting the payload.

Distinct from Cached in that this fires on the external runtime path where the SDK did not execute the tool itself in any attempt.

Fields

§result: ToolResult

The ToolResult previously recorded for this tool call.

§

Invalidated

A listen-tool snapshot expired or was invalidated before the user could confirm it.

This is a non-completion path: no final ToolResult is produced because the confirmation window closed.

Fields

§reason: String

Reason the listen-tool invalidated its snapshot.

§

Completed

The tool ran to completion (success or failure).

result.success indicates whether the tool itself succeeded; even a failing run is considered a completed lifecycle.

Fields

§result: ToolResult

Final ToolResult produced by the tool.

§

PersistenceFailed

The tool executed but the server could not durably persist the outcome (event store, execution store, or message append failed).

The record preserves the in-memory ToolResult so that audit consumers can reason about divergence between what the tool produced and what made it to durable storage.

Fields

§result: Option<ToolResult>

The ToolResult that would have been persisted, if any.

None when the persistence layer failed before a result was produced (e.g. a tool_call_start event failed to append).

§error: String

Short, human-readable description of the persistence failure.

Implementations§

Source§

impl ToolAuditOutcome

Source

pub const fn kind(&self) -> &'static str

Static discriminant string used for metrics, tracing attributes, and durable audit rows.

Source

pub const fn result(&self) -> Option<&ToolResult>

Returns the ToolResult associated with this outcome, if one is available.

Present for Cached, Replayed, Completed, and most PersistenceFailed paths. Absent for Blocked, RequiresConfirmation, and Invalidated.

Trait Implementations§

Source§

impl Clone for ToolAuditOutcome

Source§

fn clone(&self) -> ToolAuditOutcome

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ToolAuditOutcome

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ToolAuditOutcome

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<ToolAuditOutcome, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ToolAuditOutcome

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,