ReasoningTools ツールキットはエージェントが実行中に、他のツールのように推論を使用できるようにします。開始時に一度だけ推論して固定的な計画を作成する従来のアプローチとは違い、これはエージェントが各ステップの後に省みて、思考を調整し、そして即座にアクションを更新することを可能にします。
Agno : ユーザガイド : コンセプト : ツール – 推論ツール
作成 : クラスキャット・セールスインフォメーション
作成日時 : 08/10/2025
バージョン : Agno 1.7.7
* 本記事は docs.agno.com の以下のページを独自に翻訳した上で、補足説明を加えてまとめ直しています :
* サンプルコードの動作確認はしておりますが、必要な場合には適宜、追加改変しています。
* ご自由にリンクを張って頂いてかまいませんが、sales-info@classcat.com までご一報いただけると嬉しいです。
◆ お問合せ : 下記までお願いします。
- クラスキャット セールス・インフォメーション
- sales-info@classcat.com
- ClassCatJP
Agno ユーザガイド : コンセプト : ツール – 推論ツール
ReasoningTools ツールキットはエージェントが実行中の任意の時点で、他のツールのように、推論を使用できるようにします。開始時に一度だけ推論して固定的な計画を作成する従来のアプローチとは違い、これはエージェントが各ステップの後に省みて (reflect)、思考を調整し、そして即座にアクションを更新することを可能にします。
このアプローチは、(そうでないなら処理に失敗するような) 複雑な問題を解決するエージェントの能力を大幅に向上させることを私たちは見出しました。エージェントにそのアクションについて「考える」余地を与えることで、自身のレスポンスをより深く検証し、その仮定に疑問を持ち、様々な角度から問題にアプローチできます。
ツールキットは以下のツールを含みます :
- think : このツールは、質問について推論し、段階的に作業するために、エージェントにより推論用の一時メモ (scratchpad) として使用されます。複雑な問題をより小さい、管理しやすいチャンクに分解して推論プロセスを追跡するのに役立ちます。
- analyze : このツールは、推論ステップの結果を分析して次のアクションを決定するために使用されます。
例
ReasoningTools ツールキットの使用方法の例が以下です :
from agno.agent import Agent
from agno.models.anthropic import Claude
from agno.tools.reasoning import ReasoningTools
from agno.tools.yfinance import YFinanceTools
thinking_agent = Agent(
model=Claude(id="claude-3-7-sonnet-latest"),
tools=[
ReasoningTools(add_instructions=True),
YFinanceTools(
stock_price=True,
analyst_recommendations=True,
company_info=True,
company_news=True,
),
],
instructions="Use tables where possible",
show_tool_calls=True,
markdown=True,
)
thinking_agent.print_response("Write a report comparing NVDA to TSLA", stream=True)
ツールキットは、エージェントがツールを効果的に使用するのを支援するためにデフォルトの指示と few-shot サンプルを備えています。それらを有効にする方法は :
reasoning_agent = Agent(
model=Claude(id="claude-3-7-sonnet-latest"),
tools=[
ReasoningTools(
think=True,
analyze=True,
add_instructions=True,
add_few_shot=True,
),
],
)
ReasoningTools は関数呼び出しをサポートする任意のモデルプロバイダーで使用できます。OpenAIChat を使用した推論エージェントの例が以下です :
from textwrap import dedent
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.reasoning import ReasoningTools
reasoning_agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[ReasoningTools(add_instructions=True)],
instructions=dedent("""\
You are an expert problem-solving assistant with strong analytical skills! 🧠
Your approach to problems:
1. First, break down complex questions into component parts
2. Clearly state your assumptions
3. Develop a structured reasoning path
4. Consider multiple perspectives
5. Evaluate evidence and counter-arguments
6. Draw well-justified conclusions
When solving problems:
- Use explicit step-by-step reasoning
- Identify key variables and constraints
- Explore alternative scenarios
- Highlight areas of uncertainty
- Explain your thought process clearly
- Consider both short and long-term implications
- Evaluate trade-offs explicitly
For quantitative problems:
- Show your calculations
- Explain the significance of numbers
- Consider confidence intervals when appropriate
- Identify source data reliability
For qualitative reasoning:
- Assess how different factors interact
- Consider psychological and social dynamics
- Evaluate practical constraints
- Address value considerations
\
"""),
add_datetime_to_instructions=True,
stream_intermediate_steps=True,
show_tool_calls=True,
markdown=True,
)
このエージェントは次のように、思慮深い分析を引き出す質問をするために使用できます :
reasoning_agent.print_response(
"A startup has $500,000 in funding and needs to decide between spending it on marketing or "
"product development. They want to maximize growth and user acquisition within 12 months. "
"What factors should they consider and how should they analyze this decision?",
stream=True
)
or
reasoning_agent.print_response(
"Solve this logic puzzle: A man has to take a fox, a chicken, and a sack of grain across a river. "
"The boat is only big enough for the man and one item. If left unattended together, the fox will "
"eat the chicken, and the chicken will eat the grain. How can the man get everything across safely?",
stream=True,
)
以上