use crate::model::{Message, Response, ToolCall};
#[derive(Debug, Clone)]
pub enum AgentEvent {
TextDelta(String),
ThinkingDelta(String),
ToolCallsBegin(Vec<ToolCall>),
ToolCallsStart(Vec<ToolCall>),
ToolResult {
call_id: String,
output: String,
duration_ms: u64,
},
ToolCallsComplete,
Compact { summary: String },
Done(AgentResponse),
}
#[derive(Debug, Clone)]
pub struct AgentStep {
pub response: Response,
pub tool_calls: Vec<ToolCall>,
pub tool_results: Vec<Message>,
}
#[derive(Debug, Clone)]
pub struct AgentResponse {
pub steps: Vec<AgentStep>,
pub final_response: Option<String>,
pub iterations: usize,
pub stop_reason: AgentStopReason,
pub model: String,
}
#[derive(Debug, Clone, PartialEq)]
pub enum AgentStopReason {
TextResponse,
MaxIterations,
NoAction,
Error(String),
}
impl std::fmt::Display for AgentStopReason {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::TextResponse => write!(f, "text_response"),
Self::MaxIterations => write!(f, "max_iterations"),
Self::NoAction => write!(f, "no_action"),
Self::Error(msg) => write!(f, "error: {msg}"),
}
}
}