from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.openai import OpenAIResponses
db = PostgresDb(db_url="postgresql+psycopg://ai:ai@localhost:5532/ai")
agent = Agent(
model=OpenAIResponses(id="gpt-5.5"),
db=db,
add_history_to_context=True,
num_history_runs=5,
enable_agentic_memory=True,
)
agent.run(
"My name is Sarah and I prefer email over phone.",
user_id="sarah@acme.com",
session_id="thread-42",
)
reply = agent.run(
"What's the best way to reach me?",
user_id="sarah@acme.com",
session_id="thread-42",
).content
# Uses both the thread history and the stored memory about Sarah.