pub struct SelfImprovementSystem { /* private fields */ }Expand description
Orchestrates the 4-phase self-improvement loop.
§Example
ⓘ
let system = SelfImprovementSystem::new(config, storage, langbase);
// Record invocations (called after each tool use)
system.on_invocation(event).await;
// Check health and run cycle if needed
let health = system.check_health().await;
if health.should_act() {
let result = system.run_cycle().await?;
}Implementations§
Source§impl SelfImprovementSystem
impl SelfImprovementSystem
Sourcepub fn new(
config: SelfImprovementConfig,
_storage: SqliteStorage,
langbase: LangbaseClient,
) -> Self
pub fn new( config: SelfImprovementConfig, _storage: SqliteStorage, langbase: LangbaseClient, ) -> Self
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if the system is enabled.
Sourcepub async fn on_invocation(&self, event: InvocationEvent)
pub async fn on_invocation(&self, event: InvocationEvent)
Record an invocation for metric tracking.
This should be called after each tool invocation to feed the Monitor.
Sourcepub async fn check_health(&self) -> Option<HealthReport>
pub async fn check_health(&self) -> Option<HealthReport>
Get current health report from the Monitor.
Returns Some(HealthReport) if enough samples have been collected
and it’s time for a check, None otherwise.
Sourcepub async fn force_health_check(&self) -> Option<HealthReport>
pub async fn force_health_check(&self) -> Option<HealthReport>
Force a health check regardless of timing.
Sourcepub async fn status(&self) -> SystemStatus
pub async fn status(&self) -> SystemStatus
Get current system status.
Sourcepub async fn run_cycle(&self) -> Result<CycleResult, SelfImprovementError>
pub async fn run_cycle(&self) -> Result<CycleResult, SelfImprovementError>
Run one improvement cycle (Monitor → Analyzer → Executor → Learner).
§Returns
Ok(CycleResult)- Cycle completed (may or may not have taken action)Err(SelfImprovementError)- Cycle blocked or failed
Sourcepub async fn force_cycle(&self) -> Result<CycleResult, SelfImprovementError>
pub async fn force_cycle(&self) -> Result<CycleResult, SelfImprovementError>
Force run a cycle even if system would normally not act.
This bypasses health checks but still respects circuit breaker and rate limits.
Auto Trait Implementations§
impl Freeze for SelfImprovementSystem
impl !RefUnwindSafe for SelfImprovementSystem
impl Send for SelfImprovementSystem
impl Sync for SelfImprovementSystem
impl Unpin for SelfImprovementSystem
impl !UnwindSafe for SelfImprovementSystem
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