pub struct AgentResult {
pub stop_reason: StopReason,
pub message: Message,
pub usage: Usage,
pub metrics: EventLoopMetrics,
pub state: InvocationState,
pub interrupts: Option<Vec<Interrupt>>,
pub structured_output: Option<Value>,
}Expand description
Result of an agent invocation.
Fields§
§stop_reason: StopReasonThe reason why the agent’s processing stopped.
message: MessageThe last message generated by the agent.
usage: UsageToken usage statistics.
metrics: EventLoopMetricsPerformance metrics collected during processing.
state: InvocationStateAdditional state information from the event loop.
interrupts: Option<Vec<Interrupt>>List of interrupts if raised by user.
structured_output: Option<Value>Parsed structured output when structured_output_model was specified.
Implementations§
Source§impl AgentResult
impl AgentResult
Sourcepub fn text(&self) -> String
pub fn text(&self) -> String
Returns the text content of the result.
Extracts and concatenates all text content from the final message, ignoring any non-text content like images or structured data. If there’s no text content but structured output is present, it serializes the structured output instead.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Returns true if the agent completed successfully.
Sourcepub fn is_interrupted(&self) -> bool
pub fn is_interrupted(&self) -> bool
Returns true if the agent was interrupted.
Sourcepub fn has_interrupts(&self) -> bool
pub fn has_interrupts(&self) -> bool
Returns true if there are pending interrupts.
Trait Implementations§
Source§impl Clone for AgentResult
impl Clone for AgentResult
Source§fn clone(&self) -> AgentResult
fn clone(&self) -> AgentResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AgentResult
impl Debug for AgentResult
Source§impl<'de> Deserialize<'de> for AgentResult
impl<'de> Deserialize<'de> for AgentResult
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 Display for AgentResult
impl Display for AgentResult
Auto Trait Implementations§
impl Freeze for AgentResult
impl RefUnwindSafe for AgentResult
impl Send for AgentResult
impl Sync for AgentResult
impl Unpin for AgentResult
impl UnwindSafe for AgentResult
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.