Skip to main content

Introduction

This guide covers the most commonly used built-in tools in Agno. Each section includes real code examples and usage patterns.

Financial Data: YFinanceTools

Access stock market data, company information, and financial metrics from Yahoo Finance.

Installation

pip install yfinance

Basic Usage

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

agent = Agent(
    tools=[YFinanceTools()],
    instructions="You are a financial analyst.",
    markdown=True
)

agent.print_response("What is the current price of NVDA?")

Selective Functions

Enable only the functions you need:
# Only basic stock information
tools = YFinanceTools(
    enable_stock_price=True,
    enable_company_info=True,
    enable_historical_prices=True,
)

# All financial analysis functions
tools = YFinanceTools(all=True)

# Custom combination
tools = YFinanceTools(
    enable_stock_price=True,
    enable_analyst_recommendations=True,
    enable_company_news=True,
)

Available Functions

get_current_stock_price
function
Get the current stock price for a symbolParameters:
  • symbol (str): Stock ticker symbol (e.g., “NVDA”)
get_company_info
function
Get company profile and overviewParameters:
  • symbol (str): Stock ticker symbol
get_historical_stock_prices
function
Get historical price dataParameters:
  • symbol (str): Stock ticker symbol
  • period (str): Time period (1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max)
  • interval (str): Data interval (1d, 5d, 1wk, 1mo, 3mo)
get_stock_fundamentals
function
Get fundamental financial data
get_analyst_recommendations
function
Get analyst ratings and recommendations
get_company_news
function
Get recent company newsParameters:
  • symbol (str): Stock ticker symbol
  • num_stories (int): Number of stories to return

Complete Example

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

# Create agent with full financial capabilities
agent = Agent(
    tools=[YFinanceTools(all=True)],
    description="You are a comprehensive investment analyst.",
    instructions=[
        "Use any financial function for investment analysis",
        "Format responses using markdown and tables",
        "Provide detailed analysis and insights",
        "Include relevant financial metrics",
    ],
    markdown=True,
)

agent.print_response(
    "Provide a comprehensive analysis of TSLA including price, "
    "fundamentals, and analyst views",
    markdown=True
)

Web Search: DuckDuckGoTools

Perform web searches and news searches using DuckDuckGo.

Installation

pip install duckduckgo-search

Basic Usage

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

agent = Agent(
    tools=[DuckDuckGoTools()],
    instructions="Search the web for information."
)

agent.print_response("What are the latest developments in AI?")

Configuration Options

from agno.tools.duckduckgo import DuckDuckGoTools

tools = DuckDuckGoTools(
    enable_search=True,      # Enable web search
    enable_news=True,        # Enable news search
    fixed_max_results=5,     # Limit results
    timelimit="w",          # Time limit: d, w, m, y
    region="us-en",         # Region code
    timeout=10,             # Request timeout
)

Available Functions

Search the web using DuckDuckGoParameters:
  • query (str): Search query
  • max_results (int): Maximum number of results
search_news
function
Search for news articlesParameters:
  • query (str): Search query
  • max_results (int): Maximum number of results

GitHub Integration: GithubTools

Manage repositories, pull requests, issues, and more on GitHub.

Installation

pip install pygithub

Basic Usage

from agno.agent import Agent
from agno.tools.github import GithubTools
import os

agent = Agent(
    tools=[GithubTools(access_token=os.getenv("GITHUB_ACCESS_TOKEN"))],
    instructions="You can interact with GitHub repositories."
)

agent.print_response("Search for Python ML repositories with over 1000 stars")

Key Functions

search_repositories
function
Search for repositories on GitHubParameters:
  • query (str): Search query (e.g., “language:python stars:>1000”)
  • sort (str): Sort by “stars”, “forks”, or “updated”
  • order (str): “asc” or “desc”
  • page (int): Page number
  • per_page (int): Results per page (max 100)
get_repository
function
Get details of a specific repositoryParameters:
  • repo_name (str): Full repository name (e.g., “owner/repo”)
create_issue
function
Create an issue in a repositoryParameters:
  • repo_name (str): Repository name
  • title (str): Issue title
  • body (str): Issue description
get_pull_request
function
Get details of a pull requestParameters:
  • repo_name (str): Repository name
  • pr_number (int): PR number
create_pull_request
function
Create a new pull requestParameters:
  • repo_name (str): Repository name
  • title (str): PR title
  • body (str): PR description
  • head (str): Source branch
  • base (str): Target branch

Complete Example

from agno.agent import Agent
from agno.tools.github import GithubTools
import os

