pub struct Agent<C: Channel> { /* private fields */ }Implementations§
Source§impl<C: Channel> Agent<C>
impl<C: Channel> Agent<C>
pub fn with_autosave_config( self, autosave_assistant: bool, min_length: usize, ) -> Self
pub fn with_tool_call_cutoff(self, cutoff: usize) -> Self
pub fn with_response_cache(self, cache: Arc<ResponseCache>) -> Self
Sourcepub fn with_parent_tool_use_id(self, id: impl Into<String>) -> Self
pub fn with_parent_tool_use_id(self, id: impl Into<String>) -> Self
Set the parent tool call ID for subagent sessions.
When set, every LoopbackEvent::ToolStart and LoopbackEvent::ToolOutput emitted
by this agent will carry the parent_tool_use_id so the IDE can build a subagent
hierarchy tree.
pub fn with_stt(self, stt: Box<dyn SpeechToText>) -> Self
Sourcepub fn with_debug_dumper(self, dumper: DebugDumper) -> Self
pub fn with_debug_dumper(self, dumper: DebugDumper) -> Self
Enable debug dump mode, writing LLM requests/responses and raw tool output to dumper.
pub fn with_update_notifications(self, rx: Receiver<String>) -> Self
pub fn with_custom_task_rx(self, rx: Receiver<String>) -> Self
Sourcepub fn add_tool_executor(self, extra: impl ToolExecutor + 'static) -> Self
pub fn add_tool_executor(self, extra: impl ToolExecutor + 'static) -> Self
Wrap the current tool executor with an additional executor via CompositeExecutor.
pub fn with_max_tool_iterations(self, max: usize) -> Self
Sourcepub fn with_max_tool_retries(self, max: usize) -> Self
pub fn with_max_tool_retries(self, max: usize) -> Self
Set the maximum number of retry attempts for transient tool errors (0 = disabled, max 5).
Sourcepub fn with_tool_repeat_threshold(self, threshold: usize) -> Self
pub fn with_tool_repeat_threshold(self, threshold: usize) -> Self
Set the repeat-detection threshold (0 = disabled).
Window size is 2 * threshold.
pub fn with_memory( self, memory: Arc<SemanticMemory>, conversation_id: ConversationId, history_limit: u32, recall_limit: usize, summarization_threshold: usize, ) -> Self
pub fn with_embedding_model(self, model: String) -> Self
pub fn with_disambiguation_threshold(self, threshold: f32) -> Self
pub fn with_skill_prompt_mode(self, mode: SkillPromptMode) -> Self
pub fn with_document_config(self, config: DocumentConfig) -> Self
pub fn with_graph_config(self, config: GraphConfig) -> Self
pub fn with_anomaly_detector(self, detector: AnomalyDetector) -> Self
pub fn with_instruction_blocks(self, blocks: Vec<InstructionBlock>) -> Self
pub fn with_instruction_reload( self, rx: Receiver<InstructionEvent>, state: InstructionReloadState, ) -> Self
pub fn with_shutdown(self, rx: Receiver<bool>) -> Self
pub fn with_skill_reload( self, paths: Vec<PathBuf>, rx: Receiver<SkillEvent>, ) -> Self
pub fn with_managed_skills_dir(self, dir: PathBuf) -> Self
pub fn with_trust_config(self, config: TrustConfig) -> Self
pub fn with_config_reload( self, path: PathBuf, rx: Receiver<ConfigEvent>, ) -> Self
pub fn with_logging_config(self, logging: LoggingConfig) -> Self
pub fn with_available_secrets( self, secrets: impl IntoIterator<Item = (String, Secret)>, ) -> Self
Sourcepub fn with_hybrid_search(self, enabled: bool) -> Self
pub fn with_hybrid_search(self, enabled: bool) -> Self
§Panics
Panics if the registry RwLock is poisoned.
pub fn with_learning(self, config: LearningConfig) -> Self
pub fn with_judge_provider(self, provider: AnyProvider) -> Self
pub fn with_mcp( self, tools: Vec<McpTool>, registry: Option<McpToolRegistry>, manager: Option<Arc<McpManager>>, mcp_config: &McpConfig, ) -> Self
pub fn with_security( self, security: SecurityConfig, timeouts: TimeoutConfig, ) -> Self
pub fn with_redact_credentials(self, enabled: bool) -> Self
pub fn with_tool_summarization(self, enabled: bool) -> Self
pub fn with_overflow_config(self, config: OverflowConfig) -> Self
pub fn with_summary_provider(self, provider: AnyProvider) -> Self
pub fn with_quarantine_summarizer(self, qs: QuarantinedSummarizer) -> Self
pub fn with_permission_policy(self, policy: PermissionPolicy) -> Self
pub fn with_context_budget( self, budget_tokens: usize, reserve_ratio: f32, compaction_threshold: f32, compaction_preserve_tail: usize, prune_protect_tokens: usize, ) -> Self
pub fn with_deferred_apply_threshold(self, threshold: f32) -> Self
pub fn with_compression(self, compression: CompressionConfig) -> Self
pub fn with_routing(self, routing: RoutingConfig) -> Self
pub fn with_model_name(self, name: impl Into<String>) -> Self
pub fn with_warmup_ready(self, rx: Receiver<bool>) -> Self
pub fn with_cost_tracker(self, tracker: CostTracker) -> Self
Sourcepub fn with_metrics(self, tx: Sender<MetricsSnapshot>) -> Self
pub fn with_metrics(self, tx: Sender<MetricsSnapshot>) -> Self
§Panics
Panics if the registry RwLock is poisoned.
Sourcepub fn cancel_signal(&self) -> Arc<Notify>
pub fn cancel_signal(&self) -> Arc<Notify>
Returns a handle that can cancel the current in-flight operation.
The returned Notify is stable across messages — callers invoke
notify_waiters() to cancel whatever operation is running.
Sourcepub fn with_cancel_signal(self, signal: Arc<Notify>) -> Self
pub fn with_cancel_signal(self, signal: Arc<Notify>) -> Self
Inject a shared cancel signal so an external caller (e.g. ACP session) can
interrupt the agent loop by calling notify_one().
pub fn with_subagent_manager(self, manager: SubAgentManager) -> Self
pub fn with_subagent_config(self, config: SubAgentConfig) -> Self
pub fn with_orchestration_config(self, config: OrchestrationConfig) -> Self
Sourcepub fn with_provider_override(
self,
slot: Arc<RwLock<Option<AnyProvider>>>,
) -> Self
pub fn with_provider_override( self, slot: Arc<RwLock<Option<AnyProvider>>>, ) -> Self
Inject a shared provider override slot for runtime model switching (e.g. via ACP
set_session_config_option). The agent checks and swaps the provider before each turn.
Source§impl<C: Channel> Agent<C>
impl<C: Channel> Agent<C>
Sourcepub async fn handle_graph_command(
&mut self,
input: &str,
) -> Result<(), AgentError>
pub async fn handle_graph_command( &mut self, input: &str, ) -> Result<(), AgentError>
Dispatch /graph [subcommand] slash command.
§Errors
Returns an error if the channel send fails or graph store query fails.
Source§impl<C: Channel> Agent<C>
impl<C: Channel> Agent<C>
Sourcepub async fn handle_log_command(&mut self) -> Result<(), AgentError>
pub async fn handle_log_command(&mut self) -> Result<(), AgentError>
Handle the /log slash command: show current log file path and recent entries.
§Errors
Returns an error if the channel send fails.
Source§impl<C: Channel> Agent<C>
impl<C: Channel> Agent<C>
Sourcepub async fn load_history(&mut self) -> Result<(), AgentError>
pub async fn load_history(&mut self) -> Result<(), AgentError>
Load conversation history from memory and inject into messages.
§Errors
Returns an error if loading history from SQLite fails.
Source§impl<C: Channel> Agent<C>
impl<C: Channel> Agent<C>
Sourcepub fn sync_community_detection_failures(&self)
pub fn sync_community_detection_failures(&self)
Read the community-detection failure counter from SemanticMemory and update metrics.
Sourcepub fn sync_graph_extraction_metrics(&self)
pub fn sync_graph_extraction_metrics(&self)
Sync all graph counters (extraction count/failures) from SemanticMemory to metrics.
Sourcepub async fn sync_graph_counts(&self)
pub async fn sync_graph_counts(&self)
Fetch entity/edge/community counts from the graph store and write to metrics.
Sourcepub async fn check_vector_store_health(&self, backend_name: &str)
pub async fn check_vector_store_health(&self, backend_name: &str)
Perform a real health check on the vector store and update metrics.
Sourcepub fn inject_code_context(&mut self, text: &str)
pub fn inject_code_context(&mut self, text: &str)
Inject pre-formatted code context into the message list. The caller is responsible for retrieving and formatting the text.
pub fn context_messages(&self) -> &[Message]
Source§impl<C: Channel> Agent<C>
impl<C: Channel> Agent<C>
pub fn new( provider: AnyProvider, channel: C, registry: SkillRegistry, matcher: Option<SkillMatcherBackend>, max_active_skills: usize, tool_executor: impl ToolExecutor + 'static, ) -> Self
Sourcepub fn new_with_registry_arc(
provider: AnyProvider,
channel: C,
registry: Arc<RwLock<SkillRegistry>>,
matcher: Option<SkillMatcherBackend>,
max_active_skills: usize,
tool_executor: impl ToolExecutor + 'static,
) -> Self
pub fn new_with_registry_arc( provider: AnyProvider, channel: C, registry: Arc<RwLock<SkillRegistry>>, matcher: Option<SkillMatcherBackend>, max_active_skills: usize, tool_executor: impl ToolExecutor + 'static, ) -> Self
Create an agent from a pre-wrapped registry Arc, allowing the caller to
share the same Arc with other components (e.g. crate::SkillLoaderExecutor).
§Panics
Panics if the registry RwLock is poisoned.
Sourcepub async fn poll_subagents(&mut self) -> Vec<(String, String)>
pub async fn poll_subagents(&mut self) -> Vec<(String, String)>
Poll all active sub-agents for completed/failed/canceled results.
Non-blocking: returns immediately with a list of (task_id, result) pairs
for agents that have finished. Each completed agent is removed from the manager.
pub async fn shutdown(&mut self)
Auto Trait Implementations§
impl<C> !Freeze for Agent<C>
impl<C> !RefUnwindSafe for Agent<C>
impl<C> Send for Agent<C>
impl<C> Sync for Agent<C>where
C: Sync,
impl<C> Unpin for Agent<C>where
C: Unpin,
impl<C> UnsafeUnpin for Agent<C>where
C: UnsafeUnpin,
impl<C> !UnwindSafe for Agent<C>
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
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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request