Agent to think through a problem step-by-step before jumping into a response. The Agent works through different ideas, validating and correcting as needed. Once it reaches a final answer, it will validate and provide a response. Let’s give it a try. Create a file reasoning_agent.py
reasoning_agent.py
How to use reasoning
To add reasoning, setreasoning=True. When using reasoning with tools, do not use structured_outputs=True as gpt-4o cannot use tools with structured outputs.
Reasoning with tools
You can also use tools with a reasoning agent, but do not usestructured_outputs=True as gpt-4o cannot use tools with structured outputs. Lets create a finance agent that can reason.
finance_reasoning.py
More reasoning examples
Logical puzzles
logical_puzzle.py
Mathematical proofs
mathematical_proof.py
Scientific research
scientific_research.py
Ethical dilemma
ethical_dilemma.py
Planning an itinerary
planning_itinerary.py
Creative writing
creative_writing.py