Skip to main content

auria_execution/
lib.rs

1use auria_core::{ExecutionOutput, ExecutionState, RoutingDecision, Tensor, AuriaResult};
2use async_trait::async_trait;
3
4#[async_trait]
5pub trait ExecutionBackend: Send + Sync {
6    async fn execute_step(
7        &self,
8        input: Tensor,
9        experts: Vec<Tensor>,
10        state: ExecutionState,
11    ) -> AuriaResult<ExecutionOutput>;
12
13    fn backend_name(&self) -> &str;
14}
15
16pub struct ExecutionEngine<B: ExecutionBackend> {
17    backend: B,
18}
19
20impl<B: ExecutionBackend> ExecutionEngine<B> {
21    pub fn new(backend: B) -> Self {
22        Self { backend }
23    }
24
25    pub async fn execute(
26        &self,
27        input: Tensor,
28        routing: RoutingDecision,
29        state: ExecutionState,
30    ) -> AuriaResult<ExecutionOutput> {
31        let experts: Vec<Tensor> = Vec::new();
32        self.backend.execute_step(input, experts, state).await
33    }
34}