pub struct Agent { /* private fields */ }
Expand description
Main agent orchestrator
Implementations§
Source§impl Agent
impl Agent
Sourcepub fn new(config: AgentConfig) -> Result<Self>
pub fn new(config: AgentConfig) -> Result<Self>
Create a new agent instance
Sourcepub fn with_components(
config: AgentConfig,
components: AgentComponentSet,
) -> Self
pub fn with_components( config: AgentConfig, components: AgentComponentSet, ) -> Self
Construct an agent from explicit components.
This helper enables embedding scenarios where callers manage dependencies (for example in open-source integrations or when providing custom tool registries).
Sourcepub fn component_builder(config: &AgentConfig) -> AgentComponentBuilder<'_>
pub fn component_builder(config: &AgentConfig) -> AgentComponentBuilder<'_>
Convenience constructor for customizing agent components via the builder pattern without manually importing the bootstrap module.
Sourcepub async fn initialize(&mut self) -> Result<()>
pub async fn initialize(&mut self) -> Result<()>
Initialize the agent with system setup
Sourcepub fn config(&self) -> &AgentConfig
pub fn config(&self) -> &AgentConfig
Get the agent’s current configuration
Sourcepub fn session_info(&self) -> &SessionInfo
pub fn session_info(&self) -> &SessionInfo
Get session information
Sourcepub fn performance_metrics(&self) -> PerformanceMetrics
pub fn performance_metrics(&self) -> PerformanceMetrics
Get performance metrics
Sourcepub fn decision_tracker(&self) -> &DecisionTracker
pub fn decision_tracker(&self) -> &DecisionTracker
Get decision tracker reference
Sourcepub fn decision_tracker_mut(&mut self) -> &mut DecisionTracker
pub fn decision_tracker_mut(&mut self) -> &mut DecisionTracker
Get mutable decision tracker reference
Sourcepub fn error_recovery(&self) -> &ErrorRecoveryManager
pub fn error_recovery(&self) -> &ErrorRecoveryManager
Get error recovery manager reference
Sourcepub fn error_recovery_mut(&mut self) -> &mut ErrorRecoveryManager
pub fn error_recovery_mut(&mut self) -> &mut ErrorRecoveryManager
Get mutable error recovery manager reference
Sourcepub fn summarizer(&self) -> &ConversationSummarizer
pub fn summarizer(&self) -> &ConversationSummarizer
Get conversation summarizer reference
Sourcepub fn tool_registry(&self) -> Arc<ToolRegistry>
pub fn tool_registry(&self) -> Arc<ToolRegistry>
Get tool registry reference
Sourcepub fn tool_registry_mut(&mut self) -> &mut ToolRegistry
pub fn tool_registry_mut(&mut self) -> &mut ToolRegistry
Get mutable tool registry reference
Sourcepub fn tree_sitter_analyzer(&self) -> &TreeSitterAnalyzer
pub fn tree_sitter_analyzer(&self) -> &TreeSitterAnalyzer
Get tree-sitter analyzer reference
Sourcepub fn tree_sitter_analyzer_mut(&mut self) -> &mut TreeSitterAnalyzer
pub fn tree_sitter_analyzer_mut(&mut self) -> &mut TreeSitterAnalyzer
Get mutable tree-sitter analyzer reference
Sourcepub fn compaction_engine(&self) -> Arc<CompactionEngine>
pub fn compaction_engine(&self) -> Arc<CompactionEngine>
Get compaction engine reference
Sourcepub async fn make_intelligent_compaction_decision(
&self,
) -> Result<CompactionDecision>
pub async fn make_intelligent_compaction_decision( &self, ) -> Result<CompactionDecision>
Make intelligent compaction decision using context analysis
Sourcepub async fn should_compact(&self) -> Result<bool>
pub async fn should_compact(&self) -> Result<bool>
Check if compaction is needed
Sourcepub async fn compact_messages(&self) -> Result<CompactionResult>
pub async fn compact_messages(&self) -> Result<CompactionResult>
Perform intelligent message compaction
Sourcepub async fn compact_context(
&self,
context_key: &str,
context_data: &mut HashMap<String, Value>,
) -> Result<CompactionResult>
pub async fn compact_context( &self, context_key: &str, context_data: &mut HashMap<String, Value>, ) -> Result<CompactionResult>
Perform context compaction
Sourcepub async fn get_compaction_stats(&self) -> Result<CompactionStatistics>
pub async fn get_compaction_stats(&self) -> Result<CompactionStatistics>
Get compaction statistics
Sourcepub fn analyze_file_with_tree_sitter(
&mut self,
file_path: &Path,
source_code: &str,
) -> Result<CodeAnalysis>
pub fn analyze_file_with_tree_sitter( &mut self, file_path: &Path, source_code: &str, ) -> Result<CodeAnalysis>
Analyze a file using tree-sitter
Sourcepub fn update_session_stats(
&mut self,
turns: usize,
decisions: usize,
errors: usize,
)
pub fn update_session_stats( &mut self, turns: usize, decisions: usize, errors: usize, )
Update session statistics
Sourcepub fn should_compress_context(&self, context_size: usize) -> bool
pub fn should_compress_context(&self, context_size: usize) -> bool
Check if context compression is needed
Sourcepub fn generate_context_plan(
&self,
context_size: usize,
) -> ContextPreservationPlan
pub fn generate_context_plan( &self, context_size: usize, ) -> ContextPreservationPlan
Generate context preservation plan
Sourcepub fn detect_error_pattern(
&self,
error_type: &ErrorType,
time_window_seconds: u64,
) -> bool
pub fn detect_error_pattern( &self, error_type: &ErrorType, time_window_seconds: u64, ) -> bool
Check for error patterns
Sourcepub fn show_transparency_report(&self, detailed: bool)
pub fn show_transparency_report(&self, detailed: bool)
Show transparency report
Auto Trait Implementations§
impl Freeze for Agent
impl !RefUnwindSafe for Agent
impl Send for Agent
impl Sync for Agent
impl Unpin 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
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 more