Skip to main content

Overview

Agno is a powerful Python framework for building AI agents that can use tools, manage workflows, and handle complex multi-stage tasks. It’s designed for both rapid prototyping and production deployments, with built-in support for memory, streaming, and agent orchestration.

When to Use Agno

  • Simple Agents: Build single-purpose agents with tool access quickly
  • Multi-Agent Workflows: Orchestrate multiple specialized agents in sequences
  • Production Apps: Deploy with Streamlit UI and built-in playground
  • Memory-Enabled Agents: Create agents that remember context across sessions
  • Research & Analysis: Build agents that search, analyze, and synthesize information

Installation

pip install agno

Additional Dependencies

# For web search capabilities
pip install agno[duckduckgo]

# For financial data tools
pip install agno[yfinance]

# For web scraping
pip install agno[scrapegraph]

# For HackerNews tools
pip install agno[hackernews]

Core Concepts

Agent

The Agent is the primary building block. It combines a language model, instructions, tools, and optional memory.
from agno.agent import Agent
from agno.models.nebius import Nebius
from agno.tools.yfinance import YFinanceTools
import os

agent = Agent(
    name="Finance Agent",
    model=Nebius(
        id="meta-llama/Llama-3.3-70B-Instruct",
        api_key=os.getenv("NEBIUS_API_KEY")
    ),
    tools=[YFinanceTools(stock_price=True, analyst_recommendations=True)],
    instructions=["Always use tables to display financial data"],
    show_tool_calls=True,
    markdown=True,
)

# Use the agent
response = agent.run("What's the current price of AAPL?")
print(response.content)

Models

Agno supports multiple model providers. Nebius is commonly used in the repository:
from agno.models.nebius import Nebius

# Common models from the repository
model = Nebius(
    id="deepseek-ai/DeepSeek-V3-0324",  # For complex reasoning
    # id="meta-llama/Llama-3.3-70B-Instruct",  # For general tasks
    # id="Qwen/Qwen3-235B-A22B",  # For research
    api_key=os.getenv("NEBIUS_API_KEY")
)

Tools

Tools give agents the ability to interact with external services and APIs.
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.yfinance import YFinanceTools
from agno.tools.hackernews import HackerNewsTools
from agno.tools.scrapegraph import ScrapeGraphTools

# Web search
search_tools = DuckDuckGoTools()

# Financial data
finance_tools = YFinanceTools(
    stock_price=True,
    analyst_recommendations=True,
    stock_fundamentals=True
)

# HackerNews
hn_tools = HackerNewsTools()

# Web scraping (requires API key)
scrape_tools = ScrapeGraphTools(
    api_key=os.getenv("SGAI_API_KEY")
)

Workflows

Workflows orchestrate multiple agents to handle complex, multi-stage tasks.
from agno.workflow import Workflow
from agno.agent import Agent
from agno.models.nebius import Nebius
from typing import Iterator
import os

class DeepResearcherAgent(Workflow):
    """
    A multi-stage research workflow:
    1. Searcher finds information
    2. Analyst synthesizes findings
    3. Writer produces final report
    """

    searcher: Agent = Agent(
        tools=[ScrapeGraphTools(api_key=os.getenv("SGAI_API_KEY"))],
        model=Nebius(
            id="deepseek-ai/DeepSeek-V3-0324",
            api_key=os.getenv("NEBIUS_API_KEY")
        ),
        description="Expert at finding high-quality information from the web",
        instructions=[
            "Search for recent and authoritative sources",
            "Extract key facts, statistics, and expert opinions",
            "Cover multiple perspectives",
        ],
    )

    analyst: Agent = Agent(
        model=Nebius(
            id="deepseek-ai/DeepSeek-V3-0324",
            api_key=os.getenv("NEBIUS_API_KEY")
        ),
        description="Critical thinker who synthesizes research findings",
        instructions=[
            "Identify key themes and trends",
            "Highlight important findings and implications",
            "Present analysis in structured format",
        ],
    )

    writer: Agent = Agent(
        model=Nebius(
            id="deepseek-ai/DeepSeek-V3-0324",
            api_key=os.getenv("NEBIUS_API_KEY")
        ),
        description="Professional technical writer",
        instructions=[
            "Write engaging introduction",
            "Organize findings with clear headings",
            "Conclude with actionable recommendations",
        ],
    )

    def run(self, topic: str) -> Iterator[RunResponse]:
        # Step 1: Research
        research_content = self.searcher.run(topic)
        
        # Step 2: Analysis
        analysis = self.analyst.run(research_content.content)
        
        # Step 3: Report Writing (with streaming)
        report = self.writer.run(analysis.content, stream=True)
        yield from report

# Usage
workflow = DeepResearcherAgent()
for chunk in workflow.run("Latest developments in AI agents"):
    print(chunk.content, end="")
Source: advance_ai_agents/deep_researcher_agent/agents.py:15-113

Common Patterns

Pattern 1: Simple Tool-Using Agent

