Documentation Index
Fetch the complete documentation index at: https://docs-v1.agno.com/llms.txt
Use this file to discover all available pages before exploring further.
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
Create a virtual environment
Open the Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Run Example
python 13_session_summary_references.py