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.
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.
Monolithic search
search engine API development kit
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
programmable search engine API kit
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Programmable primitives
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.
search pipeline development tools
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Agents Need Better Retrieval
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.
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