Copy
Ask AI
"""
Team With Agentic Memory
========================
Demonstrates team-level agentic memory creation and updates during runs.
"""
from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.openai import OpenAIResponses
from agno.team import Team
# ---------------------------------------------------------------------------
# Setup
# ---------------------------------------------------------------------------
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
db = PostgresDb(db_url=db_url)
john_doe_id = "[email protected]"
# ---------------------------------------------------------------------------
# Create Members
# ---------------------------------------------------------------------------
agent = Agent(
model=OpenAIResponses(id="gpt-5.2-mini"),
)
# ---------------------------------------------------------------------------
# Create Team
# ---------------------------------------------------------------------------
team = Team(
model=OpenAIResponses(id="gpt-5.2-mini"),
members=[agent],
db=db,
enable_agentic_memory=True,
)
# ---------------------------------------------------------------------------
# Run Team
# ---------------------------------------------------------------------------
if __name__ == "__main__":
team.print_response(
"My name is John Doe and I like to hike in the mountains on weekends.",
stream=True,
user_id=john_doe_id,
)
team.print_response("What are my hobbies?", stream=True, user_id=john_doe_id)
Run the Example
Copy
Ask AI
# Clone and setup repo
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/03_teams/memory
# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate
python 02_team_with_agentic_memory.py