Skip to main content

bamboo_engine/runtime/managers/
memory.rs

1use async_trait::async_trait;
2use bamboo_agent_core::tools::ToolSchema;
3use bamboo_agent_core::Session;
4
5use crate::runtime::config::AgentLoopConfig;
6
7/// Manages external memory recall, compression, and summarization.
8#[async_trait]
9pub trait MemoryManager: Send + Sync {
10    /// Recall relevant memories for the current context.
11    /// Returns `true` if any memories were injected.
12    async fn recall_memories(&self, session: &mut Session, config: &AgentLoopConfig) -> bool;
13
14    /// Check if compression should be applied and apply it.
15    /// Returns `true` if compression was performed.
16    #[allow(clippy::too_many_arguments)]
17    async fn maybe_compress(
18        &self,
19        session: &mut Session,
20        config: &AgentLoopConfig,
21        phase: &str,
22        session_id: &str,
23        model_name: &str,
24        tool_schemas: &[ToolSchema],
25    ) -> bool;
26}