Skip to main content

tower_llm/
result.rs

1//! Result types for agent execution
2
3use serde_json::Value;
4
5/// The result of running an agent.
6#[derive(Debug, Clone)]
7pub struct RunResult {
8    /// The final output from the agent
9    pub final_output: Value,
10    /// Whether the run was successful
11    pub success: bool,
12    /// Error message if the run failed
13    pub error: Option<String>,
14}
15
16impl RunResult {
17    /// Check if the run was successful
18    pub fn is_success(&self) -> bool {
19        self.success
20    }
21
22    /// Get the error if the run failed
23    pub fn error(&self) -> Option<&str> {
24        self.error.as_deref()
25    }
26}
27
28/// Extended result with additional context
29pub type RunResultWithContext = RunResult;
30
31/// Result for streaming operations
32pub type StreamingRunResult = RunResult;