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