#[non_exhaustive]pub enum AgentEvent {
Show 17 variants
RunStarted {
session_id: SessionId,
},
TurnStarted {
session_id: SessionId,
turn_id: TurnId,
},
InputAccepted {
session_id: SessionId,
items: Vec<Item>,
},
ContentDelta(Delta),
ToolCallRequested(ToolCallPart),
ToolExecutionStarted(ToolCallPart),
ToolExecutionProgress(ToolResultPart),
ToolResultReceived(ToolResultPart),
ApprovalRequired(ApprovalRequest),
ApprovalResolved {
approved: bool,
},
ToolCatalogChanged(ToolCatalogEvent),
MutationStarted {
session_id: SessionId,
turn_id: Option<TurnId>,
mutator: String,
point: MutationPoint,
},
MutationFinished {
session_id: SessionId,
turn_id: Option<TurnId>,
mutator: String,
dirty: bool,
metadata: MetadataMap,
},
UsageUpdated(Usage),
Warning {
message: String,
},
RunFailed {
message: String,
},
TurnFinished(TurnResult),
}Expand description
Lifecycle and streaming events emitted by the LoopDriver.
Observers (see LoopObserver) receive these events in the order they
occur. They are useful for building UIs, logging, or telemetry.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RunStarted
The agent run has been initialised.
TurnStarted
A new model turn is starting.
InputAccepted
User input has been accepted into the pending queue.
ContentDelta(Delta)
Incremental content delta from the model.
ToolCallRequested(ToolCallPart)
The model has requested a tool call.
ToolExecutionStarted(ToolCallPart)
A tool call is about to execute after policy and approval checks.
ToolExecutionProgress(ToolResultPart)
A tool call has non-terminal progress to report.
Used for updates such as background detachment. Unlike
AgentEvent::ToolResultReceived, this does not mean the call has
reached a terminal result.
ToolResultReceived(ToolResultPart)
A tool call’s result has landed in the transcript.
Fires once per terminal Part::ToolResult that’s appended.
Cancellation/denial paths (auth cancelled, approval denied) also emit
this with is_error = true.
Correlate with the matching AgentEvent::ToolCallRequested via
call_id.
ApprovalRequired(ApprovalRequest)
A tool call requires explicit user approval before execution.
ApprovalResolved
An approval interrupt has been resolved.
ToolCatalogChanged(ToolCatalogEvent)
The available tool catalog changed and will be reflected on the next model request.
MutationStarted
A LoopMutator is about to run at one of the mutation points.
mutator is a stable label the implementation chooses for itself.
MutationFinished
A LoopMutator has finished running. dirty indicates whether the
transcript was modified; metadata carries mutator-specific extras
(e.g. compaction reason, replaced item count).
Fields
metadata: MetadataMapUsageUpdated(Usage)
Updated token usage statistics.
Warning
Non-fatal warning (e.g. a tool failure that was recovered from).
RunFailed
The agent run has failed with an unrecoverable error.
TurnFinished(TurnResult)
A turn has finished (successfully, via cancellation, etc.).
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 moreSource§impl Debug for AgentEvent
impl Debug for AgentEvent
Source§impl<'de> Deserialize<'de> for AgentEvent
impl<'de> Deserialize<'de> for AgentEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for AgentEvent
impl PartialEq for AgentEvent
Source§fn eq(&self, other: &AgentEvent) -> bool
fn eq(&self, other: &AgentEvent) -> bool
self and other values to be equal, and is used by ==.