Search the web with Perplexity Sonar API for current information, citations, and web-grounded answers.
Use this skill to search the web via the Perplexity Sonar API. It returns accurate, cited, real-time answers grounded in current web sources.
Invoke this skill automatically when the user asks about:
Trigger phrases: "search for", "look up", "find out", "what's the latest", "current", "recent", "news about", "web search", "perplexity search"
Set your Perplexity API key in the environment before starting OpenClaw:
# Add to ~/.openclaw/.env
PERPLEXITY_API_KEY=pplx-your-key-here
Get a key at https://www.perplexity.ai/settings/api
python3 {baseDir}/scripts/perplexity_search.py --query "<the user's question>"
| Flag | Default | Description |
|---|---|---|
--model sonar | sonar | Fast, general-purpose search |
--model sonar-pro | — | Higher quality synthesis (costs more) |
--model sonar-reasoning | — | Step-by-step reasoning |
--domains example.com | — | Comma-separated domain allowlist |
--max-results 8 | 8 | Cap displayed search results |
--temperature 0.2 | 0.2 | Lower = more factual |
--json | — | Print raw JSON response |
# General search
python3 {baseDir}/scripts/perplexity_search.py --query "latest AI agent frameworks 2025"
# Higher quality synthesis
python3 {baseDir}/scripts/perplexity_search.py --query "compare Perplexity vs Tavily search APIs" --model sonar-pro
# Restrict to a specific site
python3 {baseDir}/scripts/perplexity_search.py --query "PostgreSQL 17 release notes" --domains postgresql.org
# Reasoning mode for complex topics
python3 {baseDir}/scripts/perplexity_search.py --query "why did SVB fail" --model sonar-reasoning
The script prints a structured markdown report with:
sonar for speed, sonar-pro for depth.python3 {baseDir}/scripts/perplexity_search.py --query "...".PERPLEXITY_API_KEY from the environment only — never from arguments.https://api.perplexity.ai/chat/completions.ZIP package — ready to use