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.
from agno.agent.agent import Agentfrom agno.memory.v2.db.postgres import PostgresMemoryDbfrom agno.memory.v2.memory import Memoryfrom agno.models.google.gemini import Geminifrom agno.storage.postgres import PostgresStoragedb_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"memory_db = PostgresMemoryDb(table_name="memory", db_url=db_url)# Reset for this examplememory_db.clear()memory = Memory(db=memory_db)user_id = "[email protected]"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 summaryagent.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)