TL;DR

Perplexity’s research team published a June 1, 2026 argument for Search as Code, a system that lets AI agents assemble retrieval workflows from search primitives. The claim is timely, but the broader idea of models writing code to control tools predates Perplexity’s framing.

Perplexity’s research team on June 1, 2026 proposed Search as Code, a system for letting AI agents write retrieval programs from modular search components, sharpening a live debate over how search should work as AI agents take on longer, more complex tasks.

Perplexity argues that conventional search systems still follow a human-era contract: accept a query, run a fixed retrieval pipeline and return a finished result set. The company says that approach becomes inefficient when AI agents need to run many searches, compare sources, filter results and verify facts during extended workflows.

Its proposed Search as Code approach exposes retrieval, ranking, filtering, fan-out and rendering as building blocks inside a Python SDK. According to Perplexity, the model acts as the control layer, writing code that assembles those primitives inside a secure sandbox while preserving state across steps.

Perplexity says its internal tests showed strong gains. In a CVE case study, the company reported 100% accuracy while reducing token use from 288.7K tokens to 42.9K. It also said rival systems in the same test scored below 25%, and that Search as Code led on four of five benchmark tasks it reported, tying OpenAI on one. Those figures are Perplexity’s own reported results and have not been independently verified in the source material provided.

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 tools

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Agents Need Better Retrieval

Amazon

AI search primitives SDK

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Agents Need Better Retrieval

The proposal matters because agentic AI systems are increasingly expected to complete tasks that require many search, comparison and verification steps. If every intermediate result must pass through the model’s context window, costs rise and the system may spend tokens on material that is later discarded.

Perplexity’s answer is to move more of the retrieval process into executable code, so the model can fetch broad result sets, filter them, deduplicate records and pass only selected evidence back into the reasoning loop. If the approach works at scale, it could make agent workflows cheaper, faster and more auditable.

Amazon

search as code programming kit

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

A Broader Code-Agent Shift

The central idea is not entirely new. The broader pattern of letting models write code instead of issuing one-off tool calls has been visible since at least CodeAct, an ICML 2024 line of work, and continued through Hugging Face’s smolagents, Cloudflare’s Code Mode and Anthropic’s code execution with MCP.

What makes Perplexity’s version distinct, according to its own framing, is that it applies the code-generation pattern to search infrastructure itself. The company says it rebuilt the search stack into composable primitives rather than wrapping a standard search API in a programming shell.

“Agents shouldn’t call a search engine — they should program one.”

— Perplexity Research

Benchmark Claims Need Verification

The main open question is how Search as Code performs outside Perplexity’s own evaluation setup. The reported CVE results and benchmark wins are company-provided figures, and the source material does not include independent replication.

It is also unclear how easily other search providers could build similar programmable retrieval layers, how secure the sandbox model is under real workloads, and whether the gains hold across messy consumer, enterprise and research tasks.

Adoption Will Test The Moat

The next test is whether Perplexity turns Search as Code from a research argument into a durable product advantage. Watch for independent benchmark results, SDK access, developer adoption and evidence that the approach improves live agent workflows rather than only controlled tasks.

Key Questions

What did Perplexity announce?

Perplexity published a June 1, 2026 research argument for Search as Code, a way for AI agents to write search programs using modular retrieval primitives.

Is Search as Code a new idea?

The search-specific implementation is Perplexity’s framing, but the broader idea of models writing code to control tools has appeared in earlier work, including CodeAct and other agent systems.

What results did Perplexity report?

Perplexity said Search as Code reached 100% accuracy in a CVE case study while cutting token use by 85%. Those numbers are reported by Perplexity and have not been independently verified in the provided material.

Why does this matter for AI users?

If programmable search works reliably, AI agents could handle research-heavy tasks with less token waste and more targeted evidence gathering.

Source: Thorsten Meyer AI

You May Also Like

The NVIDIA Earnings Preview: What Q1 FY27 Will Reveal About the AI Cycle

NVIDIA reports Q1 FY27 earnings on May 20, 2026, with expectations around $78 billion revenue. This will reveal the health of the AI infrastructure cycle amid geopolitical and supply chain factors.

Cyprus curtails 65% of solar generation in January–May 2026

Cyprus curtailed over 65% of its solar energy potential from January to May 2026 due to grid constraints, affecting residential and large-scale PV systems.

The deployment. How the AI labs verticallyintegrated into the serviceslayer — the Palantir modelat scale.

OpenAI and Anthropic moved into enterprise AI deployment services in May 2026, borrowing from Palantir’s embedded engineer model.

Memory has grown to nearly two-thirds of AI chip component costs

Memory now accounts for nearly 63% of AI chip component costs, reflecting a significant shift in the supply chain from 2024 to 2025.