TL;DR
Perplexity Research published a June 1 proposal for Search as Code, a system in which AI agents write code to assemble custom search workflows from smaller retrieval primitives. The approach is a real engineering bet, but its core pattern follows earlier work on code-driven agents rather than starting a wholly new category.
Perplexity Research on June 1 published a proposal called Search as Code, arguing that AI agents should generate code to build task-specific search pipelines instead of repeatedly calling a fixed search endpoint, a shift that could affect how agent products retrieve, filter and verify web information.
The confirmed event is Perplexity’s publication of a research piece titled Rethinking Search as Code Generation. The company describes Search as Code as a move away from monolithic search, where a model sends query parameters to one fixed pipeline and receives a full result set, toward a programmable model in which an agent composes retrieval, ranking, filtering, fan-out and verification steps inside a sandbox.
Perplexity says the old search contract breaks down for long-running agent tasks that may require many retrieval operations. Its proposed setup has three main parts: the model acts as the control plane, generated code runs in a secure execution environment with state across turns, and an Agentic Search SDK supplies the search primitives the model can combine.
The strongest performance claims come from Perplexity’s own tests. In a CVE case study, the company reports that Search as Code reached 100% accuracy while reducing token use by 85%, from 288.7K tokens to 42.9K. Perplexity also says rival systems in that test scored below 25%, and that Search as Code led on four of five broader benchmarks while tying OpenAI on the fifth. Those figures are company-reported and have not been independently replicated in the supplied material.
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.
search pipeline programming SDK
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 primitives API development kit
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Agents Get Programmable Retrieval
The proposal matters because search is becoming part of how AI agents perform work, not just how humans find pages. If an agent can write a retrieval program for each task, it may reduce wasted tokens, preserve more useful evidence and run checks before sending material back into the model’s context window.
The competitive question is different from the technical one. The idea of models writing code to coordinate tools has been building across the field since at least 2024. Perplexity’s stronger claim is execution: rebuilding search into smaller, composable parts and tuning the loop around agent behavior. That infrastructure may be harder to copy than the general architecture.

Perplexity AI, A Practical Guide to Powered Research: Smart Search, Workflow Automation, and Knowledge Discovery in 2026 (The Practical Guide to Modern AI Tools)
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Earlier Code-Driven Agent Work
The supplied analysis places Search as Code in a broader pattern rather than treating it as a sudden break. CodeAct, presented at ICML 2024, explored agents acting through generated code. Hugging Face’s smolagents work in 2024 and 2025 also leaned into code as a practical interface for agent actions.
Other recent examples cited in the source material include Cloudflare’s Code Mode and Anthropic’s work around code execution with MCP. Search as Code applies that direction to search itself: the model does not only call a tool, but writes a small program that decides how search operations should be combined for the task at hand.
“Search as Code”
— Perplexity Research

National Geographic 4-Cylinder Engine Building Kit – 175+ Piece Working Model with Moving Parts, Clear Visible Engine Model, STEM Building Toy with Tools & Learning Guide for Kids
BUILD YOUR OWN ENGINE – Assemble a clear 4-cylinder engine model kit with 175+ durable pieces. A fun…
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Independent Tests Are Still Missing
It is not yet clear how Search as Code performs outside Perplexity’s reported evaluations, how reproducible the benchmark results are, or how much of the gain comes from the architecture versus Perplexity’s own search stack, data access and tuning. The supplied material also does not establish whether Perplexity will productize the system broadly, license it to developers, or keep it mainly as internal infrastructure.
Replication Will Set The Stakes
The next milestone is outside testing. Developers, researchers and competing search providers will be watching whether the reported gains hold on independent tasks, especially workloads that need evidence gathering, source verification and repeated retrieval at scale. Product adoption will also show whether programmable search becomes a standard agent layer or remains a specialized implementation inside Perplexity’s stack.
Key Questions
What did Perplexity announce?
Perplexity Research published a June 1, 2026 proposal for Search as Code, a method that lets AI agents write code to assemble search workflows from smaller primitives rather than making repeated calls to one fixed search endpoint.
Is Search as Code a brand-new idea?
The search-specific implementation appears new to Perplexity’s stack, but the broader pattern of agents using generated code to coordinate tools has earlier examples, including CodeAct, smolagents, Cloudflare Code Mode and Anthropic’s code execution work.
What results did Perplexity report?
Perplexity reports that Search as Code scored 100% accuracy in a CVE case study and reduced token use from 288.7K to 42.9K. It also says Search as Code led on four of five broader benchmarks and tied OpenAI on the fifth.
Why does token use matter here?
Lower token use can reduce cost and limit how much raw intermediate material enters a model’s context window. Perplexity’s claim is that code can keep bulk retrieval work outside the model until verified records are ready.
Are the benchmark claims settled?
No. The figures in the supplied material are reported by Perplexity. Independent replication, wider task coverage and side-by-side testing against other agent search systems remain open questions.
Source: Thorsten Meyer AI