Debug

You can set the debug mode on the agent for all runs to have more verbose output.

Debug.

1"""
2Debug
3=============================
4
5Debug.
6"""
7
8from kern.agent import Agent
9from kern.models.openai import OpenAIResponses
10
11# You can set the debug mode on the agent for all runs to have more verbose output
12# ---------------------------------------------------------------------------
13# Create Agent
14# ---------------------------------------------------------------------------
15agent = Agent(
16 model=OpenAIResponses(id="gpt-5-mini"),
17 debug_mode=True,
18)
19
20# ---------------------------------------------------------------------------
21# Run Agent
22# ---------------------------------------------------------------------------
23if __name__ == "__main__":
24 agent.print_response(input="Tell me a joke.")
25
26 # You can also set the debug mode on a single run
27 agent = Agent(
28 model=OpenAIResponses(id="gpt-5-mini"),
29 )
30 agent.print_response(input="Tell me a joke.", debug_mode=True)

Run the Example

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