Skip to main content

AgenticDB

Struct AgenticDB 

Source
pub struct AgenticDB {
    pub reflexion: Arc<RwLock<ReflexionMemory>>,
    pub skills: Arc<RwLock<SkillLibrary>>,
    pub causal: Arc<RwLock<CausalMemory>>,
    pub sessions: Arc<RwLock<Vec<LearningSession>>>,
    pub temporal: Arc<RwLock<TemporalMemory>>,
    pub meta: Arc<RwLock<MetaLearner>>,
    pub experiences: Arc<RwLock<ExperienceWindow>>,
    pub drift_detector: Arc<RwLock<DriftDetector>>,
    /* private fields */
}
Expand description

AgenticDB: Complete agent memory system.

Provides persistent memory for AI agents with:

  • Self-reflection and learning from mistakes
  • Skill consolidation and reuse
  • Causal reasoning over relationships
  • Reinforcement learning from sessions
  • Temporal pattern detection (time crystals)
  • Online/continual learning with forgetting prevention
  • Meta-learning for quick adaptation

Fields§

§reflexion: Arc<RwLock<ReflexionMemory>>

Reflexion episodes for self-critique.

§skills: Arc<RwLock<SkillLibrary>>

Library of learned skills.

§causal: Arc<RwLock<CausalMemory>>

Causal relationships between concepts.

§sessions: Arc<RwLock<Vec<LearningSession>>>

Learning sessions with rewards.

§temporal: Arc<RwLock<TemporalMemory>>

Temporal patterns (time crystals).

§meta: Arc<RwLock<MetaLearner>>

Meta-learner for quick task adaptation.

§experiences: Arc<RwLock<ExperienceWindow>>

Experience window for continual learning.

§drift_detector: Arc<RwLock<DriftDetector>>

Distribution drift detector.

Implementations§

Source§

impl AgenticDB

Source

pub fn new() -> Self

Create a new in-memory AgenticDB.

§Arguments
  • meta_param_dim - Dimension of meta-learning parameters (default 64)
  • drift_feature_dim - Dimension of features for drift detection (default 64)
Source

pub fn with_dimensions(meta_param_dim: usize, drift_feature_dim: usize) -> Self

Create with specific dimensions for meta-learning.

Source

pub fn with_path(path: impl Into<String>) -> Self

Create with persistence.

Source

pub async fn add_reflexion(&self, episode: ReflexionEpisode)

Record a reflexion episode (self-critique).

§Example
use converge_knowledge::agentic::{AgenticDB, ReflexionEpisode, Critique, CritiqueType};

let db = AgenticDB::new();

// Agent attempted something and failed
let episode = ReflexionEpisode::new(
    "write_code",
    "Write a function to parse JSON",
    "fn parse() { /* incomplete */ }",
    false, // did not succeed
)
.with_critique(Critique::new(
    CritiqueType::MissingStep,
    "Did not handle error cases",
    "Add Result return type and error handling",
));

db.add_reflexion(episode).await;
Source

pub async fn query_similar_failures( &self, task: &str, limit: usize, ) -> Vec<ReflexionEpisode>

Query similar past failures to avoid repeating mistakes.

Source

pub async fn register_skill(&self, skill: Skill)

Register a successful skill pattern.

Source

pub async fn find_skills(&self, _task_description: &str) -> Vec<&Skill>

Find applicable skills for a task.

Add a causal relationship.

Source

pub async fn start_session(&self, goal: impl Into<String>) -> Uuid

Start a new learning session.

Source

pub async fn record_turn( &self, session_id: Uuid, action: impl Into<String>, observation: impl Into<String>, reward: Reward, )

Record a turn in a session.

Source

pub async fn stats(&self) -> AgenticStats

Get statistics about the agent memory.

Source

pub async fn record_temporal( &self, pattern_name: &str, period: TemporalPeriod, value: f32, )

Record a temporal pattern (time crystal).

Use this to track periodic behavior patterns like:

  • Daily coding activity
  • Weekly deployment schedules
  • Monthly review cycles
Source

pub async fn predict_temporal(&self, pattern_name: &str) -> Option<f32>

Predict activity for a temporal pattern.

Source

pub async fn add_experience( &mut self, features: Vec<f32>, target: f32, task_id: Option<String>, )

Add experience for continual learning.

Source

pub async fn check_drift(&self, features: &[f32]) -> bool

Check for distribution drift.

Returns true if the current features indicate a distribution shift that may require model adaptation.

Source

pub async fn meta_update( &self, task_id: &str, final_params: &[f32], task_embedding: Option<Vec<f32>>, )

Update meta-learner after completing a task.

Source

pub async fn get_task_initialization( &self, task_embedding: Option<&[f32]>, ) -> Vec<f32>

Get initialization parameters for a new task.

Source

pub async fn register_strategy(&self, strategy: LearningStrategy)

Register a learning strategy.

Source

pub async fn select_strategy( &self, task_features: &TaskFeatures, ) -> Option<String>

Select best strategy for a task.

Trait Implementations§

Source§

impl Default for AgenticDB

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more