Agno

About

Agno is a lightweight library for building Agents (AI programs that operate autonomously). The core of an Agent is a model, tools and instructions. Agents also have memory, knowledge, storage and the ability to reason.

Developers use Agno to build Reasoning Agents, Multimodal Agents, Teams of Agents and Agentic Workflows. Agno also provides a beautiful UI to chat with your Agents, pre-built FastAPI routes to serve your Agents and tools to monitor and evaluate their performance.

Installation

pip install -U agno

How to Use AIML API with Agno

A user of the Agno can

from agno.models.aimlapi import AIMLApi

agent = Agent(
    model=AIMLApi(
        id="google/gemini-1.5-flash", 
        api_key="<YOUR_AIMLAPI_KEY>"
    ), 
    markdown=True, 
    telemetry=False, 
    monitoring=False
)
    
agent.print_response("Tell me, why is the sky blue in 2 sentences")
Response
β”Œβ”€ Message ───────────────────────────────────────────────────────────────────┐
β”‚                                                                             β”‚
β”‚ Tell me, why is the sky blue in 2 sentences                                 β”‚
β”‚                                                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€ Response (2.5s) ───────────────────────────────────────────────────────────┐
β”‚                                                                             β”‚
β”‚ The sky appears blue due to a phenomenon called Rayleigh scattering.  This  β”‚
β”‚ scattering effect preferentially disperses shorter wavelengths of light,    β”‚
β”‚ such as blue and violet, more than longer wavelengths like red and orange.  β”‚
β”‚                                                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Our Supported models

Supported features

  • Synchronous and asynchronous requests

  • Chain-of-thought reasoning

  • Built-in RAG and multimodal support

  • Collaborative agent workflows (Teams)

  • Access to built-in tools (DuckDuckGo, Docker, and many more)

Code Examples

Prerequisites

1. Create and activate a virtual environment

python3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activate

2. Export your AIMLAPI_API_KEY

export AIMLAPI_API_KEY=***

3. Install libraries

pip install -U openai duckduckgo-search duckdb yfinance agno

Stream mode

from agno.agent import Agent, RunResponse  # noqa
from agno.models.aimlapi import AIMLApi

agent = Agent(model=AIMLApi(id="gpt-4o-mini"), markdown=True)

# Get the response in a variable
# run_response: Iterator[RunResponse] = agent.run("Share a 2 sentence horror story", stream=True)
# for chunk in run_response:
#     print(chunk.content)

# Print the response in the terminal
agent.print_response("Share a 2 sentence horror story", stream=True)

Image agent

from agno.agent import Agent
from agno.media import Image
from agno.models.aimlapi import AIMLApi

agent = Agent(
    model=AIMLApi(id="meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo"),
    markdown=True,
)

agent.print_response(
    "Tell me about this image",
    images=[
        Image(
            url="https://upload.wikimedia.org/wikipedia/commons/0/0c/GoldenGateBridge-001.jpg"
        )
    ],
    stream=True,
)

Tool use

"""Run `pip install duckduckgo-search` to install dependencies."""

from agno.agent import Agent
from agno.models.aimlapi import AIMLApi
from agno.tools.duckduckgo import DuckDuckGoTools

agent = Agent(
    model=AIMLApi(id="gpt-4o-mini"), markdown=True),
    tools=[DuckDuckGoTools()],
    show_tool_calls=True,
    markdown=True,
    debug_mode=True,
)

agent.print_response("Whats happening in France?")

More

For further information about the framework, please check the official Agno documentation.

For additional examples, check out our repo.

Last updated

Was this helpful?