AgentDB

Struct AgentDB 

Source
pub struct AgentDB { /* private fields */ }
Expand description

Main AgentDB interface providing vector storage, reflexion, causal, and skill management

Implementations§

Source§

impl AgentDB

Source

pub async fn new(config: AgentDBConfig) -> Result<Self, AgentDBError>

Creates a new AgentDB instance with the given configuration

Source

pub async fn vector_store( &self, embedding: Embedding, metadata: Value, ) -> Result<VectorId, AgentDBError>

Stores a vector embedding with associated metadata

Searches for the k most similar vectors using HNSW index

Source

pub async fn vector_get( &self, id: &str, ) -> Result<(Embedding, Value), AgentDBError>

Retrieves a specific vector by ID

Source

pub async fn vector_delete(&self, id: &str) -> Result<(), AgentDBError>

Deletes a vector by ID

Source

pub async fn reflexion_store( &self, episode: ReflexionEpisode, ) -> Result<ReflexionId, AgentDBError>

Stores a reflexion episode for learning from experience

Source

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

Retrieves similar reflexion episodes for a given task

Source

pub async fn reflexion_by_session( &self, session_id: &str, ) -> Result<Vec<ReflexionEpisode>, AgentDBError>

Retrieves reflexion episodes by session ID

Source

pub async fn reflexion_analyze( &self, task_prefix: &str, ) -> Result<ReflexionStats, AgentDBError>

Analyzes reflexion episodes to calculate success metrics

Source

pub async fn causal_add_edge( &self, edge: CausalEdge, ) -> Result<(), AgentDBError>

Adds or updates a causal edge

Source

pub async fn causal_query_effects( &self, cause: &str, ) -> Result<Vec<CausalEdge>, AgentDBError>

Queries effects caused by a specific cause

Source

pub async fn causal_query_causes( &self, effect: &str, ) -> Result<Vec<CausalEdge>, AgentDBError>

Queries causes that lead to a specific effect

Source

pub async fn causal_find_path( &self, start: &str, end: &str, max_depth: usize, ) -> Result<Vec<Vec<String>>, AgentDBError>

Finds causal paths between a cause and effect

Source

pub async fn skill_create(&self, skill: Skill) -> Result<SkillId, AgentDBError>

Creates a new skill with embedding

Searches for skills using semantic similarity

Source

pub async fn skill_search_by_embedding( &self, query_embedding: &Embedding, limit: usize, ) -> Result<Vec<(Skill, f64)>, AgentDBError>

Searches for skills using embedding similarity

Source

pub async fn skill_update_stats( &self, skill_id: &str, success: bool, ) -> Result<(), AgentDBError>

Updates skill usage statistics

Source

pub async fn skill_get(&self, skill_id: &str) -> Result<Skill, AgentDBError>

Gets a skill by ID

Source

pub async fn stats(&self) -> AgentDBStats

Returns statistics about the database

Source

pub async fn clear(&self) -> Result<(), AgentDBError>

Clears all data from the database

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, 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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