aios_agent/backends/
fallback.rs1use std::time::Instant;
14
15use aios_spec::{
16 ActionType, ActionUrgency, DecisionBackendResult, DecisionRoute, Intent, IntentBatch,
17 IntentType, RiskLevel, StructuredContext, SuggestedAction,
18};
19
20use crate::{new_id, DecisionBackend};
21
22pub struct FallbackNoOpBackend;
23
24impl DecisionBackend for FallbackNoOpBackend {
25 fn evaluate(&self, context: &StructuredContext) -> DecisionBackendResult {
26 let start = Instant::now();
27 let intent_batch = IntentBatch {
28 window_id: context.window_id.clone(),
29 intents: vec![Intent {
30 intent_id: new_id(),
31 intent_type: IntentType::Idle,
32 confidence: 1.0,
33 risk_level: RiskLevel::Low,
34 suggested_actions: vec![SuggestedAction {
35 action_type: ActionType::NoOp,
36 target: None,
37 urgency: ActionUrgency::IdleTime,
38 }],
39 rationale_tags: vec!["fallback_noop".into()],
40 }],
41 generated_at_ms: context.window_end_ms,
42 model: "fallback-noop-v0.1".to_string(),
43 };
44
45 DecisionBackendResult {
46 route: DecisionRoute::FallbackNoOp,
47 intent_batch,
48 rationale_tags: vec!["fallback_noop".into()],
49 latency_us: start.elapsed().as_micros() as u64,
50 error: Some("circuit breaker engaged — falling back to no-op".into()),
51 }
52 }
53}