pub struct Agent {
pub thinking_budget: u32,
/* private fields */
}Fields§
§thinking_budget: u32Implementations§
Source§impl Agent
impl Agent
pub fn new( providers: Vec<Box<dyn Provider>>, db: Db, config: &Config, memory: Option<Arc<MemoryStore>>, tools: ToolRegistry, profiles: Vec<AgentProfile>, cwd: String, agents_context: AgentsContext, hooks: HookRegistry, commands: CommandRegistry, ) -> Result<Self>
pub fn aside_provider(&self) -> Arc<dyn Provider>
pub fn set_background_tx(&mut self, tx: UnboundedSender<AgentEvent>)
pub fn background_tx(&self) -> Option<UnboundedSender<AgentEvent>>
pub fn execute_command(&self, name: &str, args: &str) -> Result<String>
pub fn list_commands(&self) -> Vec<(&str, &str)>
pub fn has_command(&self, name: &str) -> bool
pub fn hooks(&self) -> &HookRegistry
pub fn conversation_id(&self) -> &str
pub fn messages(&self) -> &[Message]
pub fn set_model(&mut self, model: String)
pub fn set_active_provider(&mut self, provider_name: &str, model: &str)
pub fn set_thinking_budget(&mut self, budget: u32)
pub fn available_models(&self) -> Vec<String>
pub fn cached_all_models(&self) -> Vec<(String, Vec<String>)>
pub async fn fetch_all_models(&mut self) -> Vec<(String, Vec<String>)>
pub fn current_model(&self) -> &str
pub fn current_provider_name(&self) -> &str
pub fn current_agent_name(&self) -> &str
pub fn context_window(&self) -> u32
pub async fn fetch_context_window(&self) -> u32
pub fn agent_profiles(&self) -> &[AgentProfile]
pub fn switch_agent(&mut self, name: &str) -> bool
pub fn cleanup_if_empty(&mut self)
pub fn new_conversation(&mut self) -> Result<()>
pub fn resume_conversation(&mut self, conversation: &Conversation) -> Result<()>
Sourcepub fn add_interrupted_message(
&mut self,
content: String,
tool_calls: Vec<InterruptedToolCall>,
thinking: Option<String>,
) -> Result<()>
pub fn add_interrupted_message( &mut self, content: String, tool_calls: Vec<InterruptedToolCall>, thinking: Option<String>, ) -> Result<()>
Add an interrupted (cancelled) assistant message to context and DB so the model sees it on the next send and can continue from where it stopped.
pub fn list_sessions(&self) -> Result<Vec<ConversationSummary>>
pub fn get_session(&self, id: &str) -> Result<Conversation>
pub fn get_tool_calls(&self, message_id: &str) -> Result<Vec<DbToolCall>>
pub fn conversation_title(&self) -> Option<String>
pub fn rename_session(&self, title: &str) -> Result<()>
pub fn cwd(&self) -> &str
pub fn truncate_messages(&mut self, count: usize)
pub fn revert_to_message(&mut self, keep: usize) -> Result<Vec<String>>
pub fn fork_conversation(&mut self, msg_count: usize) -> Result<()>
pub async fn send_message( &mut self, content: &str, event_tx: UnboundedSender<AgentEvent>, ) -> Result<()>
pub async fn send_message_with_images( &mut self, content: &str, images: Vec<(String, String)>, event_tx: UnboundedSender<AgentEvent>, ) -> Result<()>
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
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