Memory
Memory is durable personalization that carries across conversations. It is scoped to the authenticated user inside the current tenant, with optional agent-specific blocks for facts that should only apply when a particular agent is active. Conversation-local chat-history compaction is documented separately in Conversation & Chat History.Memory Blocks
AgentFlow stores memory as full-replacement blocks:| Block | Visibility | Limit | Use |
|---|---|---|---|
core | Injected into every agent request | 4,000 chars / 20 entries | Stable, high-signal facts and preferences |
archival | Searched on demand by query | 8,000 chars | Specific facts useful to recall only when relevant |
| Scope | Subject | When to use |
|---|---|---|
user | Current user across all agents | General preferences, responsibilities, relationships |
agent | Current user plus one agent id | Agent-specific operating preferences or facts |
How Memory Reaches The Agent
- The
user_memorycontext block loads core user memory and active agent core memory by default. - Archival memory is tool-only by default and is recalled by query when a request or tool needs specific past facts. If
memory_policy.archival_mode="auto", bounded matches are injected as hidden current-turnsystem_reminders. - Sleep-time memory runs after a conversation settles and updates memory from the completed conversation.
- Explicit
update_memorytool calls write memory immediately and use compare-and-set protection.
memory_policy for per-run control:
archival_mode is intentionally conservative:
| Mode | Behavior |
|---|---|
tool_only | Default. Core memory is prompt context; archival memory is available through recall tools/API calls. |
auto | Adds the top archival matches for the current user message as hidden system_reminders, bounded by archival_limit and archival_min_score. |
off | No automatic archival injection. Explicit memory APIs and tools are unaffected; core memory inclusion is still controlled by include_user_core and include_agent_core. |
Reading Blocks
Updating Blocks Safely
Memory edits are compare-and-set. To update an existing block, send theupdated_at value you last read as expected_updated_at. If another writer changed the block first, the API returns 409 Conflict.
"expected_updated_at": null. If the block already exists, the create-style write conflicts instead of overwriting silently.

