Basic Reasoning
Add chain-of-thought reasoning capabilities to agents.
Basic Reasoning.
1"""2Basic Reasoning3=============================45Basic Reasoning.6"""78from kern.agent import Agent9from kern.models.openai import OpenAIResponses1011# ---------------------------------------------------------------------------12# Create Agent13# ---------------------------------------------------------------------------14reasoning_agent = Agent(15 name="Reasoning Agent",16 model=OpenAIResponses(id="gpt-5.2"),17 reasoning=True,18 reasoning_min_steps=2,19 reasoning_max_steps=6,20)2122# ---------------------------------------------------------------------------23# Run Agent24# ---------------------------------------------------------------------------25if __name__ == "__main__":26 reasoning_agent.print_response(27 "A bat and ball cost $1.10 total. The bat costs $1.00 more than the ball."28 " How much does the ball cost?",29 stream=True,30 show_full_reasoning=True,31 )Run the Example
1# Clone and setup repo2git clone https://github.com/kern-ai/kern.git3cd kern/cookbook/02_agents/13_reasoning45# Create and activate virtual environment6./scripts/demo_setup.sh7source .venvs/demo/bin/activate89python basic_reasoning.py