pub trait CoreMemory: Send + Sync {
// Required methods
fn blocks(
&self,
) -> impl Future<Output = Result<Vec<CoreMemoryBlock>>> + Send;
fn put_block(
&self,
block: CoreMemoryBlock,
) -> impl Future<Output = Result<()>> + Send;
fn append_block(
&self,
label: &str,
text: &str,
) -> impl Future<Output = Result<()>> + Send;
fn remove_block(
&self,
label: &str,
) -> impl Future<Output = Result<bool>> + Send;
// Provided methods
fn get_block(
&self,
label: &str,
) -> impl Future<Output = Result<Option<CoreMemoryBlock>>> + Send { ... }
fn render(&self) -> impl Future<Output = Result<String>> + Send { ... }
}Expand description
Trait for always-in-context core memory backends.
Core memory is distinct from Memory: it is not
a chronological log, it is a small set of labeled blocks that are
rendered as a whole and re-injected into the system prompt every turn.
The agent itself (via a tool) or the host application can read and edit
blocks between turns.
Required Methods§
Sourcefn blocks(&self) -> impl Future<Output = Result<Vec<CoreMemoryBlock>>> + Send
fn blocks(&self) -> impl Future<Output = Result<Vec<CoreMemoryBlock>>> + Send
Returns all blocks currently stored.
Sourcefn put_block(
&self,
block: CoreMemoryBlock,
) -> impl Future<Output = Result<()>> + Send
fn put_block( &self, block: CoreMemoryBlock, ) -> impl Future<Output = Result<()>> + Send
Creates a block (if block.label is new) or overwrites the value and
limit of an existing one. Fails if block.value exceeds block.limit.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".