Skip to main content

Add Perplexity Search Tool to AI Agent

Quick Start

1

Set API Key

Set your Perplexity API key as an environment variable in your terminal:
2

Create a file

Create a new file perplexity_search.py with the following code:
3

Install Dependencies

Make sure you have the required packages installed:
4

Run the Agent

Execute your script:
Requirements
  • Python 3.10 or higher
  • Perplexity API key

Features

Web Search

Search the web for real-time information using Perplexity’s powerful search API.

Sonar Model

Utilize Perplexity’s Sonar model for high-quality search results.

MCP Integration

Seamless integration with Model Context Protocol.

Environment Variables

Securely pass API keys using environment variables.