pub enum AgentEvent {
Show 14 variants
InvocationStarted {
role: AgentRole,
agent: String,
model: Option<String>,
},
InvocationSucceeded {
role: AgentRole,
agent: String,
},
InvocationFailed {
role: AgentRole,
agent: String,
exit_code: i32,
error_kind: AgentErrorKind,
retriable: bool,
},
FallbackTriggered {
role: AgentRole,
from_agent: String,
to_agent: String,
},
ModelFallbackTriggered {
role: AgentRole,
agent: String,
from_model: String,
to_model: String,
},
RetryCycleStarted {
role: AgentRole,
cycle: u32,
},
ChainExhausted {
role: AgentRole,
},
ChainInitialized {
role: AgentRole,
agents: Vec<String>,
max_cycles: u32,
retry_delay_ms: u64,
backoff_multiplier: f64,
max_backoff_ms: u64,
},
RateLimited {
role: AgentRole,
agent: String,
prompt_context: Option<String>,
},
AuthFailed {
role: AgentRole,
agent: String,
},
TimedOut {
role: AgentRole,
agent: String,
},
SessionEstablished {
role: AgentRole,
agent: String,
session_id: String,
},
XsdValidationFailed {
role: AgentRole,
artifact: ArtifactType,
error: String,
retry_count: u32,
},
TemplateVariablesInvalid {
role: AgentRole,
template_name: String,
missing_variables: Vec<String>,
unresolved_placeholders: Vec<String>,
},
}Expand description
Agent invocation and chain management events.
Events related to agent execution, fallback chains, model switching, rate limiting, and retry cycles. The agent chain provides fault tolerance through multiple fallback levels:
- Model level: Try different models for the same agent
- Agent level: Switch to a fallback agent
- Retry cycle: Start over with exponential backoff
§State Transitions
InvocationFailed(retriable=true): Advances to next modelInvocationFailed(retriable=false): Typically switches to next agent (policy may vary by kind)RateLimited: Typically immediate agent switch with prompt preservationChainExhausted: Starts new retry cycleInvocationSucceeded: Clears continuation prompt
Variants§
InvocationStarted
Agent invocation started.
Fields
InvocationSucceeded
Agent invocation succeeded.
InvocationFailed
Agent invocation failed.
Fields
error_kind: AgentErrorKindThe kind of error that occurred.
FallbackTriggered
Fallback triggered to switch to a different agent.
Fields
ModelFallbackTriggered
Model fallback triggered within the same agent.
Fields
RetryCycleStarted
Retry cycle started (all agents exhausted, starting over).
ChainExhausted
Agent chain exhausted (no more agents/models to try).
ChainInitialized
Agent chain initialized with available agents.
Fields
RateLimited
Agent hit rate limit (429).
Effects/executors emit this as a fact event. The reducer decides whether/when to switch agents.
Fields
AuthFailed
Agent hit authentication failure (401/403).
Effects/executors emit this as a fact event. The reducer decides whether/when to switch agents.
TimedOut
Agent hit an idle timeout.
Effects/executors emit this as a fact event. The reducer decides whether/when to switch agents. Unlike rate limits, timeouts do not preserve prompt context.
SessionEstablished
Session established with agent.
Emitted when an agent response includes a session ID that can be used for XSD retry continuation. This enables reusing the same session when retrying due to validation failures.
Fields
XsdValidationFailed
XSD validation failed for agent output.
Emitted when agent output cannot be parsed or fails XSD validation. Distinct from OutputValidationFailed events in phase-specific enums, this is the canonical XSD retry trigger that the reducer uses to decide whether to retry with the same agent/session or advance the chain.
Fields
artifact: ArtifactTypeThe artifact type that failed validation.
TemplateVariablesInvalid
Template rendering failed due to missing required variables or unresolved placeholders.
Emitted when a prompt template cannot be rendered because required variables
are missing or unresolved placeholders (e.g., {{VAR}}) remain in the output.
The reducer decides fallback policy, typically switching to the next agent.
Fields
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 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>,
Auto Trait Implementations§
impl Freeze for AgentEvent
impl RefUnwindSafe for AgentEvent
impl Send for AgentEvent
impl Sync for AgentEvent
impl Unpin for AgentEvent
impl UnwindSafe for AgentEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more