pub enum AgentEvent {
Show 30 variants
RunStarted {
agent: String,
task: String,
},
TurnStarted {
agent: String,
turn: usize,
max_turns: usize,
},
LlmResponse {
agent: String,
turn: usize,
usage: TokenUsage,
stop_reason: StopReason,
tool_call_count: usize,
text: String,
latency_ms: u64,
model: Option<String>,
time_to_first_token_ms: u64,
},
ToolCallStarted {
agent: String,
tool_name: String,
tool_call_id: String,
input: String,
},
ToolCallCompleted {
agent: String,
tool_name: String,
tool_call_id: String,
is_error: bool,
duration_ms: u64,
output: String,
},
ApprovalRequested {
agent: String,
turn: usize,
tool_names: Vec<String>,
},
ApprovalDecision {
agent: String,
turn: usize,
approved: bool,
},
SubAgentsDispatched {
agent: String,
agents: Vec<String>,
},
SubAgentCompleted {
agent: String,
success: bool,
usage: TokenUsage,
},
ContextSummarized {
agent: String,
turn: usize,
usage: TokenUsage,
},
RunCompleted {
agent: String,
total_usage: TokenUsage,
tool_calls_made: usize,
},
GuardrailDenied {
agent: String,
hook: String,
reason: String,
tool_name: Option<String>,
},
GuardrailWarned {
agent: String,
hook: String,
reason: String,
tool_name: Option<String>,
},
RunFailed {
agent: String,
error: String,
partial_usage: TokenUsage,
},
RetryAttempt {
agent: String,
attempt: u32,
max_retries: u32,
delay_ms: u64,
error_class: String,
},
DoomLoopDetected {
agent: String,
turn: usize,
consecutive_count: u32,
tool_names: Vec<String>,
},
FuzzyDoomLoopDetected {
agent: String,
turn: usize,
consecutive_count: u32,
tool_names: Vec<String>,
},
KillSwitchActivated {
agent: String,
reason: String,
guardrail_name: String,
},
SessionPruned {
agent: String,
turn: usize,
tool_results_pruned: usize,
bytes_saved: usize,
tool_results_total: usize,
},
AutoCompactionTriggered {
agent: String,
turn: usize,
success: bool,
usage: TokenUsage,
},
SensorEventProcessed {
sensor_name: String,
decision: String,
priority: Option<String>,
story_id: Option<String>,
},
StoryUpdated {
story_id: String,
subject: String,
event_count: usize,
priority: Option<String>,
},
ModelEscalated {
agent: String,
from_tier: String,
to_tier: String,
reason: String,
},
BudgetExceeded {
agent: String,
used: u64,
limit: u64,
partial_usage: TokenUsage,
},
AgentSpawned {
agent: String,
spawned_name: String,
tools: Vec<String>,
task: String,
},
TaskRouted {
decision: String,
reason: String,
selected_agent: Option<String>,
complexity_score: f32,
escalated: bool,
},
WorkflowNodeStarted {
node: String,
},
WorkflowNodeCompleted {
node: String,
},
WorkflowNodeFailed {
node: String,
},
ToolNameRepaired {
agent: String,
original: String,
repaired: String,
},
}Expand description
Structured events emitted during agent and orchestrator execution.
All events carry the agent name for identification in multi-agent runs.
Events are emitted synchronously via the OnEvent callback — keep
handlers fast to avoid blocking the agent loop.
Variants§
RunStarted
Agent loop started.
TurnStarted
A new turn in the agent loop.
LlmResponse
LLM call completed.
ToolCallStarted
Tool execution started.
Fields
ToolCallCompleted
Tool execution completed.
Fields
ApprovalRequested
Human approval requested.
ApprovalDecision
Human approval decision received.
SubAgentsDispatched
Orchestrator dispatched sub-agents.
SubAgentCompleted
A sub-agent completed.
ContextSummarized
Context was summarized due to threshold.
RunCompleted
Agent run completed successfully.
GuardrailDenied
A guardrail denied an LLM response or tool call.
Fields
GuardrailWarned
A guardrail issued a warning but allowed the operation to proceed.
Fields
RunFailed
Agent run failed.
RetryAttempt
An LLM retry attempt is about to happen (before the sleep).
Fields
DoomLoopDetected
Doom loop detected: the agent repeated identical tool calls too many times.
Fields
FuzzyDoomLoopDetected
Fuzzy doom loop detected: the agent repeated the same tools with different inputs.
Fields
KillSwitchActivated
Kill switch activated: a guardrail triggered an immediate agent termination.
SessionPruned
Session pruning truncated old tool results before an LLM call.
Fields
AutoCompactionTriggered
Auto-compaction was triggered due to context overflow.
Fields
usage: TokenUsageToken usage from the compaction LLM call.
SensorEventProcessed
A sensor event was processed through the triage pipeline.
Fields
StoryUpdated
A story was created or updated with new correlated events.
ModelEscalated
Model cascade escalated from a cheaper tier.
Fields
BudgetExceeded
Token budget exceeded: the agent consumed more tokens than the configured limit.
Fields
partial_usage: TokenUsagePartial token usage accumulated before the budget was exceeded.
AgentSpawned
A dynamic agent was spawned at runtime by the orchestrator.
TaskRouted
Task was routed to single-agent or orchestrator by the complexity analyzer.
Fields
WorkflowNodeStarted
A workflow node agent has started executing (emitted by the workflow executor).
WorkflowNodeCompleted
A workflow node agent has completed executing (emitted by the workflow executor).
WorkflowNodeFailed
A workflow node agent has failed (emitted by the workflow executor).
ToolNameRepaired
LLM emitted an unknown tool name that was repaired via Levenshtein distance. The repair happens before permission/guardrail evaluation so the policy applies to the repaired name, not the typo.
Implementations§
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