Reasoning
ReasoningTools provides step-by-step reasoning capabilities for agents to think through complex problems systematically.
Example
The following agent can use structured reasoning to solve complex problems:
1from kern.agent import Agent2from kern.tools.reasoning import ReasoningTools34agent = Agent(5 instructions=[6 "You are a logical reasoning assistant that breaks down complex problems",7 "Use step-by-step thinking to analyze situations thoroughly",8 "Apply structured reasoning to reach well-founded conclusions",9 "Show your reasoning process clearly to help users understand your logic",10 ],11 tools=[ReasoningTools()],12)1314agent.print_response("Analyze the pros and cons of remote work for software developers", stream=True)Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
enable_think | bool | True | Enable the think reasoning function. |
enable_analyze | bool | True | Enable the analyze reasoning function. |
instructions | Optional[str] | None | Custom instructions for reasoning behavior. |
add_instructions | bool | False | Whether to add instructions to the agent. |
add_few_shot | bool | False | Whether to include few-shot examples. |
few_shot_examples | Optional[str] | None | Custom few-shot examples for reasoning. |
Toolkit Functions
| Function | Description |
|---|---|
think | Perform step-by-step reasoning about a problem or situation. |
analyze | Conduct detailed analysis with structured reasoning steps. |