pub enum AgentEvent {
Show 17 variants
InvocationStarted {
role: AgentRole,
agent: AgentName,
model: Option<ModelName>,
},
InvocationSucceeded {
role: AgentRole,
agent: AgentName,
},
InvocationFailed {
role: AgentRole,
agent: AgentName,
exit_code: i32,
error_kind: AgentErrorKind,
retriable: bool,
},
FallbackTriggered {
role: AgentRole,
from_agent: AgentName,
to_agent: AgentName,
},
ModelFallbackTriggered {
role: AgentRole,
agent: AgentName,
from_model: ModelName,
to_model: ModelName,
},
RetryCycleStarted {
role: AgentRole,
cycle: u32,
},
ChainExhausted {
role: AgentRole,
},
ChainInitialized {
drain: AgentDrain,
agents: Vec<AgentName>,
models_per_agent: Vec<Vec<String>>,
max_cycles: u32,
retry_delay_ms: u64,
backoff_multiplier: f64,
max_backoff_ms: u64,
},
RateLimited {
role: AgentRole,
agent: AgentName,
prompt_context: Option<String>,
},
AuthFailed {
role: AgentRole,
agent: AgentName,
},
TimedOut {
role: AgentRole,
agent: AgentName,
output_kind: TimeoutOutputKind,
logfile_path: Option<String>,
child_status_at_timeout: Option<ChildProcessInfo>,
},
SessionEstablished {
role: AgentRole,
agent: AgentName,
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>,
},
TimeoutContextWritten {
role: AgentRole,
logfile_path: String,
context_path: String,
},
ConnectivityCheckSucceeded,
ConnectivityCheckFailed,
}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.
Fields
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
drain: AgentDrainThe explicit runtime drain this chain is for.
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.
Fields
TimedOut
Agent hit an idle timeout.
Emitted as a fact; the reducer decides retry vs fallback based on output_kind.
NoResult triggers immediate agent switch; PartialResult uses the same-agent
retry budget (same semantics as before this feature).
Fields
output_kind: TimeoutOutputKindWhether the agent produced a result file before timing out.
logfile_path: Option<String>Path to the agent’s logfile (for context extraction on PartialResult retry).
When output_kind is PartialResult and the agent has no session ID,
this path is used to extract context for the retry prompt.
child_status_at_timeout: Option<ChildProcessInfo>Child process status when the timeout was enforced.
None if no children existed or child checking was disabled.
When Some, contains the child count and cumulative CPU time at timeout.
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
TimeoutContextWritten
Timeout context written to temp file for session-less agent retry.
Emitted when a timeout with meaningful output occurs but the agent doesn’t support session IDs. The prior context is extracted from the logfile and written to a temp file for the retry prompt to reference.
Fields
ConnectivityCheckSucceeded
Connectivity probe succeeded (network is reachable).
Emitted when a connectivity probe succeeds. The reducer processes this to update ConnectivityState accordingly. If the pipeline was waiting for connectivity verification, this clears that pending flag.
ConnectivityCheckFailed
Connectivity probe failed (network is unreachable).
Emitted when a connectivity probe fails. The reducer processes this to update ConnectivityState. If the failure threshold is reached, the pipeline enters offline mode.
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>,
Source§impl PartialEq for AgentEvent
impl PartialEq for AgentEvent
Source§impl Serialize for AgentEvent
impl Serialize for AgentEvent
impl StructuralPartialEq for AgentEvent
Auto Trait Implementations§
impl Freeze for AgentEvent
impl RefUnwindSafe for AgentEvent
impl Send for AgentEvent
impl Sync for AgentEvent
impl Unpin for AgentEvent
impl UnsafeUnpin 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