# Agno Reasoning — Built-In Step-by-Step Tool Use > Agno Reasoning gives any Agent built-in chain-of-thought + tool use. Set reasoning=True; the agent plans, calls tools, returns answers with audit. ## Install Copy the content below into your project: ## Quick Use 1. `pip install agno anthropic duckduckgo-search` 2. Create an Agent with `reasoning=True` plus tools 3. Call `agent.print_response(query, show_full_reasoning=True)` to see each step --- ## Intro Agno Reasoning is the built-in chain-of-thought + tool-use loop. Set `reasoning=True` on any Agno Agent — internally Agno runs a plan-act-reflect cycle, calls tools, and returns the final answer plus an audit trail of every step. Best for: production agents where you need explainable answers, not just outputs. Works with: Agno 1.0+, any LLM via LiteLLM. Setup time: 1 minute. --- ### Enable reasoning ```python 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, # take at least 3 reasoning steps reasoning_max_steps=10, # cap to prevent runaway 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, ) ``` The output shows each reasoning step: ``` [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 ``` ### When to enable reasoning vs leave it off | Use reasoning | Skip reasoning | |---|---| | Multi-step research, math, planning | One-shot Q&A | | Tool-use over 3+ tools | Fixed prompt template | | Debugging "why did the agent answer X" | Latency-critical chat | | Compliance / audit needed | Latency < 1s required | Reasoning adds ~2-10x to runtime depending on `reasoning_max_steps`, so enable selectively per task class. --- ### FAQ **Q: Is Agno free?** A: Yes — Agno is open-source under MPL-2.0. The framework, Agents, Reasoning, Memory, Knowledge are all free. Agno Cloud (managed monitoring) is paid. **Q: Reasoning vs OpenAI o1 — what's the difference?** A: o1 is a reasoning model with hidden CoT. Agno Reasoning is a framework feature that wraps any model in an explicit reasoning loop with tool use. You can layer them: use o1 as the model AND enable Agno Reasoning for tool orchestration. **Q: How does this differ from Agno's plain Agent?** A: A plain Agent calls tools when the model decides. Reasoning forces a structured plan-act-reflect cycle with min_steps and max_steps you control — better for traceability, slightly higher latency. --- ## Source & Thanks > Built by [Agno](https://github.com/agno-agi). Licensed under MPL-2.0. > > [agno-agi/agno](https://github.com/agno-agi/agno) — ⭐ 22,000+ --- ## 快速使用 1. `pip install agno anthropic duckduckgo-search` 2. 创建 Agent,设 `reasoning=True` 加工具 3. 调 `agent.print_response(query, show_full_reasoning=True)` 看每一步 --- ## 简介 Agno Reasoning 是内置的 chain-of-thought + 工具使用循环。任意 Agno Agent 上设 `reasoning=True` —— 内部跑「规划-执行-反思」循环、调工具、返回最终答案 + 完整步骤审计。适合需要可解释答案而不只是输出的生产 agent。需要 Agno 1.0+,任意 LLM(走 LiteLLM)。装机时间 1 分钟。 --- ### 开启 reasoning ```python 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 你控制 —— 可追踪性更好,延迟略高。 --- ## 来源与感谢 > Built by [Agno](https://github.com/agno-agi). Licensed under MPL-2.0. > > [agno-agi/agno](https://github.com/agno-agi/agno) — ⭐ 22,000+ --- Source: https://tokrepo.com/en/workflows/agno-reasoning-built-in-step-by-step-tool-use Author: Agno