Perplexity with Agno
Overview
Section titled “Overview”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.
Installation
Section titled “Installation”pip install agno openaiAPI Key Setup
Section titled “API Key Setup”Set your Perplexity API key as an environment variable:
export PERPLEXITY_API_KEY="your_api_key_here"Get API Key
Generate your Perplexity API key from the API portal.
Quick Start
Section titled “Quick Start”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:
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.