1"""Run `uv pip install sqlalchemy openai` to install dependencies."""
2
3from kern.agent import Agent
4from kern.db.postgres import PostgresDb
5from kern.models.openai import OpenAIResponses
6from kern.tools.hackernews import HackerNewsTools
7
8# Setup the database
9db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
10db = PostgresDb(db_url=db_url)
11
12agent = Agent(
13 model=OpenAIResponses(id="gpt-5-mini"),
14 db=db,
15 tools=[HackerNewsTools()],
16 add_history_to_context=True,
17)
18agent.print_response("How many people live in Canada?")
19agent.print_response("What is their national anthem called?")