pub struct AgentLoop { /* private fields */ }Expand description
AgentLoop.
Implementations§
Source§impl AgentLoop
impl AgentLoop
Sourcepub fn new_with_resolver(
provider: Arc<dyn Provider>,
config: AgentLoopConfig,
tools: Arc<ToolRegistry>,
state: SharedState,
resolver: Arc<dyn ProviderResolver>,
) -> Self
pub fn new_with_resolver( provider: Arc<dyn Provider>, config: AgentLoopConfig, tools: Arc<ToolRegistry>, state: SharedState, resolver: Arc<dyn ProviderResolver>, ) -> Self
TODO. Create a new AgentLoop with an explicit resolver.
Sourcepub fn new(
provider: Arc<dyn Provider>,
config: AgentLoopConfig,
tools: Arc<ToolRegistry>,
state: SharedState,
) -> Self
pub fn new( provider: Arc<dyn Provider>, config: AgentLoopConfig, tools: Arc<ToolRegistry>, state: SharedState, ) -> Self
Create a new AgentLoop using the global resolver (backward compat).
Sourcepub fn with_before_tool_call(self, hook: BeforeToolCallHook) -> Self
pub fn with_before_tool_call(self, hook: BeforeToolCallHook) -> Self
TODO: document this function.
Sourcepub fn with_after_tool_call(self, hook: AfterToolCallHook) -> Self
pub fn with_after_tool_call(self, hook: AfterToolCallHook) -> Self
TODO: document this function.
Sourcepub fn clear_steering_queue(&self)
pub fn clear_steering_queue(&self)
TODO: document this function.
Sourcepub fn clear_follow_up_queue(&self)
pub fn clear_follow_up_queue(&self)
TODO: document this function.
Sourcepub fn clear_all_queues(&self)
pub fn clear_all_queues(&self)
TODO: document this function.
Sourcepub fn cancel_auto_retry(&self)
pub fn cancel_auto_retry(&self)
TODO: document this function.
Sourcepub fn auto_retry_attempt(&self) -> usize
pub fn auto_retry_attempt(&self) -> usize
TODO: document this function.
Sourcepub fn state(&self) -> &SharedState
pub fn state(&self) -> &SharedState
Get a reference to the shared state. Used by Agent to sync state after loop execution.
Sourcepub fn external_stop(&self) -> &Arc<AtomicBool> ⓘ
pub fn external_stop(&self) -> &Arc<AtomicBool> ⓘ
Get the external stop flag.
Sourcepub async fn run(
&self,
prompt: String,
emit: impl Fn(AgentEvent) + Send + Sync + 'static,
) -> Result<Vec<AgentEvent>>
pub async fn run( &self, prompt: String, emit: impl Fn(AgentEvent) + Send + Sync + 'static, ) -> Result<Vec<AgentEvent>>
TODO: document this function.
Sourcepub async fn run_messages(
&self,
prompts: Vec<Message>,
emit: Arc<dyn Fn(AgentEvent) + Send + Sync>,
) -> Result<Vec<AgentEvent>>
pub async fn run_messages( &self, prompts: Vec<Message>, emit: Arc<dyn Fn(AgentEvent) + Send + Sync>, ) -> Result<Vec<AgentEvent>>
TODO: document this function.
Sourcepub async fn continue_loop(
&self,
emit: impl Fn(AgentEvent) + Send + Sync + 'static,
) -> Result<Vec<AgentEvent>>
pub async fn continue_loop( &self, emit: impl Fn(AgentEvent) + Send + Sync + 'static, ) -> Result<Vec<AgentEvent>>
TODO: document this function.
Auto Trait Implementations§
impl !Freeze for AgentLoop
impl !RefUnwindSafe for AgentLoop
impl Send for AgentLoop
impl Sync for AgentLoop
impl Unpin for AgentLoop
impl UnsafeUnpin for AgentLoop
impl !UnwindSafe for AgentLoop
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