Sonar Web Search for Agents (via OpenRouter)

Route your agent's web search through Perplexity Sonar on OpenRouter with spend limits, safe key handling, citations, and cost logs.

AI Systemsweb-searchperplexity-sonar
by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“My agent keeps hallucinating on research questions. Fix its search.”
Beforegeneric AI agent
Hallucination on research questions usually happens when the model doesn't have good information to work with. Here are some approaches:

- Make sure your agent actually has a web search tool configured
- Improve your prompts to explicitly ask for sources and citations
- Add instructions telling the model to say "I don't know" rather than guess
- Consider using retrieval-augmented generation (RAG) with a curated knowledge base
- Lower the temperature setting to make outputs more deterministic
- Implement a verification step where a second call checks the claims

You might also look into search APIs that return richer results than basic ones.

Which of these would you like to explore?
Afterwith Sonar Web Search for Agents (via OpenRouter)
The prompt isn't the problem. Thin search results are — the model fills
gaps because the gaps are real. Route search through Sonar instead.

TWO-TIER ROUTING
  Default          → perplexity/sonar-pro           (~$0.005/call)
  Contains trigger → perplexity/sonar-deep-research (~$0.30/call)
  Trigger phrase: "deep research" (configurable)

SETUP
1. OpenRouter key at openrouter.ai/keys
2. Set the spend cap BEFORE the first call — deep research at $0.30 and
   an agent in a retry loop is a bad combination discovered late.
   Cap: $30/mo. Alert at 80%.
3. Store as OPENROUTER_API_KEY. Not in the agent config file.

PATCH — tools.md
  Replace the default web_search entry with the sonar router so the
  routing survives a new session instead of living in one prompt.

PATCH — memory.md
  + Research routing is permanent. Use sonar-pro for factual lookups.
  + Escalate to sonar-deep-research only on the trigger phrase.
  + Never answer a factual question from parametric memory when the
  + router is available — cite the returned sources.

  Second line is what actually stops the hallucination: without it the
  model still answers from memory when it feels confident.

VERIFY — run both, confirm the split
  "What did Anthropic ship this week?"            → sonar-pro, ~$0.005
  "deep research: agent framework landscape 2026" → deep, ~$0.30
  Both should return citations. No citations = routing didn't take.

COST LOG
  Per call: timestamp, tier, tokens, cost, trigger matched y/n.
  Watch the tier split for a week. If deep-research is over 10% of
  calls, your trigger phrase is too common — make it more specific.

FALLBACK
  Brave on 429 or timeout, so a Sonar outage degrades instead of
  failing the run.

About this skill

Agents with weak search answer from stale memory and cite nothing. This skill wires Perplexity Sonar through OpenRouter as the default search tool, with a deep-research tier that only runs when you ask for it.

What it does

  • Sets up a cheap default tier and an explicit, capped deep-research escalation
  • Keeps the API key in an env var or secret manager with a dedicated per-agent spend limit, never in memory or tools files
  • Builds a wrapper that parses citations, logs cost per call, retries only on the right errors, and fails loud
  • Guards against prompt injection from search results and duplicate search tools
  • Flags every model id, price, and parameter for verification against current docs

What you get

Routing config, instruction-file text with no secrets, a tool wrapper spec, a cost log format, and a five-step test plan.

Best for

Anyone running a self-hosted or custom agent whose research answers are thin, stale, or uncited.

SKILL.md preview

SKILL.md
---
name: agent-sonar-search-upgrade
description: Give an agent better web research by routing its search tool through Perplexity Sonar models on OpenRouter - a cheap default tier, an explicit deep-research escalation, a per-key spend limit, the API key kept in an env var or secret manager, citations checked, a per-call cost log, and a loud failure instead of silent fallback. Use when the user says "my agent's web search is useless", "hook up Perplexity to my agent", "use Sonar via OpenRouter", "my agent cites outdated prices", "add a deep research mode", or casually "make my bot actually search the web properly".
---

# Sonar Web Search for Agents (via OpenRouter)

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More ai & agents skills

View all AI & Agents skills →