Skip to main content

aios_agent/
lib.rs

1//! # aios-agent - decision routing and model backends
2//!
3//! Receives `StructuredContext`, selects a local rule/local evaluator/cloud
4//! backend, and returns an `IntentBatch` for final review in core.
5
6mod backends;
7mod router;
8
9pub use backends::cloud_llm::client::CloudLlmBackend;
10pub use backends::cloud_llm::config::{CloudLlmConfig, CloudProvider, DEFAULT_SYSTEM_PROMPT};
11pub use backends::cloud_llm::ProfileSummarizer;
12pub use backends::fallback::FallbackNoOpBackend;
13pub use backends::local_evaluator::LocalEvaluatorBackend;
14pub use backends::predictive::{
15    prediction_features_for_example, train_next_app_artifact, NextAppAlgorithm,
16    NextAppModelArtifact, NextAppModelConfig, NextAppPredictor, NextAppTrainingExample,
17    PredictionFeatures, PredictiveLocalBackend,
18};
19pub use backends::rule_based::RuleBasedBackend;
20pub use router::{DecisionRouter, RouterConfig};
21
22use aios_spec::{DecisionBackendResult, ModelInput, StructuredContext};
23use uuid::Uuid;
24
25// ============================================================
26// DecisionBackend trait
27// ============================================================
28
29/// Common backend interface: receive a context and return a decision result.
30///
31/// Rule-based, local evaluator, cloud LLM, and fallback backends all implement
32/// this trait.
33pub trait DecisionBackend {
34    fn evaluate(&self, context: &StructuredContext) -> DecisionBackendResult;
35
36    fn evaluate_model_input(&self, input: &ModelInput) -> DecisionBackendResult {
37        self.evaluate(&input.current_context)
38    }
39}
40
41// ============================================================
42// Helpers
43// ============================================================
44
45fn new_id() -> String {
46    Uuid::new_v4().to_string()
47}