Skip to main content
Tools extend agents with capabilities to interact with external systems, APIs, and services. Agno provides built-in tools and makes it easy to create custom ones.
from agno.agent import Agent
from agno.tools import tool

@tool
def get_weather(city: str) -> str:
    """Get current weather for a city."""
    return f"Weather in {city}: 72°F, sunny"

agent = Agent(tools=[get_weather])
agent.print_response("What's the weather in San Francisco?")

Tool Categories

Quick Examples

Using Built-in Tools

from agno.agent import Agent
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.yfinance import YFinanceTools

agent = Agent(
    tools=[
        DuckDuckGoTools(),
        YFinanceTools(stock_price=True, analyst_recommendations=True),
    ],
)

agent.print_response("What's NVDA's stock price and recent news?")

Creating Custom Tools

cookbook/90_tools/tool_decorator/tool_decorator.py
from agno.agent import Agent
from agno.tools import tool

@tool(show_result=True)
def calculate_bmi(weight_kg: float, height_m: float) -> float:
    """Calculate Body Mass Index."""
    return weight_kg / (height_m ** 2)

agent = Agent(tools=[calculate_bmi])
agent.print_response("Calculate BMI for someone who is 70kg and 1.75m tall")

Using MCP Servers

cookbook/90_tools/mcp/filesystem.py
import asyncio
from agno.agent import Agent
from agno.tools.mcp import MCPTools

async def main():
    async with MCPTools("npx -y @modelcontextprotocol/server-filesystem .") as mcp:
        agent = Agent(tools=[mcp])
        await agent.aprint_response("What files are in the current directory?")

asyncio.run(main())

Run Examples

git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/90_tools

# Custom tools
python tool_decorator/tool_decorator.py

# MCP
python mcp/filesystem.py

# Tool hooks
python tool_hooks/pre_and_post_hooks.py