Memory Integration
Chat automatically manages conversation memory through the Memory system. It handles conversation history, summarization, and user profiles.Memory Features
Chat integrates with Memory to provide:- Full Session Memory: Complete conversation history stored in
InteractionSession.chat_history - Summary Memory: Automatic conversation summarization (requires model configuration)
- User Analysis Memory: User profile tracking and analysis (requires model configuration)
Basic Memory Usage
Advanced Memory Configuration
summary_memory and user_analysis_memory require the agent’s model to be configured. They use agent.model for LLM-based summarization and user trait extraction.
Memory with Custom Storage
User Profile Schema
Use a custom Pydantic model for structured user profiles:Dynamic Profile Schema
Enable automatic schema generation from conversations:dynamic_user_profile=True, the system automatically identifies 2-5 relevant traits from conversations and creates a dynamic schema. This is useful when you don’t know the user profile structure in advance.
Note: If both dynamic_user_profile=True and user_profile_schema are provided, the dynamic schema takes precedence.
Memory Modes
update: Incrementally update user profiles, merging new traits with existing ones (default)replace: Replace user profiles completely on each update
Limiting Message History
Thenum_last_messages parameter limits conversation history to the last N message pairs (request-response pairs):
Tool Call Filtering
By default, tool calls are excluded from memory. Enable them withfeed_tool_call_results:
False (default), tool-related messages are filtered from chat_history to keep memory focused on user interactions.
