Basic Agent

Quickstart

1from kern.agent import Agent
2from kern.models.openai import OpenAIResponses
3
4# ---------------------------------------------------------------------------
5# Create Agent
6# ---------------------------------------------------------------------------
7agent = Agent(
8 name="Quickstart Agent",
9 model=OpenAIResponses(id="gpt-5.2"),
10)
11
12# ---------------------------------------------------------------------------
13# Run Agent
14# ---------------------------------------------------------------------------
15if __name__ == "__main__":
16 agent.print_response(
17 "Say hello and introduce yourself in one sentence.", stream=True
18 )

Run the Example

1# Clone and setup repo
2git clone https://github.com/kern-ai/kern.git
3cd kern/cookbook/02_agents/01_quickstart
4
5# Create and activate virtual environment
6./scripts/demo_setup.sh
7source .venvs/demo/bin/activate
8
9python basic_agent.py