Skip to main content

create_memory_for_agent

Function create_memory_for_agent 

Source
pub async fn create_memory_for_agent(
    config: &Config,
    agent_alias: &str,
    api_key: Option<&str>,
) -> Result<Arc<dyn Memory>, Error>
Expand description

Build the per-agent memory wrapper for agent_alias.

Wraps the appropriate inner backend with AgentScopedMemory (for SQL- and Qdrant-backed agents — single shared backend, agent_id column distinguishes rows) or AgentScopedMarkdownMemory (for Markdown-backed agents — per-agent dirs, peer set composed from the resolved read_memory_from allowlist). NoneMemory agents pass through unwrapped.

Cross-backend allowlist entries are rejected at config load, so by the time we get here every entry on agents.<alias>.workspace.read_memory_from is guaranteed to point at a sibling on the same backend kind.