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
Yeipower Pipe Blockage Detector Locators - Water Pipe Wall Scanner 40M Pipeline Detector Metal PVC Water Pipes Clogging Tool

Yeipower Pipe Blockage Detector Locators – Water Pipe Wall Scanner 40M Pipeline Detector Metal PVC Water Pipes Clogging Tool

Solve Problem: There are always many pipe blockage problems in life. But we do not have the most…

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.

OSOYOO 2WD Robot Car Starter Kit for Arduino – Smart Educational Robotics Kit for Beginners and Adults | Build, Code & Control via WiFi, Bluetooth, IR | Learn Programming & Electronics

OSOYOO 2WD Robot Car Starter Kit for Arduino – Smart Educational Robotics Kit for Beginners and Adults | Build, Code & Control via WiFi, Bluetooth, IR | Learn Programming & Electronics

Learn Arduino & Robotics from Scratch – Perfect for STEM beginners and adults who want to explore robotics,…

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

Workday execution risk flagged by Jefferies ahead of quarterly earnings

Jefferies warns of execution risks for Workday before its upcoming quarterly report, citing concerns over AI strategy, margins, and growth targets.

$965B and Climbing: Anthropic’s Series H Is Really a Compute Bet

Anthropic’s Series H values it near $1 trillion, with the round framed around compute capacity and chip supply commitments.

Reddit stock drops 6% after Meta launches standalone app for online forums / Reddit’s stock is now down almost 40% this year despite a strengthening online ad business

Reddit stock declines nearly 6% amid concerns that Meta’s new Forum app could challenge Reddit’s dominance in online forums.

Candor as a Moat: A Critical Reading of Dario Amodei and Anthropic

A June 2026 critique argues Anthropic’s safety candor may also strengthen its market position after a US model suspension.