Search as Code: Perplexity Is Right About the Future — Just Not First to It

TL;DR

Perplexity’s research team published a June 1, 2026 proposal called Search as Code, arguing that AI agents should assemble search pipelines from programmable primitives instead of relying on fixed search endpoints. The approach is backed by Perplexity-reported benchmark gains, but its novelty and real-world advantage outside the company’s tests remain open questions.

Perplexity’s research team published a June 1, 2026 proposal called Search as Code, arguing that AI agents need programmable search systems rather than fixed query-and-results engines, a shift that could affect how future AI products gather and verify information.

The company’s core claim is that conventional search endpoints were built around human-style queries: submit a query, receive a ranked result set, then repeat. Perplexity says that model breaks down when agents perform long-running tasks that may require hundreds or thousands of retrieval operations, filtering passes and verification steps.

Search as Code, or SaC, would expose search functions as atomic primitives through a Python SDK. In Perplexity’s description, an AI model acts as the control plane, writes code to combine those primitives, and runs the program in a sandbox with state across turns. The system can fan out searches, deduplicate results, extract structured records and verify evidence before sending only selected material back into the model’s main context window.

Perplexity reported strong internal results. In a CVE case study, the company said SaC identified and characterized more than 200 high-severity vulnerabilities with 100% accuracy while reducing token use from 288,700 tokens to 42,900. It said rival systems in the same test scored below 25%. Those figures are Perplexity’s reported results, not independent benchmark findings.

AI Dispatch · Infrastructure

Search as Code

Perplexity says agents shouldn’t call a search engine — they should program one, composing atomic primitives into a bespoke pipeline in a sandbox. The thesis is right. It’s also the search-shaped version of an idea the field has been converging on since 2024.

■ The old contract
One fixed pipeline. The model tweaks query params and consumes whatever comes back — through the context window, every time.
model → query(params)
engine → fixed pipeline
return → full result set
repeat ×N serial round-trips
⚠ every intermediate result routed through model context
▲ Search as Code
Amazon

search engine API development kit

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Amazon

programmable search engine API kit

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Programmable primitives

The model writes code that orchestrates atomic search ops — fan-out, dedupe, verify — keeping bulk data out of the token stream.
sdk.search.web_many(queries)
filter()
dedupe()
sdk.llm.extract_many(schema)
verified records
✓ only the useful tokens reach the model
100%
CVE case-study accuracy (SaC run)
−85%
Token use vs baseline 288.7K → 42.9K
<25%
Score for the rival systems tested
2.5×
SaC lead on Perplexity’s own WANDR bench
A convergent idea, not a cold start
“Let the model write code instead of emitting tool calls” has been building for two years. SaC is the search-specific instantiation.
2024
CodeAct
Wang et al. · ICML
2024–25
smolagents
Hugging Face
2025
Code Mode
Cloudflare
Nov 2025
Code exec + MCP
Anthropic
Jun 2026
Search as Code
Perplexity
The take

Directionally right, genuinely engineered — the rebuilt-from-atoms search stack is the part rivals can’t cheaply copy. But it’s a strong execution of an industry-wide idea, validated mostly on benchmarks Perplexity ran itself. The moat is the infrastructure and the tuning loops, not the architecture.

Sources: Perplexity Research, “Rethinking Search as Code Generation” (Jun 1 2026); CodeAct (Wang et al., ICML 2024); HF smolagents; Cloudflare Code Mode; Anthropic “Code execution with MCP” (Nov 2025). Figures as reported by Perplexity.
thorstenmeyerai.com
Amazon

search pipeline development toolkit

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Agents Need Better Retrieval Control

The proposal matters because agentic AI systems are increasingly judged not only by how well they reason, but by how reliably they gather the right evidence. If agents pull too much raw material into their context windows, costs rise and accuracy can suffer. If they depend on a fixed search pipeline, they may miss task-specific retrieval strategies.

Perplexity’s argument is that code gives agents a more flexible way to manage search work: generate many targeted queries, apply custom filters, preserve intermediate state and verify structured answers before producing a final response. That could be useful for research, compliance, security triage, market monitoring and other workflows where source quality and repeatable evidence matter.

Amazon

Python SDK for search primitives

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

A Broader Code-Driven Shift

Perplexity is not presenting the idea in a vacuum. The supplied source material points to a wider movement since 2024 toward letting models write executable code rather than only issue one-off tool calls. Related work includes CodeAct, Hugging Face’s smolagents, Cloudflare’s Code Mode and Anthropic’s work on code execution with MCP.

What appears more specific to Perplexity is the search implementation: the company says it has rebuilt parts of the search stack into composable functions rather than simply placing an existing search API inside a shell. That distinction is central to its claim that Search as Code is more than ordinary tool use with a different interface.

“Search as Code”

— Perplexity research team

Amazon

AI search pipeline programming tools

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Independent Proof Is Still Limited

Several points remain unsettled. The strongest numbers cited in the source material come from Perplexity’s own case study and benchmark suite, including WANDR, which the company introduced. Independent reproduction would be needed to judge whether the reported gains hold across different models, search providers, domains and evaluation methods.

It is also unclear how much of the advantage comes from the SaC architecture itself, how much comes from Perplexity’s underlying search infrastructure, and how much comes from tuning around benchmark tasks. The supplied material frames the core idea as directionally sound but not wholly new.

Benchmarks Will Face Outside Tests

The next test is whether developers and researchers can reproduce similar gains outside Perplexity’s own environment. Watch for third-party evaluations, integrations into agent frameworks, and comparisons against other code-execution approaches from AI labs and infrastructure providers.

If the approach proves durable, search providers may compete less on a single results page and more on programmable retrieval layers built for agents. If the gains narrow under outside testing, Search as Code may be seen as a strong implementation of a broader industry pattern rather than a distinct new category.

Key Questions

What did Perplexity announce?

Perplexity published a research proposal called Search as Code on June 1, 2026. It argues that AI agents should write code to assemble search workflows from smaller retrieval and verification primitives.

Is Search as Code proven to work better?

Perplexity reported major gains in its own tests, including lower token use and higher accuracy in a CVE case study. Those results have not been established here as independently verified.

Is the idea new?

The search-specific packaging appears to be Perplexity’s focus, but the broader pattern of models writing code to control tools has been developing through other projects since at least 2024.

Why would readers care?

If this approach works at scale, AI agents could gather evidence more cheaply, verify answers more reliably and handle long research tasks with less raw data pushed through their context windows.

Source: Thorsten Meyer AI

You May Also Like

Native all the way, until you need text

Developers find native SDKs insufficient for complex text and Markdown rendering, leading to increased reliance on web-based solutions like Electron.

Thrive Infinite — solid brand name. Side note: more clients now ask Claude/ChatGPT “find me a coach for [their thing]” before they ever browse a site. Free 30-sec scan that shows what AI agents actually see when they look at you. Vid below.

Thrive Infinite reports increased client inquiries asking about Claude and ChatGPT, signaling growing interest in AI-driven coaching solutions.

The “Update Habit” That Prevents Most Tech Problems

Keeping your devices updated regularly can prevent most tech problems; discover the simple habit that keeps your system running smoothly.

With 1.4bn people, India puts technological fluency at heart of education

India launches a national strategy to embed technological fluency in education, aiming to prepare children for future AI-driven economies.