Agent with Instructions

Quickstart

1from kern.agent import Agent
2from kern.models.openai import OpenAIResponses
3
4# ---------------------------------------------------------------------------
5# Agent Instructions
6# ---------------------------------------------------------------------------
7instructions = """\
8You are a concise assistant.
9Answer with exactly 3 bullet points when possible.\
10"""
11
12# ---------------------------------------------------------------------------
13# Create Agent
14# ---------------------------------------------------------------------------
15agent = Agent(
16 name="Instruction-Tuned Agent",
17 model=OpenAIResponses(id="gpt-5.2"),
18 instructions=instructions,
19)
20
21# ---------------------------------------------------------------------------
22# Run Agent
23# ---------------------------------------------------------------------------
24if __name__ == "__main__":
25 agent.print_response("How can I improve my Python debugging workflow?", stream=True)

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 agent_with_instructions.py