pub struct AgentLoop<M: Model> {
pub model: M,
pub tools: ToolRegistry,
pub guides: Vec<Arc<dyn Guide>>,
pub sensors: Vec<Arc<dyn Sensor>>,
pub hooks: HookBus,
pub compactor: Arc<dyn Compactor>,
}Expand description
The agent loop.
Fields§
§model: M§tools: ToolRegistry§guides: Vec<Arc<dyn Guide>>§sensors: Vec<Arc<dyn Sensor>>§hooks: HookBus§compactor: Arc<dyn Compactor>Implementations§
Source§impl<M: Model> AgentLoop<M>
impl<M: Model> AgentLoop<M>
pub fn new(model: M) -> Self
pub fn with_compactor(self, c: Arc<dyn Compactor>) -> Self
pub fn with_tool(self, t: Arc<dyn Tool>) -> Self
pub fn with_guide(self, g: Arc<dyn Guide>) -> Self
pub fn with_sensor(self, s: Arc<dyn Sensor>) -> Self
pub fn with_hook(self, h: Arc<dyn Hook>) -> Self
Sourcepub fn with_macro_hooks(self) -> Self
pub fn with_macro_hooks(self) -> Self
Pull in every #[hook]-registered hook.
pub async fn run( &self, task: Task, world: &mut World, ) -> Result<Outcome, HarnessError>
pub async fn run_with_max_iters( &self, task: Task, world: &mut World, max_iters: u32, ) -> Result<Outcome, HarnessError>
Sourcepub async fn run_with_seed_history(
&self,
task: Task,
seed: Vec<Turn>,
world: &mut World,
max_iters: u32,
) -> Result<Outcome, HarnessError>
pub async fn run_with_seed_history( &self, task: Task, seed: Vec<Turn>, world: &mut World, max_iters: u32, ) -> Result<Outcome, HarnessError>
Like run_with_max_iters but seeds ctx.history with seed before
the current user task is appended. Use this for multi-turn REPLs so
prior conversation lives in ctx.history (where the Compactor can see
it) instead of being concatenated into task.description (where it
previously bypassed compaction entirely — see audit #2).
Auto Trait Implementations§
impl<M> Freeze for AgentLoop<M>where
M: Freeze,
impl<M> !RefUnwindSafe for AgentLoop<M>
impl<M> Send for AgentLoop<M>
impl<M> Sync for AgentLoop<M>
impl<M> Unpin for AgentLoop<M>where
M: Unpin,
impl<M> UnsafeUnpin for AgentLoop<M>where
M: UnsafeUnpin,
impl<M> !UnwindSafe for AgentLoop<M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more