Skip to main content

Overview

AG2 ships a PerplexitySearchToolkit that wraps the Perplexity Search API as a native AG2 tool. The tool returns ranked web results — title, URL, snippet, and date — without generating an LLM answer, which keeps token usage minimal and lets the calling agent decide how to consume them.
AG2 (formerly AutoGen) is an open-source framework for building multi-agent conversational AI systems. Learn more at ag2.ai.

Installation

API Key Setup

Set your Perplexity API key as an environment variable, or pass it to the toolkit constructor:

Get API Key

Generate your API key from the Perplexity dashboard.

Quick Start

Register PerplexitySearchToolkit with an AG2 Agent:
The tool calls the Perplexity Search API under the hood and returns structured PerplexitySearchResult objects.

Configuration

All search parameters are passed to toolkit.search() and forwarded to the Search API:
You can also pass any parameter as an AG2 Variable so it can be resolved from the conversation context at runtime:

Response Shape

Each call returns a PerplexitySearchResponse with the original query and a list of PerplexitySearchResult items:

AG2 Docs

Build multi-agent systems with AG2.

Tool Source

PerplexitySearchToolkit implementation.

Search API Quickstart

Learn more about the underlying Perplexity Search API.

Common Toolkits

Browse all built-in AG2 tools.

Support

Need help with the integration?