Tool Integration
Patterns for giving agents access to external tools, APIs, and functions.
Define Python functions as tools.
from agno import Agent
def get_weather(location: str) -> dict:
"""Get weather for a location."""
# Implementation
return {"temp": 72, "condition": "sunny"}
agent = Agent(
model=OpenAI(id="gpt-4o"),
tools=[get_weather],
show_tool_calls=True
)
Use pre-built tools from frameworks.
from agno.tools import DuckDuckGoTools, FileTools
agent = Agent(
tools=[DuckDuckGoTools(), FileTools()]
)
Integrate external services.
from langchain.tools import TavilySearchResults
from langchain.agents import initialize_agent
search = TavilySearchResults(api_key=api_key)
agent = initialize_agent(
tools=[search],
llm=llm,
agent_type="openai-functions"
)
Model Context Protocol for standardized tool access.
from agno.tools.mcp import MCPTools
# GitHub MCP
github_mcp = MCPTools(
server_script="npx",
server_args=["-y", "@modelcontextprotocol/server-github"],
env={"GITHUB_PERSONAL_ACCESS_TOKEN": token}
)
agent = Agent(tools=[github_mcp])
Tool name for agent to reference
Clear description of what tool does and when to use it
JSON schema of tool parameters
MCP Agents
Learn about MCP integrations
Framework Guides
Framework-specific tool patterns