pub enum AgentEvent {
AgentStart,
AgentEnd {
messages: Vec<AgentMessage>,
},
RetryScheduled {
attempt: u32,
max_retries: u32,
delay_ms: u64,
error: String,
},
TurnStart,
TurnEnd {
message: AgentMessage,
tool_results: Vec<ToolResultMessage>,
},
MessageStart {
message: AgentMessage,
},
MessageUpdate {
message: AgentMessage,
assistant_message_event: AssistantMessageEvent,
},
MessageEnd {
message: AgentMessage,
},
ToolExecutionStart {
tool_call_id: String,
tool_name: String,
args: Value,
},
ToolExecutionUpdate {
tool_call_id: String,
tool_name: String,
args: Value,
partial_result: Arc<AgentToolResult>,
},
ToolExecutionEnd {
tool_call_id: String,
tool_name: String,
result: AgentToolResult,
is_error: bool,
},
}Expand description
An event emitted by the agent loop. Mirrors TS AgentEvent (tagged on
type). All AgentMessage payloads are owned (cloned) so broadcast
subscribers get independent copies.
Variants§
AgentStart
Emitted once at the start of a run, before turn_start.
AgentEnd
Emitted once at the end of a run; carries the new messages produced.
Fields
messages: Vec<AgentMessage>RetryScheduled
Emitted after a retryable provider failure, before the backoff wait.
Fields
TurnStart
Emitted at the start of each turn (a turn = one assistant response + its tool calls/results).
TurnEnd
Emitted after a turn’s assistant message + tool results settle. Carries
the assistant message (as an AgentMessage) and the tool-result
messages produced this turn, in source/ordinal order.
MessageStart
Emitted when any message (user prompt, assistant response, tool result, custom) is appended to the transcript.
Fields
message: AgentMessageMessageUpdate
Emitted only for assistant messages, on each streaming delta. Carries
the underlying AssistantMessageEvent plus a snapshot of the partial
assistant message.
MessageEnd
Emitted when a message finishes (complement of MessageStart).
Fields
message: AgentMessageToolExecutionStart
Emitted before a tool call starts executing.
ToolExecutionUpdate
Emitted on a partial tool result pushed via on_update.
ToolExecutionEnd
Emitted when a tool call finishes (success or error). is_error marks
the error path; result carries the final tool result.
Implementations§
Source§impl AgentEvent
impl AgentEvent
Trait Implementations§
Source§impl Clone for AgentEvent
impl Clone for AgentEvent
Source§fn clone(&self) -> AgentEvent
fn clone(&self) -> AgentEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more