简介
Agno Reasoning 是内置的 chain-of-thought + 工具使用循环。任意 Agno Agent 上设 reasoning=True —— 内部跑「规划-执行-反思」循环、调工具、返回最终答案 + 完整步骤审计。适合需要可解释答案而不只是输出的生产 agent。需要 Agno 1.0+,任意 LLM(走 LiteLLM)。装机时间 1 分钟。
开启 reasoning
from agno.agent import Agent
from agno.models.anthropic import Claude
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.calculator import CalculatorTools
agent = Agent(
model=Claude(id="claude-3-5-sonnet-20241022"),
tools=[DuckDuckGoTools(), CalculatorTools()],
reasoning=True,
reasoning_min_steps=3, # 至少 3 个推理步
reasoning_max_steps=10, # 上限防失控
show_tool_calls=True,
markdown=True,
)
agent.print_response(
"Compare the energy density of LFP and NMC batteries in Wh/kg, then "
"calculate how many extra km a Tesla Model 3 with NMC vs LFP would get.",
show_full_reasoning=True,
)输出显示每一步推理:
[Step 1: Plan] I need: (1) energy density of LFP, (2) of NMC, (3) Model 3 weight, (4) calculation.
[Step 2: Search] DuckDuckGoTools(query="LFP battery energy density Wh/kg")
[Step 3: Search] DuckDuckGoTools(query="NMC battery energy density Wh/kg")
[Step 4: Calc] CalculatorTools(...)
[Step 5: Reflect] Numbers consistent. Producing final answer.
Final answer:
- LFP: ~150 Wh/kg
- NMC: ~250 Wh/kg
- Model 3 ~80 km extra range with NMC什么时候开 reasoning vs 关
| 开 reasoning | 不用 |
|---|---|
| 多步研究、数学、规划 | 一次性问答 |
| 用 3+ 个工具 | 固定 prompt 模板 |
| 排查"agent 为啥这么答" | 延迟敏感聊天 |
| 需要合规 / 审计 | 延迟 < 1s 必需 |
Reasoning 按 reasoning_max_steps 增加 ~2-10 倍运行时间,按任务类型选择性开启。
FAQ
Q: Agno 免费吗? A: 免费 —— MPL-2.0 开源。框架、Agent、Reasoning、记忆、知识全免费。Agno Cloud(托管监控)付费。
Q: Reasoning 跟 OpenAI o1 啥区别? A: o1 是推理模型,CoT 是隐藏的。Agno Reasoning 是框架特性,把任何模型包进显式推理循环 + 工具使用。可以叠加:用 o1 当模型 + 开 Agno Reasoning 做工具编排。
Q: 跟普通 Agent 啥区别? A: 普通 Agent 在模型决定时才调工具。Reasoning 强制结构化的「规划-执行-反思」循环,min_steps 和 max_steps 你控制 —— 可追踪性更好,延迟略高。