Instructions

Manage agent instructions and context.

Instructions.

1"""
2Instructions
3=============================
4
5Instructions.
6"""
7
8from kern.agent import Agent
9from kern.models.openai import OpenAIResponses
10
11# ---------------------------------------------------------------------------
12# Create Agent
13# ---------------------------------------------------------------------------
14agent = Agent(
15 model=OpenAIResponses(id="gpt-5.2"),
16 add_datetime_to_context=True,
17 timezone_identifier="Etc/UTC",
18)
19
20# ---------------------------------------------------------------------------
21# Run Agent
22# ---------------------------------------------------------------------------
23if __name__ == "__main__":
24 agent.print_response(
25 "What is the current date and time? What is the current time in NYC?"
26 )

Run the Example

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