aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / crates / aien-drive / src / main.rs
| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | use aien_drive::*; |
| 17 | use clap::{Parser, ValueEnum}; |
| 18 | use std::time::Duration; |
| 19 | |
| 20 | #[derive(Clone, ValueEnum)] |
| 21 | enum Seat { |
| 22 | Lightning, |
| 23 | Judge, |
| 24 | } |
| 25 | |
| 26 | /// AIEN Autonomous API Driver |
| 27 | #[derive(Parser)] |
| 28 | struct Args { |
| 29 | /// Task directive for AIEN |
| 30 | #[arg(required = true)] |
| 31 | directive: Vec<String>, |
| 32 | /// Inference seat on Spark |
| 33 | #[arg(long, value_enum, default_value = "lightning")] |
| 34 | seat: Seat, |
| 35 | /// Maximum execution turns |
| 36 | #[arg(long, default_value_t = 15)] |
| 37 | max_turns: u32, |
| 38 | } |
| 39 | |
| 40 | fn main() { |
| 41 | let a = Args::parse(); |
| 42 | let (ep, model) = match a.seat { |
| 43 | Seat::Lightning => (ENDPOINT_LIGHTNING, MODEL_LIGHTNING), |
| 44 | Seat::Judge => (ENDPOINT_JUDGE, MODEL_JUDGE), |
| 45 | }; |
| 46 | // AIEN_MODEL_ENDPOINT / AIEN_MODEL_NAME override the seat defaults (the |
| 47 | // Python original read them but then overwrote them from --seat). |
| 48 | let env = |k: &str, d: &str| { |
| 49 | std::env::var(k) |
| 50 | .ok() |
| 51 | .filter(|v| !v.is_empty()) |
| 52 | .unwrap_or_else(|| d.to_string()) |
| 53 | }; |
| 54 | let cfg = Config { |
| 55 | endpoint: env("AIEN_MODEL_ENDPOINT", ep), |
| 56 | model: env("AIEN_MODEL_NAME", model), |
| 57 | cortex_endpoint: env("CORTEX_ENDPOINT", DEFAULT_CORTEX), |
| 58 | cortex_space: env("AIEN_CORTEX_SPACE", "aien-sources"), |
| 59 | request_timeout: Duration::from_secs(180), |
| 60 | command: CommandPolicy::from_operator_env(), |
| 61 | cortex_token: std::env::var("AIEN_CORTEX_TOKEN") |
| 62 | .ok() |
| 63 | .filter(|v| !v.is_empty()), |
| 64 | }; |
| 65 | match run_directive(&cfg, &a.directive.join(" "), a.max_turns) { |
| 66 | Ok(true) => {} |
| 67 | Ok(false) => std::process::exit(1), |
| 68 | Err(e) => { |
| 69 | eprintln!("error: {e}"); |
| 70 | std::process::exit(1); |
| 71 | } |
| 72 | } |
| 73 | } |