pub struct AgentApi { /* private fields */ }Expand description
Agent management system calls.
Implementations§
Source§impl AgentApi
impl AgentApi
Sourcepub fn new(
supervisor: Arc<dyn Supervisor>,
budget_manager: Arc<BudgetManager>,
memory_manager: Arc<MemoryManager>,
event_bus: Option<EventBus>,
) -> Self
pub fn new( supervisor: Arc<dyn Supervisor>, budget_manager: Arc<BudgetManager>, memory_manager: Arc<MemoryManager>, event_bus: Option<EventBus>, ) -> Self
Create a new AgentApi.
Sourcepub fn set_hnsw_index(&mut self, index: Arc<HnswMemoryIndex>)
pub fn set_hnsw_index(&mut self, index: Arc<HnswMemoryIndex>)
Attach an HNSW index for semantic search.
Sourcepub fn check_budget(&self, agent_id: &AgentId) -> BudgetInfo
pub fn check_budget(&self, agent_id: &AgentId) -> BudgetInfo
Check budget for an agent.
Sourcepub fn set_budget(&self, limit: BudgetLimit)
pub fn set_budget(&self, limit: BudgetLimit)
Set budget for an agent.
Sourcepub fn remove_budget(&self, agent_id: &AgentId)
pub fn remove_budget(&self, agent_id: &AgentId)
Remove budget for an agent.
Sourcepub fn reserve_budget(
&self,
agent_id: &AgentId,
tokens: u64,
) -> Result<(), BudgetExceeded>
pub fn reserve_budget( &self, agent_id: &AgentId, tokens: u64, ) -> Result<(), BudgetExceeded>
Reserve tokens for an agent.
Sourcepub fn reset_budget(&self, agent_id: &AgentId)
pub fn reset_budget(&self, agent_id: &AgentId)
Reset budget window for an agent.
Sourcepub fn full_budget_info(&self, agent_id: &AgentId) -> Option<FullBudgetInfo>
pub fn full_budget_info(&self, agent_id: &AgentId) -> Option<FullBudgetInfo>
Get full budget info (limits + usage) for an agent.
Sourcepub fn all_budget_info(&self) -> Vec<FullBudgetInfo>
pub fn all_budget_info(&self) -> Vec<FullBudgetInfo>
Get full budget info for all agents with configured budgets.
Sourcepub async fn memory_stats(&self) -> (usize, usize)
pub async fn memory_stats(&self) -> (usize, usize)
Get memory stats.
Sourcepub async fn remember(&self, entry: MemoryEntry) -> Result<String>
pub async fn remember(&self, entry: MemoryEntry) -> Result<String>
Store a memory entry.
Sourcepub async fn search_memory(
&self,
query: &str,
memory_type: Option<MemoryType>,
limit: usize,
) -> Result<Vec<MemoryEntry>>
pub async fn search_memory( &self, query: &str, memory_type: Option<MemoryType>, limit: usize, ) -> Result<Vec<MemoryEntry>>
Search memory entries.
Sourcepub async fn semantic_search_memory(
&self,
query: &str,
memory_type: Option<MemoryType>,
limit: usize,
) -> Result<Vec<SemanticHit>>
pub async fn semantic_search_memory( &self, query: &str, memory_type: Option<MemoryType>, limit: usize, ) -> Result<Vec<SemanticHit>>
Semantic search using HNSW index.
Falls back to regular search if HNSW index is not available.
Sourcepub fn memory_manager(&self) -> &Arc<MemoryManager> ⓘ
pub fn memory_manager(&self) -> &Arc<MemoryManager> ⓘ
Memory manager reference.
Sourcepub async fn rebuild_hnsw_index(&self) -> Result<usize>
pub async fn rebuild_hnsw_index(&self) -> Result<usize>
Rebuild the HNSW index from all stored memories.
Auto Trait Implementations§
impl !RefUnwindSafe for AgentApi
impl !UnwindSafe for AgentApi
impl Freeze for AgentApi
impl Send for AgentApi
impl Sync for AgentApi
impl Unpin for AgentApi
impl UnsafeUnpin for AgentApi
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