
Perplexity's Search as Code lets agents write custom search scripts, cutting tokens 85% on a CVE research task
Perplexity's Search as Code (SaC) replaces fixed search API calls with agent-generated Python scripts that run in a sandbox — on an internal task tracking 200 critical CVEs, token usage fell 85% and the approach outscored Anthropic and OpenAI systems on four of five self-reported benchmarks. Agents on Perplexity's Agent API or Perplexity Computer can now write custom retrieve-filter-deduplicate-rerank pipelines, running parallel queries and scripting their own filters instead of accepting whatever a fixed API returns.
Source: the-decoder.com ↗
With SaC, the model wrote a three-stage script. It ran parallel searches tailored to how specific vendors like Mozilla or Google format their security bulletins.
Perplexity technical report
Why this matters
- → Agents can now filter search results programmatically, reducing token waste by 85% on complex tasks.
- → Shifts control from fixed APIs to model-written Python scripts running in sandboxes.
- → Addresses benchmark-gaming problem where agents fake web research using training data.
Code-driven search