#[non_exhaustive]pub enum AgentOutcome {
Completed {
text: String,
steps_used: u32,
usage: TokenUsage,
},
BudgetExhausted {
reason: BudgetKind,
steps_used: u32,
usage: TokenUsage,
},
LoopDetected {
tool: String,
repeats: u32,
steps_used: u32,
usage: TokenUsage,
},
AwaitingApproval {
state: Box<RunState>,
},
}Expand description
The result of one agent run.
Marked #[non_exhaustive]: match with a wildcard arm so new stop
reasons do not break your build.
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.
Completed
The model produced a final answer.
Fields
§
usage: TokenUsageProvider-reported token totals.
BudgetExhausted
A budget ran out before the model finished.
LoopDetected
The model repeated the same tool call with the same result too often.
Fields
§
usage: TokenUsageProvider-reported token totals.
AwaitingApproval
The policy wants a person to approve one or more calls.
Fields
§
state: Box<RunState>The paused run. Pass it to Agent::resume.
Implementations§
Source§impl AgentOutcome
impl AgentOutcome
Sourcepub fn steps_used(&self) -> u32
pub fn steps_used(&self) -> u32
Tool-execution rounds consumed, whatever the outcome.
Sourcepub fn usage(&self) -> TokenUsage
pub fn usage(&self) -> TokenUsage
Provider-reported token totals, whatever the outcome.
Sourcepub const fn is_completed(&self) -> bool
pub const fn is_completed(&self) -> bool
true when the model produced a final answer.
Trait Implementations§
Source§impl Clone for AgentOutcome
impl Clone for AgentOutcome
Source§impl Debug for AgentOutcome
impl Debug for AgentOutcome
Source§impl<'de> Deserialize<'de> for AgentOutcome
impl<'de> Deserialize<'de> for AgentOutcome
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for AgentOutcome
impl PartialEq for AgentOutcome
Source§impl Serialize for AgentOutcome
impl Serialize for AgentOutcome
impl StructuralPartialEq for AgentOutcome
Auto Trait Implementations§
impl Forget for AgentOutcome
impl Freeze for AgentOutcome
impl RefUnwindSafe for AgentOutcome
impl Send for AgentOutcome
impl Sync for AgentOutcome
impl Unpin for AgentOutcome
impl UnsafeUnpin for AgentOutcome
impl UnwindSafe for AgentOutcome
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> JsonSink for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Scoped for T
impl<T> Scoped for T
Source§fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
Open a deferred
ScopeQuery for this type. Resolves the
registered scope at .load() time, not here.