TL;DR

Perplexity Research published a June 1, 2026 paper arguing that AI agents should assemble search workflows in code using atomic retrieval, ranking, filtering and verification tools. The proposal is a serious search-infrastructure bet, but the broader idea of models writing code to control tools has been developing across the field since at least 2024.

Perplexity Research on June 1, 2026 proposed Search as Code, an approach that lets AI agents write and run code to assemble custom search pipelines from smaller retrieval, ranking, filtering and verification tools, a shift the company says is needed as agents move beyond single-query answer generation into longer, higher-volume research tasks.

The confirmed development is Perplexity’s publication of “Rethinking Search as Code Generation,” which argues that the standard search model is poorly matched to agentic AI. In Perplexity’s framing, a traditional search endpoint accepts a query, runs a fixed internal pipeline and returns results. Search as Code, or SaC, instead exposes search operations as programmable primitives inside a Python SDK, with generated code executed in a sandbox.

Perplexity says the system has three main parts: a model that decides the retrieval strategy and generates code, a sandbox that can run deterministic steps and maintain state across turns, and an Agentic Search SDK that provides the building blocks. The company argues this lets agents fan out across many searches, filter and deduplicate results, run schema-based extraction, and pass only selected information back into the model context.

The company’s strongest reported example is a CVE research task involving more than 200 high-severity vulnerabilities. Perplexity says its SaC run reached 100% accuracy while reducing token use by 85%, from 288.7K tokens to 42.9K. It also says rival systems tested in that case scored below 25%. Those figures are Perplexity’s own benchmark results, not independent measurements.

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.

Introdução à Programação com Python

Introdução à Programação com Python

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
Custom Search - Discover more:: A Complete Guide to Google Programmable Search Engines

Custom Search – Discover more:: A Complete Guide to Google Programmable Search Engines

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 search is becoming part of how AI agents perform work, not just how chatbots answer questions. If an agent must investigate many sources, compare claims, verify records and keep intermediate data out of the prompt, a single fixed search call can become a bottleneck. Perplexity’s answer is to move more control into executable retrieval programs.

The claim has direct implications for AI infrastructure. Systems that can expose search as smaller, composable operations may reduce token waste and give agents more precise control over source collection and verification. That could matter in domains such as security research, compliance, procurement, scientific literature review and market analysis, where the quality of retrieval can shape the quality of the final answer.

The caveat is that the architectural direction is not unique to Perplexity. The broader “model writes code to use tools” pattern has appeared in CodeAct, Hugging Face’s smolagents, Cloudflare’s Code Mode and Anthropic’s code execution work with MCP. Perplexity’s contribution is a search-specific implementation built around its own infrastructure, not the first appearance of the underlying idea.

KINDEN 15 Pipe Pipeline Team Building Activities Kit Group Games, Field Day Games

KINDEN 15 Pipe Pipeline Team Building Activities Kit Group Games, Field Day Games

✅[Game Ideas]: Pipeline is a fast-paced game that employs physical coordination, team cooperation, communication, and planning. This lively…

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Code-First Agents Came Earlier

Perplexity’s 2022 answer engine helped popularize AI-generated answers grounded in web search. Search as Code extends that direction by asking whether the search stack itself should be programmable by the agent rather than hidden behind query parameters.

The timing also places Perplexity inside a wider shift. CodeAct, published by Wang and co-authors and associated with ICML 2024, explored the use of code as an action format for agents. Hugging Face’s smolagents, Cloudflare’s Code Mode and Anthropic’s code execution with MCP each point to related work: letting models write executable steps instead of relying only on serialized tool calls.

That history does not undercut the practical value of SaC. It does narrow the novelty claim. The more defensible reading is that Perplexity is applying a convergent agent pattern to search, with the harder work likely in its rebuilt search primitives, sandboxing, tuning and evaluation loops.

“Search as Code”

— Perplexity Research

Amazon

atomic retrieval tools for AI

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Benchmarks Need Outside Testing

It is not yet clear how SaC performs outside Perplexity’s own evaluations. The reported CVE accuracy, token reduction, WANDR lead and benchmark gains are described as Perplexity results. Independent testing would be needed to judge whether the same gains hold across other search indexes, model families, task types and cost settings.

Several implementation details are also unresolved from the available source material. It is unclear how broadly the SDK will be exposed, what limits will apply to sandboxed execution, how source quality is scored, and how the system handles adversarial pages, conflicting sources or time-sensitive information at scale.

Adoption Will Test The Claim

The next milestone is whether Perplexity turns the research proposal into a product or developer-facing platform that outside users can test. Broader adoption would show whether programmable search primitives become a standard agent interface or remain tied to companies with large proprietary search infrastructure.

Rivals are likely to keep building related systems around code execution, tool orchestration and retrieval control. The open question is not whether agents will need more programmable access to information, but which companies can make that access reliable, secure and cheap enough for real workloads.

Key Questions

What did Perplexity announce?

Perplexity Research published a June 1, 2026 proposal called Search as Code, which lets AI agents generate code to compose search operations from smaller primitives.

Is Search as Code a new search engine?

Based on Perplexity’s description, it is better understood as a programmable architecture for search. It exposes retrieval, filtering, ranking and verification tools that an agent can combine in code.

Was Perplexity first to this idea?

Not in the broader sense. Earlier work such as CodeAct, smolagents, Cloudflare Code Mode and Anthropic’s code execution with MCP also used code as a way for models to control tools. Perplexity’s version applies that pattern to search.

Are the performance claims independently verified?

No independent verification is cited in the provided source material. The reported 100% CVE accuracy, 85% token reduction and benchmark leads are Perplexity’s own results.

Why does this matter for AI agents?

Agents doing long research tasks may need to run many searches, compare sources and filter data before sending anything back to the model. Search as Code is meant to give agents finer control over that process.

Source: Thorsten Meyer AI

You May Also Like

Build vs Buy a Prebuilt AI Workstation

A 2026 AI workstation report says DIY is no longer always cheaper as parts prices, vendor testing and support shift the math.

The Real Cost Of A Local-Inference Rig In 2026

Examining the hardware costs and constraints of running large language models locally in 2026, including VRAM limits and value strategies.

AI’s Memorization Crisis

Stanford and Yale researchers found that popular AI models reproduce large portions of training books, challenging industry claims and raising legal concerns.