Examples
- Examples
- Getting Started
- Agents
- Teams
- Workflows
- Applications
- Streamlit Apps
- Evals
Agent Concepts
- Reasoning
- Multimodal
- RAG
- User Control Flows
- Knowledge
- Memory
- Built-in Memory
- Standalone Memory Operations
- Persistent Memory with SQLite
- Custom Memory Creation
- Memory Search
- Agent With Memory
- Agentic Memory
- Agent with Session Summaries
- Multiple Agents Sharing Memory
- Custom Memory
- Multi-User Multi-Session Chat
- Multi-User Multi-Session Chat Concurrent
- Memory References
- Session Summary References
- Mem0 Memory
- DB
- Async
- Hybrid Search
- Storage
- Tools
- Vector Databases
- Context
- Embedders
- Agent State
- Observability
- Miscellaneous
Models
- Anthropic
- AWS Bedrock
- AWS Bedrock Claude
- Azure AI Foundry
- Azure OpenAI
- Cerebras
- Cerebras OpenAI
- Cohere
- DeepInfra
- DeepSeek
- Fireworks
- Gemini
- Groq
- Hugging Face
- IBM
- LM Studio
- LiteLLM
- LiteLLM OpenAI
- Meta
- Mistral
- NVIDIA
- Ollama
- OpenAI
- Perplexity
- Together
- XAI
- Vercel
Memory
Session Summary References
This example shows how to use the add_session_summary_references
parameter in the Agent config to
add references to the session summaries to the Agent.
Code
from agno.agent.agent import Agent
from agno.memory.v2.db.postgres import PostgresMemoryDb
from agno.memory.v2.memory import Memory
from agno.models.google.gemini import Gemini
from agno.storage.postgres import PostgresStorage
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
memory_db = PostgresMemoryDb(table_name="memory", db_url=db_url)
# Reset for this example
memory_db.clear()
memory = Memory(db=memory_db)
user_id = "john_doe@example.com"
session_id = "session_summaries"
agent = Agent(
model=Gemini(id="gemini-2.0-flash-exp"),
memory=memory,
storage=PostgresStorage(table_name="agent_sessions", db_url=db_url),
enable_session_summaries=True,
session_id=session_id,
)
# This will create a new session summary
agent.print_response(
"My name is John Doe and I like to hike in the mountains on weekends.",
user_id=user_id,
)
# You can use existing session summaries from session storage without creating or updating any new ones.
agent = Agent(
model=Gemini(id="gemini-2.0-flash-exp"),
memory=memory,
storage=PostgresStorage(table_name="agent_sessions", db_url=db_url),
add_session_summary_references=True,
session_id=session_id,
)
agent.print_response("What are my hobbies?", user_id=user_id)
Usage
1
Create a virtual environment
Open the Terminal
and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2
Install libraries
pip install -U agno
3
Run Example
python 13_session_summary_references.py
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.