pub enum AgentEvent {
TextDelta {
content: String,
},
ReasoningDelta {
content: String,
},
ToolCallStart {
tool_call: ToolCall,
display_name: String,
args_summary: Option<String>,
},
ToolCallComplete {
tool_name: String,
result: ToolResult,
wait_ms: u64,
execute_duration_ms: u64,
display_name: String,
duration_display: String,
},
IterationComplete {
iteration: usize,
tool_calls: usize,
},
FinalAnswer {
content: String,
},
PromptProgress {
processed: u32,
total: u32,
cached: u32,
time_ms: u64,
},
SystemWarning {
message: String,
suggested_action: Option<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.
Fields
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.
PromptProgress
Prompt-processing progress from the LLM backend.
Emitted during the pre-fill phase when llama-server is streaming
prompt_progress frames. Surfaces token-level progress so the UI
can show “processing prompt: 2048 / 8192 tokens”.
Fields
SystemWarning
A non-fatal system-level warning surfaced by the loop itself.
Unlike AgentEvent::Error, a SystemWarning does not terminate
the loop — it informs the user that the loop encountered a recoverable
condition (e.g. the model requested more parallel tool calls than the
configured limit, and the loop is auto-retrying with a synthetic
error fed back to the model).
suggested_action, when present, contains an actionable hint the UI
can render verbatim (e.g. a CLI command to permanently raise a limit).
Fields
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