Perplexity Search Skill

v1.0.1

Search the web with Perplexity Sonar API for current information, citations, and web-grounded answers.

0· 280· 2 versions· 0 current· 0 all-time· Updated 1mo ago· MIT-0

Perplexity Search

Use this skill to search the web via the Perplexity Sonar API. It returns accurate, cited, real-time answers grounded in current web sources.

When to use this skill

Invoke this skill automatically when the user asks about:

  • Current events, recent news, or anything that may have changed recently
  • Product releases, software versions, or API documentation
  • Research questions that benefit from citations and web sources
  • Comparisons, pricing, or availability that requires live data
  • Any question where freshness or sourcing matters

Trigger phrases: "search for", "look up", "find out", "what's the latest", "current", "recent", "news about", "web search", "perplexity search"

Setup

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

Command

python3 {baseDir}/scripts/perplexity_search.py --query "<the user's question>"

Optional flags

FlagDefaultDescription
--model sonarsonarFast, general-purpose search
--model sonar-proHigher quality synthesis (costs more)
--model sonar-reasoningStep-by-step reasoning
--domains example.comComma-separated domain allowlist
--max-results 88Cap displayed search results
--temperature 0.20.2Lower = more factual
--jsonPrint raw JSON response

Usage examples

# 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

Output

The script prints a structured markdown report with:

  1. Answer — concise, web-grounded response
  2. Citations — numbered source URLs
  3. Search Results — titles, URLs, and snippets
  4. Related Questions — follow-up ideas
  5. Usage — token and cost metadata

Agent workflow

  1. Identify the user's search intent from their message.
  2. Extract a clean, specific query (avoid filler words).
  3. Choose sonar for speed, sonar-pro for depth.
  4. Run the command with python3 {baseDir}/scripts/perplexity_search.py --query "...".
  5. Present the Answer and Citations to the user in a readable format.
  6. Offer related questions as follow-up options.

Security notes

  • The script reads PERPLEXITY_API_KEY from the environment only — never from arguments.
  • The API key is never logged or printed.
  • All external calls go only to https://api.perplexity.ai/chat/completions.
  • No local files are written.

SECURITY MANIFEST

Version tags

latestvk9704m8gb8wtgrctpqy2rtvr4582qq94

Runtime requirements

🔎 Clawdis
Binspython3
EnvPERPLEXITY_API_KEY
Primary envPERPLEXITY_API_KEY