from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.learn import LearningMachine
from agno.models.openai import OpenAIResponses
agent = Agent(
model=OpenAIResponses(id="gpt-5.2"),
db=PostgresDb(db_url="postgresql+psycopg://ai:ai@localhost:5532/ai"),
learning=LearningMachine(user_memory=True),
)
# Session 1: Share preferences
agent.print_response(
"I prefer code examples over explanations. Also, I'm working on a machine learning project.",
user_id="alice@example.com",
session_id="session_1",
)
# Session 2: Memory is recalled
agent.print_response(
"Explain async/await in Python",
user_id="alice@example.com",
session_id="session_2",
)