pub struct AgentResult {
pub output: String,
pub structured_output: Option<Value>,
pub messages: Vec<ModelMessage>,
pub state: AgentRunState,
pub history_len: usize,
}Expand description
Bare agent result.
Fields§
§output: StringFinal text output.
structured_output: Option<Value>Parsed structured output when an output schema is configured.
messages: Vec<ModelMessage>Canonical message history.
state: AgentRunStateFinal run state.
history_len: usizeNumber of messages supplied as prior history.
Implementations§
Source§impl AgentResult
impl AgentResult
Sourcepub fn all_messages(&self) -> &[ModelMessage]
pub fn all_messages(&self) -> &[ModelMessage]
Return all messages visible to the run.
Sourcepub fn new_messages(&self) -> &[ModelMessage]
pub fn new_messages(&self) -> &[ModelMessage]
Return messages produced by this run.
Sourcepub fn media_outputs(&self) -> Vec<OutputMedia>
pub fn media_outputs(&self) -> Vec<OutputMedia>
Return media/file outputs from the latest model response.
Sourcepub fn image_outputs(&self) -> Vec<OutputMedia>
pub fn image_outputs(&self) -> Vec<OutputMedia>
Return image outputs from the latest model response.
Sourcepub fn output_value(&self) -> OutputValue
pub fn output_value(&self) -> OutputValue
Return the final output as text, JSON, or media wrappers.
Sourcepub const fn has_pending_hitl(&self) -> bool
pub const fn has_pending_hitl(&self) -> bool
Return true when the run result is waiting for approval or deferred tool results.
Sourcepub fn pending_approvals(&self) -> &[ToolReturnPart]
pub fn pending_approvals(&self) -> &[ToolReturnPart]
Return pending approval-required tool returns.
Sourcepub fn pending_deferred_tools(&self) -> &[ToolReturnPart]
pub fn pending_deferred_tools(&self) -> &[ToolReturnPart]
Return pending deferred tool returns.
Sourcepub fn structured<T>(&self) -> Result<T, AgentError>where
T: DeserializeOwned,
pub fn structured<T>(&self) -> Result<T, AgentError>where
T: DeserializeOwned,
Parse structured output into a Rust type.
§Errors
Returns an error when no structured output is present or deserialization fails.
Trait Implementations§
Source§impl Clone for AgentResult
impl Clone for AgentResult
Source§fn clone(&self) -> AgentResult
fn clone(&self) -> AgentResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for AgentResult
Source§impl From<AgentRunResult> for AgentResult
impl From<AgentRunResult> for AgentResult
Source§fn from(result: AgentRunResult) -> Self
fn from(result: AgentRunResult) -> Self
Converts to this type from the input type.
Source§impl PartialEq for AgentResult
impl PartialEq for AgentResult
Source§fn eq(&self, other: &AgentResult) -> bool
fn eq(&self, other: &AgentResult) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for AgentResult
impl Serialize for AgentResult
impl StructuralPartialEq 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 UnsafeUnpin 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
Mutably borrows from an owned value. Read more