> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agno framework integration

> Build production AI agents with Agno and Orq.ai's AI Gateway. Create tool-using agents with complete observability and access to 300+ LLMs.

## AI Gateway

### Overview

Agno is a Python framework for building production-ready AI agents with structured workflows, tool integration, and multi-agent orchestration. Connecting Agno to Orq.ai's AI Gateway provides access to 300+ models with a single configuration change.

### Key Benefits

Orq.ai's AI Gateway enhances Agno applications with:

<CardGroup cols={2}>
  <Card title="Complete Observability" icon="chart-line">
    Track every agent interaction, tool use, and model call with detailed traces
  </Card>

  <Card title="Built-in Reliability" icon="shield-check">
    Automatic fallbacks, retries, and load balancing for production resilience
  </Card>

  <Card title="Cost Optimization" icon="chart-pie">
    Real-time cost tracking and spend management across all AI operations
  </Card>

  <Card title="Multi-Provider Access" icon="cubes">
    Access 300+ LLMs and 20+ providers through a single, unified integration
  </Card>
</CardGroup>

### Prerequisites

Before integrating Agno with Orq.ai, ensure the following are in place:

* An Orq.ai account and [API Key](/docs/ai-gateway/configuration/api-keys)
* Python 3.10 or higher

<Info>
  To set up an API key, see [API keys & Endpoints](/docs/ai-gateway/configuration/api-keys).
</Info>

### Installation

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
pip install agno
```

### Configuration

Configure Agno to use Orq.ai's AI Gateway via `OpenAIChat` with a custom `base_url`:

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os
from agno.models.openai import OpenAIChat

llm = OpenAIChat(
    id="openai/gpt-4o",
    api_key=os.getenv("ORQ_API_KEY"),
    base_url="https://api.orq.ai/v3/router",
)
```

> **base\_url**: `https://api.orq.ai/v3/router`

### Basic Agent Example

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os
from agno.agent import Agent
from agno.models.openai import OpenAIChat

llm = OpenAIChat(
    id="openai/gpt-4o",
    api_key=os.getenv("ORQ_API_KEY"),
    base_url="https://api.orq.ai/v3/router",
)

agent = Agent(
    model=llm,
    instructions="You are a helpful assistant. Keep responses concise.",
    markdown=True,
)

agent.print_response("Explain machine learning in two sentences.")
```

### Agent with Tools

Add tools to the agent for real-world tasks:

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.yfinance import YFinanceTools

llm = OpenAIChat(
    id="openai/gpt-4o",
    api_key=os.getenv("ORQ_API_KEY"),
    base_url="https://api.orq.ai/v3/router",
)

agent = Agent(
    model=llm,
    tools=[YFinanceTools(enable_stock_price=True)],
    instructions="Use tables to display data. Don't include any other text.",
    markdown=True,
)

agent.print_response("What is the stock price of Apple?", stream=True)
```

### Agent with Custom Tools

Define custom Python functions as tools:

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os
from agno.agent import Agent
from agno.models.openai import OpenAIChat

def get_weather(city: str) -> str:
    """Get the current weather for a city."""
    return f"Weather in {city}: Sunny, 22°C."

def convert_currency(amount: float, from_currency: str, to_currency: str) -> str:
    """Convert an amount between currencies."""
    return f"{amount} {from_currency} = {amount * 1.1:.2f} {to_currency} (approximate)"

llm = OpenAIChat(
    id="openai/gpt-4o",
    api_key=os.getenv("ORQ_API_KEY"),
    base_url="https://api.orq.ai/v3/router",
)

agent = Agent(
    model=llm,
    tools=[get_weather, convert_currency],
    instructions="Use the available tools to answer questions accurately.",
    markdown=True,
)

agent.print_response("What's the weather in Tokyo and convert 100 USD to EUR?")
```

### Multi-Agent Team

Orchestrate multiple specialized agents:

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.team import Team

llm = OpenAIChat(
    id="openai/gpt-4o",
    api_key=os.getenv("ORQ_API_KEY"),
    base_url="https://api.orq.ai/v3/router",
)

researcher = Agent(
    name="Researcher",
    model=llm,
    instructions="You research topics and provide accurate, concise facts.",
    markdown=True,
)

writer = Agent(
    name="Writer",
    model=llm,
    instructions="You take research and turn it into clear, engaging content.",
    markdown=True,
)

team = Team(
    members=[researcher, writer],
    model=llm,
    instructions="Collaborate to produce well-researched, well-written content.",
    markdown=True,
)

team.print_response("Write a short paragraph about renewable energy benefits.")
```

### Model Selection

With Orq.ai, any supported model from 20+ providers can be used:

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os
from agno.models.openai import OpenAIChat

# Use Claude
claude_llm = OpenAIChat(
    id="anthropic/claude-sonnet-4-6",
    api_key=os.getenv("ORQ_API_KEY"),
    base_url="https://api.orq.ai/v3/router",
)

# Use Gemini
gemini_llm = OpenAIChat(
    id="google-ai/gemini-2.5-flash",
    api_key=os.getenv("ORQ_API_KEY"),
    base_url="https://api.orq.ai/v3/router",
)

# Use Groq
groq_llm = OpenAIChat(
    id="groq/llama-3.3-70b-versatile",
    api_key=os.getenv("ORQ_API_KEY"),
    base_url="https://api.orq.ai/v3/router",
)
```
