Skip to main content
Agent memory controls what your agent remembers across conversations. Configure these settings in the Memory tab of your agent’s Workbench.
Agent Memory Settings

Three Types of Memory

  1. Session Storage - Conversation history within a thread (session_id). Multiple users can share the same thread.
  2. User Memories - Personal facts about each user (user_id) that persist across all conversations.
  3. Agent Memories - Global knowledge that applies to all users.
Recommended setup: Session Storage (3-5 runs) + User Memories with agentic management enabled.

Session Storage

Controls how many conversation exchanges the agent sees.
  • 3 runs = Last 3 back-and-forth exchanges (6 messages)
  • 10 runs = Last 10 exchanges (20 messages)
Terminology: “No. of history runs” (UI) = num_history_responses (code) = max_runs (override)

User Memories

Stores personal facts about each user across all conversations. Agentic managed:
  • Enabled - Agent automatically creates/updates memories
  • Disabled - You manually create memories via API
Privacy: User memories store personal data. Never store passwords, API keys, SSNs, or credit cards. Memories persist until explicitly deleted.

Agent Memories

Stores global knowledge that affects all users. Agentic managed:
  • Enabled - Agent learns patterns automatically
  • Disabled (Recommended for Production) - Only admins create memories
Risk: One user’s interaction can change behavior for everyone. Not recommended for production, compliance-heavy, or multi-tenant systems without weekly review and rollback strategy.

Max Tool Calls from History

Limits tool calls in context. Set to 0 (disabled) for most cases. Enable only when hitting token limits.

Session Summaries

Generates metadata for monitoring/observability dashboards. Does NOT affect context window size.

Tool Calls Compression

Compresses verbose tool outputs after N calls. Set threshold to 3-5 for tool-heavy agents.

Usage

Memory settings from Workbench are applied automatically.
from xpander_sdk import Backend, Configuration
from agno.agent import Agent

backend = Backend(configuration=Configuration(api_key="<your-key>"))
agent = Agent(**backend.get_args(agent_id="<agent-id>"))

agent.run(
    "Your message",
    user_id="user@example.com",     # User memories
    session_id="thread-123"          # Session history (thread)
)
Multi-user threads: Multiple users can share the same session_id (e.g., support tickets). Each user keeps their own memories, but sees the same thread history.

Debug Logs

Enable debug mode to see memory behavior:
agent.debug_mode = True
You’ll see:
DEBUG Added tool update_user_memory
DEBUG Getting messages from previous runs: 6
DEBUG Adding 6 messages from history

Troubleshooting

IssueFix
Agent doesn’t remember previous messagesPass same session_id for all messages. Increase history runs to 3+.
User memories not workingPass user_id consistently. Enable User Memories toggle.
Hitting token limitsReduce history runs, enable tool compression, or manage memory programmatically.