pub struct AgentOutput {
pub agent: String,
pub session_id: String,
pub events: Vec<Event>,
pub result: Option<String>,
pub is_error: bool,
pub total_cost_usd: Option<f64>,
pub usage: Option<Usage>,
}Expand description
A unified event stream output from an agent session.
This represents the complete output from an agent execution, containing all events that occurred during the session.
Fields§
§agent: StringThe agent that produced this output
session_id: StringUnique session identifier
events: Vec<Event>Events that occurred during the session
result: Option<String>Final result text (if any)
is_error: boolWhether the session ended in an error
total_cost_usd: Option<f64>Total cost in USD (if available)
usage: Option<Usage>Aggregated usage statistics
Implementations§
Source§impl AgentOutput
impl AgentOutput
Sourcepub fn from_text(agent: &str, text: &str) -> Self
pub fn from_text(agent: &str, text: &str) -> Self
Create a minimal AgentOutput from captured text.
Used by non-Claude agents when capture_output is enabled (e.g., for auto-selection).
Sourcepub fn to_log_entries(&self, min_level: LogLevel) -> Vec<LogEntry>
pub fn to_log_entries(&self, min_level: LogLevel) -> Vec<LogEntry>
Extract log entries from the agent output.
This converts events into a flat list of log entries suitable for display or filtering.
Sourcepub fn final_result(&self) -> Option<&str>
pub fn final_result(&self) -> Option<&str>
Get the final result text.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if the session completed successfully.
Sourcepub fn tool_executions(&self) -> Vec<&Event>
pub fn tool_executions(&self) -> Vec<&Event>
Get all tool executions from the session.
Trait Implementations§
Source§impl Clone for AgentOutput
impl Clone for AgentOutput
Source§fn clone(&self) -> AgentOutput
fn clone(&self) -> AgentOutput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more