# Create agent with GitHub access
agent = Agent(
    tools=[GithubTools(
        access_token=os.getenv("GITHUB_ACCESS_TOKEN"),
        # Optional: filter available tools
        include_tools=[
            "search_repositories",
            "get_repository",
            "create_issue",
            "get_pull_request",
        ]
    )],
    instructions=[
        "Help users interact with GitHub repositories",
        "Always confirm before creating issues or PRs",
        "Provide clear summaries of repository information",
    ],
    markdown=True,
)

agent.print_response(
    "Find the top 5 Python web frameworks on GitHub and "
    "summarize their features"
)

Web Scraping: FirecrawlTools

Extract content from websites with AI-powered scraping.

Installation

pip install firecrawl-py

Basic Usage

from agno.agent import Agent
from agno.tools.firecrawl import FirecrawlTools
import os

agent = Agent(
    tools=[FirecrawlTools(api_key=os.getenv("FIRECRAWL_API_KEY"))],
    instructions="Extract and summarize web content."
)

agent.print_response("Scrape https://example.com and summarize the content")

Database: PostgresTools

Execute SQL queries and manage PostgreSQL databases.

Installation

pip install psycopg[binary] sqlalchemy

Basic Usage

from agno.agent import Agent
from agno.tools.postgres import PostgresTools

# Database connection
db_url = "postgresql+psycopg://user:password@localhost:5432/mydb"

agent = Agent(
    tools=[PostgresTools(db_url=db_url)],
    instructions="You can query the database.",
    markdown=True
)

agent.print_response("Show me the top 10 customers by revenue")

Available Functions

run_query
function
Execute a SELECT queryParameters:
  • query (str): SQL SELECT statement
describe_table
function
Get table schema informationParameters:
  • table_name (str): Name of the table
list_tables
function
List all tables in the database

Slack Integration: SlackTools

Send messages, manage channels, and interact with Slack workspaces.

Installation

pip install slack-sdk

Basic Usage

from agno.agent import Agent
from agno.tools.slack import SlackTools
import os

agent = Agent(
    tools=[SlackTools(token=os.getenv("SLACK_BOT_TOKEN"))],
    instructions="You can send messages to Slack."
)

agent.print_response("Send a summary of today's tasks to #general")

Knowledge Base: KnowledgeTools

Access RAG (Retrieval Augmented Generation) knowledge bases.

Basic Usage

from agno.agent import Agent
from agno.knowledge.pdf import PDFKnowledgeBase
from agno.vectordb.pgvector import PgVector
from agno.tools.knowledge import KnowledgeTools

# Create knowledge base
knowledge = PDFKnowledgeBase(
    path="data/pdfs",
    vector_db=PgVector(
        table_name="pdf_documents",
        db_url="postgresql+psycopg://localhost:5432/ai"
    )
)

# Create agent with knowledge access
agent = Agent(
    knowledge=knowledge,
    tools=[KnowledgeTools(knowledge_base=knowledge)],
    instructions="Use the knowledge base to answer questions.",
    search_knowledge=True,
)

agent.print_response("What does the documentation say about deployment?")

Python Code Execution: PythonTools

Execute Python code safely in a controlled environment.

Installation

pip install pandas matplotlib

Basic Usage

from agno.agent import Agent
from agno.tools.python import PythonTools

agent = Agent(
    tools=[PythonTools()],
    instructions="You can write and execute Python code.",
    markdown=True
)

agent.print_response(
    "Create a bar chart showing monthly sales: "
    "Jan:10000, Feb:12000, Mar:15000, Apr:11000"
)

Available Functions

run_python_code
function
Execute Python codeParameters:
  • code (str): Python code to execute
  • pip_packages (list): Packages to install before execution

Shell Commands: ShellTools

Execute shell commands in a controlled environment.

Basic Usage

from agno.agent import Agent
from agno.tools.shell import ShellTools

agent = Agent(
    tools=[ShellTools()],
    instructions="You can run shell commands."
)

agent.print_response("List all Python files in the current directory")
Be cautious when using ShellTools. Only use with trusted inputs and consider security implications.

API Integration: APITools

Make HTTP requests to any REST API.

Basic Usage

from agno.agent import Agent
from agno.tools.api import APITools

agent = Agent(
    tools=[APITools()],
    instructions="You can make API requests."
)

agent.print_response("Get data from https://api.github.com/users/octocat")

Next Steps

Custom Tools

Learn how to create your own custom tools

MCP Integration

Connect to Model Context Protocol servers

Tool Cookbook

See 100+ real-world examples in the cookbook

Tools Overview

Browse all 100+ available tools

Build docs developers (and LLMs) love