use serde::{Serialize, de::DeserializeOwned};
use crate::types::budget::Budget;
use crate::types::error::CruxErr;
use crate::types::recovery::Recovery;
pub trait Agent: Send + Sync + 'static {
type Input: Serialize + DeserializeOwned + Send;
type Output: Serialize + DeserializeOwned + Send;
fn name() -> &'static str;
fn run(
ctx: &mut crate::ctx::CruxCtx,
input: Self::Input,
) -> impl std::future::Future<Output = Result<Self::Output, CruxErr>> + Send;
fn budget() -> Budget {
Budget::default()
}
fn on_low_confidence(_score: f32) -> Recovery<Self::Output> {
Recovery::Continue
}
fn on_step_failure(_err: &CruxErr) -> Recovery<Self::Output> {
Recovery::Propagate
}
}