pub enum AgentEvent {
TextDelta {
content: String,
},
ReasoningDelta {
content: String,
},
ToolCallStart {
tool_call: ToolCall,
},
ToolCallComplete {
result: ToolResult,
wait_ms: u64,
execute_duration_ms: u64,
},
IterationComplete {
iteration: usize,
tool_calls: usize,
},
FinalAnswer {
content: String,
},
Error {
message: String,
},
}Expand description
An observable event emitted by the agentic loop.
These events are the unit of SSE emission: every state change in the loop
produces exactly one variant. Axum SSE handlers serialise these to
data: <json>\n\n frames; CLI consumers may log or render them directly.
§Serde tag
#[serde(tag = "type", rename_all = "snake_case")] produces e.g.
{"type":"tool_call_start","tool_call":{...}}.
Variants§
TextDelta
An incremental text fragment from the model’s response.
ReasoningDelta
An incremental reasoning/thinking fragment from the model (CoT tokens).
Emitted by reasoning-capable models (e.g. DeepSeek R1, QwQ) that expose
their chain-of-thought via a separate reasoning_content SSE field.
These fragments are forwarded to the UI as they arrive but are not
included in the conversation history sent back to the model.
ToolCallStart
The model has requested execution of a tool.
ToolCallComplete
A tool execution has completed (success or failure).
Fields
result: ToolResultThe outcome of the tool execution.
IterationComplete
One full LLM→tool-execution cycle has completed.
Fields
FinalAnswer
The loop has concluded and produced a definitive answer.
Error
A fatal error has terminated the loop.
Trait Implementations§
Source§impl Clone for AgentEvent
impl Clone for AgentEvent
Source§fn clone(&self) -> AgentEvent
fn clone(&self) -> AgentEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more