Skip to main content

Scenario

A customer support agent that:
  • Remembers conversation context within a session
  • Learns about customers across sessions
  • Provides personalized support based on user profile

Complete Implementation

Cross-Session Memory

Same customer returns in a new session:

Token-Efficient Mode

Save everything but only inject summaries and user profiles to reduce token usage:

Async Usage

What Gets Persisted

Session Table

FieldContent
session_id"support_001"
user_id"customer_123"
messagesFull conversation history
summaryGenerated session summary
runsIndividual run outputs

User Memory Table

FieldContent
user_id"customer_123"
user_memoryExtracted traits (login issues, communication style)

Key Takeaways

  1. Same storage, different sessions - User profile persists across sessions
  2. Memory is automatic - Just attach to agent, no manual saving needed
  3. Summary + History - Use both for best context/cost balance
  4. Save/Load separation - Save everything, inject only what’s needed
  5. Sync and async - Both do() and do_async() work with memory