pub struct AgentLoop { /* private fields */ }Expand description
The agent loop is the core processing engine
Implementations§
Source§impl AgentLoop
impl AgentLoop
Sourcepub fn register_default_tools(&mut self, tool_config: ToolConfig)
pub fn register_default_tools(&mut self, tool_config: ToolConfig)
Register default tools (for use after construction)
Source§impl AgentLoop
impl AgentLoop
Sourcepub fn new(
bus: MessageBus,
provider: Arc<dyn LLMProvider>,
workspace: PathBuf,
model: Option<String>,
max_iterations: Option<usize>,
) -> Self
pub fn new( bus: MessageBus, provider: Arc<dyn LLMProvider>, workspace: PathBuf, model: Option<String>, max_iterations: Option<usize>, ) -> Self
Create a new agent loop
Sourcepub fn with_tools(
bus: MessageBus,
provider: Arc<dyn LLMProvider>,
workspace: PathBuf,
model: Option<String>,
max_iterations: Option<usize>,
tool_config: ToolConfig,
runtime_control_rx: Option<UnboundedReceiver<RuntimeControlCommand>>,
) -> Self
pub fn with_tools( bus: MessageBus, provider: Arc<dyn LLMProvider>, workspace: PathBuf, model: Option<String>, max_iterations: Option<usize>, tool_config: ToolConfig, runtime_control_rx: Option<UnboundedReceiver<RuntimeControlCommand>>, ) -> Self
Create a new agent loop with tool configuration
Sourcepub async fn run(&mut self) -> Result<(), Box<dyn Error>>
pub async fn run(&mut self) -> Result<(), Box<dyn Error>>
Run the agent loop, processing messages from the bus
Sourcepub async fn process_inbound_message(
&mut self,
msg: InboundMessage,
event_tx: Option<&UnboundedSender<AgentEvent>>,
) -> Result<Option<OutboundMessage>, Box<dyn Error>>
pub async fn process_inbound_message( &mut self, msg: InboundMessage, event_tx: Option<&UnboundedSender<AgentEvent>>, ) -> Result<Option<OutboundMessage>, Box<dyn Error>>
Process a single inbound message
Sourcepub async fn process_direct(
&mut self,
content: impl Into<String>,
_session_key: impl Into<String>,
channel: impl Into<String>,
chat_id: impl Into<String>,
) -> Result<String, Box<dyn Error>>
pub async fn process_direct( &mut self, content: impl Into<String>, _session_key: impl Into<String>, channel: impl Into<String>, chat_id: impl Into<String>, ) -> Result<String, Box<dyn Error>>
Process a message directly (for CLI or testing)
Sourcepub async fn process_direct_stream(
&mut self,
content: impl Into<String>,
_session_key: impl Into<String>,
channel: impl Into<String>,
chat_id: impl Into<String>,
event_tx: UnboundedSender<AgentEvent>,
) -> Result<String, Box<dyn Error>>
pub async fn process_direct_stream( &mut self, content: impl Into<String>, _session_key: impl Into<String>, channel: impl Into<String>, chat_id: impl Into<String>, event_tx: UnboundedSender<AgentEvent>, ) -> Result<String, Box<dyn Error>>
Process a message directly and emit streaming events for UI consumers.
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more