Overview
CAMEL-AI’sSearchToolkit ships a search_perplexity method that wraps the Perplexity Search API as a native CAMEL tool. The tool returns ranked web results with a title, URL, and snippet, plus publication and update dates when available, so the calling ChatAgent can ground its responses on fresh, citable sources.
CAMEL-AI is an open-source framework for building communicative multi-agent systems. Learn more at camel-ai.org.
Installation
0.2.90, does not include SearchToolkit.search_perplexity. 0.2.91a7 is the latest prerelease and it includes CAMEL’s compatibility bounds for mcp and openai, so it installs without extra pins.
API Key Setup
Set your Perplexity API key as an environment variable.ChatAgent also requires an API key for its model provider. CAMEL uses OpenAI by default, so the example below sets OPENAI_API_KEY. If you configure another model provider, set that provider’s API key instead.
Get API Key
Generate your API key from the Perplexity dashboard.
Quick Start
Registersearch_perplexity as a tool on a ChatAgent:
POST https://api.perplexity.ai/search under the hood and returns the raw API response so the agent can pick which results to cite.
Configuration
search_perplexity provides first-class arguments for query, max_results, max_tokens, max_tokens_per_page, country, search_recency_filter, search_domain_filter, and search_language_filter. Pass other Search API fields through extra_params.
"arxiv.org" or denylist entries such as "-medium.com", but you cannot mix allowlist and denylist modes in one request.
query can also be a list of up to five queries for batched search:
Response Shape
search_perplexity returns the raw Perplexity Search API response as a Dict[str, Any]. On success, id and results are always present. server_time is optional: the response can omit it or set it to None. Each result requires title, url, and snippet; date and last_updated are optional and can be None.
PERPLEXITY_API_KEY is missing, CAMEL raises ValueError before making a request. Non-200 responses, request exceptions, and response-decoding errors return a dictionary with an error key.
Links & Resources
CAMEL-AI Docs
Build multi-agent systems with CAMEL-AI.
Tool Source
SearchToolkit.search_perplexity implementation.
Search API Quickstart
Learn more about the underlying Perplexity Search API.
Example Script
End-to-end CAMEL example using Perplexity search.
Support
Need help with the integration?- Browse the CAMEL-AI documentation
- Review our FAQ