pub struct Agent { /* private fields */ }Expand description
Full Agent with event output
Implementations§
Source§impl Agent
impl Agent
Sourcepub fn event_sender(&self) -> Sender<AgentEvent>
pub fn event_sender(&self) -> Sender<AgentEvent>
Get event sender for streaming
Sourcepub fn set_ask_channel(&mut self, rx: Receiver<String>)
pub fn set_ask_channel(&mut self, rx: Receiver<String>)
Set ask response channel (for TUI mode)
Sourcepub fn set_cancel_token(&mut self, token: CancellationToken)
pub fn set_cancel_token(&mut self, token: CancellationToken)
Set cancellation token
Sourcepub fn set_approve_mode(&mut self, mode: ApproveMode)
pub fn set_approve_mode(&mut self, mode: ApproveMode)
Set approve mode at runtime
Get a shared reference to the approve mode atomic.
Replace the internal approve mode with an externally-created shared atomic.
Sourcepub fn update_memory_summary(&mut self, summary: Option<String>)
pub fn update_memory_summary(&mut self, summary: Option<String>)
Update memory summary and rebuild system prompt.
Sourcepub async fn run(&mut self, user_input: String) -> Result<Vec<AgentEvent>>
pub async fn run(&mut self, user_input: String) -> Result<Vec<AgentEvent>>
Run chat loop with tool execution (streaming version).
Sourcepub fn set_messages(&mut self, messages: Vec<Message>)
pub fn set_messages(&mut self, messages: Vec<Message>)
Restore message history (for session continue/resume)
Sourcepub fn get_messages(&self) -> &[Message]
pub fn get_messages(&self) -> &[Message]
Get current messages (for session saving)
Sourcepub fn get_token_counts(&self) -> (u64, u64)
pub fn get_token_counts(&self) -> (u64, u64)
Get current token counts
Sourcepub fn clear_history(&mut self)
pub fn clear_history(&mut self)
Clear message history
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get message count
Auto Trait Implementations§
impl !Freeze for Agent
impl !RefUnwindSafe for Agent
impl Send for Agent
impl Sync for Agent
impl Unpin for Agent
impl UnsafeUnpin for Agent
impl !UnwindSafe for Agent
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