Memory vs KV Store
Memory is built for conversation context — message history, summaries, who spoke last, session status. Its content is managed: old turns are trimmed bymaxTurns/maxTokens and compacted by summarization, so what you appended yesterday may only survive as part of a summary.
That makes Memory the wrong place to park business data. If you need a value to come back exactly as you stored it — a cart, a feature flag, a counter, a customer preference — use the KV Store instead.
Memory Integrated in Agent
Standalone Memory Manager
Memory with User Identification
Custom Memory Key
Cross-Session Access
Listing Sessions
Memory.list() queries all sessions for the current agent with filtering. Each result includes the last message, so you can decide what to do without loading the full conversation.
Checking Who Spoke Last
UselastMessage.role to know if the user or the agent was the last to speak — useful for deciding whether to follow up:
Don’t use
identify() in a loop — it sets a global singleton that would get overwritten on each iteration. Pass entityType/entityValue directly in the agent.process() input instead.Session Status
Mark sessions with a status to track their lifecycle. Status is stored in session metadata — no migration needed.Status via Tools (Recommended)
The best pattern is to let tools set the status — the LLM decides when to call them based on the conversation:Memory.setStatus() directly — the tools do it. The agent’s instructions guide the LLM to use the right tool at the right time.
Status Lifecycle
Custom Summarization
Memory Configuration Options
Cross-agent memory administration
TheMemory module operates on the caller’s own agent context — its key is prefixed with the caller’s agentId so each agent has its own namespace.
To curate another agent’s memory (inject a system message, clear stale sessions, audit messages, summarize), use the MemoryAdmin module from the cross-agent SDK. Same six operations, but you pass the target agent explicitly and the backend prefixes the key with the target’s id instead of the caller’s.
Next Steps
Context Management
Learn about context management
Cross-Agent SDK
Operate on another agent’s memory and executions
Tools
Create custom tools
Abandoned Cart Recovery
Complete project: conversation in Memory, cart state in KV