Most projects follow this pattern for straightforward tasks:
from agno.agent import Agent
from agno.models.nebius import Nebius
from agno.tools.yfinance import YFinanceTools
from agno.tools.duckduckgo import DuckDuckGoTools
import os
from dotenv import load_dotenv

load_dotenv()

agent = Agent(
    name="Finance Agent",
    model=Nebius(
        id="meta-llama/Llama-3.3-70B-Instruct",
        api_key=os.getenv("NEBIUS_API_KEY")
    ),
    tools=[
        DuckDuckGoTools(),
        YFinanceTools(
            stock_price=True,
            analyst_recommendations=True,
            stock_fundamentals=True
        )
    ],
    instructions=["Always use tables to display financial data"],
    show_tool_calls=True,
    markdown=True,
)

# Interactive CLI
if __name__ == "__main__":
    while True:
        query = input("You: ")
        if query.lower() == 'exit':
            break
        agent.print_response(query)
Based on: simple_ai_agents/finance_agent/main.py:1-28

Pattern 2: Streamlit Playground UI

Add a web interface with built-in playground:
from agno.playground import Playground, serve_playground_app

# ... agent definition ...

# Create UI
app = Playground(agents=[agent]).get_app()

if __name__ == "__main__":
    serve_playground_app("main:app", reload=True)
Run with: python main.py or streamlit run app.py

Pattern 3: Multi-Stage Workflow

For complex tasks requiring multiple specialized agents:
1

Define Specialized Agents

Create agents for each stage (research, analysis, writing, etc.)
searcher = Agent(tools=[...], instructions=[...])
analyst = Agent(instructions=[...])
writer = Agent(instructions=[...])
2

Create Workflow Class

Inherit from Workflow and define agent attributes
class ResearchWorkflow(Workflow):
    searcher: Agent = ...
    analyst: Agent = ...
    writer: Agent = ...
3

Implement run() Method

Orchestrate agents by passing outputs between them
def run(self, topic: str):
    research = self.searcher.run(topic)
    analysis = self.analyst.run(research.content)
    report = self.writer.run(analysis.content)
    return report

Pattern 4: Streaming Responses

For real-time output in long-running tasks:
# Enable streaming in workflow
report = self.writer.run(analysis.content, stream=True)

# Iterate over chunks
for chunk in report:
    if chunk.content:
        print(chunk.content, end="", flush=True)

Real Examples from Repository

Tech News Analyst

HackerNews analysis agent with custom instructions and tool usage

Finance Agent

Stock analysis with YFinance and DuckDuckGo search

Deep Researcher

Multi-agent workflow: Search → Analyze → Write report

More Agno Examples

Explore all Agno-based agent examples

Configuration

Environment Variables

Create a .env file:
# Required
NEBIUS_API_KEY=your_nebius_api_key

# Optional (based on tools used)
SGAI_API_KEY=your_scrapegraph_api_key

Agent Parameters

name
string
default:"Agent"
Human-readable name for the agent
model
Model
required
Language model instance (e.g., Nebius())
tools
list[Tool]
default:"[]"
List of tools the agent can use
instructions
list[str]
default:"[]"
System instructions/prompts for the agent
description
string
Description of the agent’s purpose (used in workflows)
show_tool_calls
bool
default:"False"
Print tool calls to console for debugging
markdown
bool
default:"False"
Format output as markdown
memory
bool
default:"False"
Enable conversation memory

Best Practices

Be specific about what you want the agent to do:
instructions = [
    "Always use tables to display financial data",
    "For text data use bullet points",
    "Include sources for all statistics",
    "Be concise - maximum 2 paragraphs per section",
]
  • DeepSeek-V3: Complex reasoning, research, analysis
  • Llama-3.3-70B: General-purpose tasks, balanced performance
  • Qwen3-235B: Large-scale research and content generation
  • Qwen3-30B: Faster responses for simpler tasks
for chunk in agent.run(query, stream=True):
    if chunk.content:
        print(chunk.content, end="", flush=True)
Always check for chunk.content before processing.
Instead of prompting one agent to do everything:
  • Break into specialized agents (searcher, analyst, writer)
  • Pass outputs between stages
  • Each agent has focused instructions
  • Results in better quality and debugging

Troubleshooting

  • Ensure show_tool_calls=True to see what’s happening
  • Check tool docstrings are clear
  • Make instructions explicit about when to use tools
  • Verify API keys are set correctly
  • Set memory=True on the agent
  • Use same agent instance for multiple interactions
  • Don’t recreate the agent between calls
  • Verify outputs are passed correctly: self.agent1.run(input).content
  • Check each agent’s instructions are clear
  • Use logging to debug each stage

Next Steps

Explore Examples

Browse 20+ Agno examples in the repository:
  • starter_ai_agents/agno_starter/
  • simple_ai_agents/*/ (most use Agno)
  • advance_ai_agents/*/ (complex workflows)

Add Custom Tools

Create your own tools with the @tool decorator for specialized functionality

Build Workflows

Combine multiple agents for research, analysis, and content generation pipelines

Deploy with UI

Use the built-in Playground for instant web interface

Build docs developers (and LLMs) love