Skip to main content
Perplexity
current

Search documentation

Type to search this documentation.

On this pageOverview

Perplexity with Agno

Use Perplexity's Agent API through Agno's OpenAI Responses integration.

Agno is an open-source Python framework for building agents, teams, and workflows. Connect it to Perplexity's Agent API through Agno's OpenAI Responses-compatible model class.

Bash
pip install agno openai

Set your Perplexity API key as an environment variable:

Bash
export PERPLEXITY_API_KEY="your_api_key_here"

Get API Key

Generate your Perplexity API key from the API portal.

Use OpenAIResponses with the Agent API base URL and any supported Agent API model. Pass a research preset through extra_body so answers are grounded in live web results:

Python
import os

from agno.agent import Agent
from agno.models.openai import OpenAIResponses

agent = Agent(
    model=OpenAIResponses(
        id="openai/gpt-5.6-luna",
        base_url="https://api.perplexity.ai/v1",
        api_key=os.environ["PERPLEXITY_API_KEY"],
        extra_body={"preset": "medium"},
    ),
    markdown=True,
)

agent.print_response(
    "What are the latest breakthroughs in fusion energy this year?",
    stream=True,
)

Swap id for any Agent API model to route third-party models through Perplexity. The Agent API also provides research-backed presets and additional built-in tools.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu