pub struct AgentMemory { /* private fields */ }Expand description
Long-term memory for one user and one session: facts about the user and a session summary, kept in a SQLite file. The agent gets the five memory tools, bound to this user and session, and by default the facts and summary are prepended to every run’s input.
Implementations§
Source§impl AgentMemory
impl AgentMemory
Sourcepub fn new(user: impl Into<String>, session: impl Into<String>) -> AgentMemory
pub fn new(user: impl Into<String>, session: impl Into<String>) -> AgentMemory
Starts memory bound to user, whose facts the tools touch, and
session, whose summary they touch. Both are chosen by the host,
never by the model; 1 to 256 bytes each, checked at build.
Sourcepub fn sqlite(self, path: impl AsRef<Path>) -> AgentMemory
pub fn sqlite(self, path: impl AsRef<Path>) -> AgentMemory
Sets the SQLite file facts and summaries live in. Required in 0.2
unless the agent also has .knowledge(..), whose store is used.
Returns the memory settings.
Sourcepub fn preamble(self, on: bool) -> AgentMemory
pub fn preamble(self, on: bool) -> AgentMemory
Turns the preamble of facts and summary before each run on or off.
Default true.
Returns the memory settings.
Sourcepub fn fact_caps(
self,
max_fact_bytes: usize,
max_facts: usize,
max_log: usize,
) -> AgentMemory
pub fn fact_caps( self, max_fact_bytes: usize, max_facts: usize, max_log: usize, ) -> AgentMemory
Caps one fact’s bytes, the facts per user and the fact log length.
Defaults 1024, 200 and 1000; zero is refused at build.
Returns the memory settings.
Sourcepub fn max_summary_bytes(self, bytes: usize) -> AgentMemory
pub fn max_summary_bytes(self, bytes: usize) -> AgentMemory
Caps the session summary in bytes.
Default 4096; zero is refused at build.
Returns the memory settings.
Sourcepub fn preamble_budget_tokens(self, tokens: usize) -> AgentMemory
pub fn preamble_budget_tokens(self, tokens: usize) -> AgentMemory
Caps the preamble in estimated tokens; facts that do not fit are
left out. Default 800; zero is refused at build.
Returns the memory settings.
Trait Implementations§
Source§impl Clone for AgentMemory
impl Clone for AgentMemory
Source§fn clone(&self) -> AgentMemory
fn clone(&self) -> AgentMemory
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more