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_profile=True),
)
# Session 1: Share information
agent.print_response(
"Hi! I'm Alice Chen, but please call me Ali.",
user_id="alice@example.com",
session_id="session_1",
)
# Session 2: Profile is recalled automatically
agent.print_response(
"What's my name?",
user_id="alice@example.com",
session_id="session_2",
)