📊 Full opportunity report: Search as Code: Perplexity Is Right About the Future — Just Not First to It on ThorstenMeyerAI.com — validation score, market gap, and execution plan.

TL;DR

Perplexity announced a new approach called Search as Code (SaC), allowing AI systems to dynamically build search pipelines. This innovation aims to improve multi-step retrieval tasks, with early benchmarks showing promising results. The concept builds on existing ideas but represents a notable engineering advance by re-architecting the search stack.

On June 1, 2026, Perplexity’s research team announced a new approach called Search as Code (SaC), designed to revolutionize how AI systems perform search tasks. This development aims to address limitations in traditional search pipelines, especially for complex, multi-step AI agent workflows, by enabling models to assemble customized retrieval programs dynamically in code. This marks a significant shift in search architecture for AI applications.

Perplexity’s SaC approach redefines the search stack into composable primitives—retrieval, ranking, filtering, and rendering—exposed as atomic components within a Python SDK. The AI model acts as the control plane, generating code that orchestrates these primitives within a secure sandbox, allowing for tailored, flexible search pipelines. This is a departure from conventional monolithic search APIs, which treat search as a fixed, one-size-fits-all process.

The company demonstrated SaC’s effectiveness through a case study targeting 200 high-severity CVEs. The system achieved 100% accuracy while reducing token usage by 85%, outperforming non-Perplexity systems that scored under 25%. The benchmarks suggest SaC enables more precise, efficient retrieval by constructing multi-stage, bespoke programs rather than relying on repeated API calls. The approach also led to improvements across multiple benchmark tests, with SaC leading in four out of five.

While these results are promising, critics note that some benchmarks were internally developed by Perplexity, and comparisons across models running on different architectures introduce uncertainties. The core concept of executing code for search is not new; it builds on prior work like CodeAct (ICML 2024) and recent efforts by other organizations, but Perplexity’s engineering of the primitive stack is a notable innovation.

At a glance
reportWhen: announced June 1, 2026
The developmentPerplexity unveiled Search as Code, a new method for AI search that enables dynamic, code-based retrieval pipelines, claiming significant efficiency gains.
Search as Code — Perplexity SaC, in context
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
50 AI Agents Every Developer Must Build: The Complete Guide to Building Scalable, Production-Ready Autonomous Systems with LangChain, LangGraph, and Python

50 AI Agents Every Developer Must Build: The Complete Guide to Building Scalable, Production-Ready Autonomous Systems with LangChain, LangGraph, and 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
Amazon

Python SDK for search primitives

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Implications for AI Search and Retrieval Efficiency

This development signals a potential paradigm shift in AI search technology, emphasizing flexibility, control, and efficiency. By enabling models to generate and execute customized search pipelines, SaC could significantly improve multi-step reasoning, reduce costs, and enhance accuracy in complex retrieval tasks. It also underscores a broader trend toward integrating code execution within AI workflows, moving beyond fixed APIs to more dynamic, programmable systems.

For developers and organizations deploying AI agents, this approach offers a way to tailor search processes precisely to specific tasks, potentially leading to more robust and scalable solutions. However, the reliance on custom code generation raises questions about standardization, security, and reproducibility, which remain to be fully addressed.

A Simple Guide to Retrieval Augmented Generation

A Simple Guide to Retrieval Augmented Generation

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Evolution of Search Architectures and Related Work

The idea of turning tools and retrieval mechanisms into executable code within AI systems is not new. The CodeAct paper (ICML 2024) demonstrated that models trained on code can outperform traditional tool-call formats, with success rates up to 20% higher. Similarly, in November 2025, Anthropic published research on loading tools as sandboxed code to reduce context size and improve scalability, aligning with the principles behind SaC.

Prior to this, companies like Hugging Face and Cloudflare had developed frameworks (e.g., SmolAgents, Code Mode) that leverage code execution for flexible AI workflows. Perplexity’s innovation lies in re-architecting its entire search stack into modular primitives, a move that requires significant engineering effort and may be difficult for competitors to replicate exactly, but the core concept remains rooted in earlier research and industry trends.

“Search as Code transforms how AI systems can control retrieval processes, enabling dynamic, task-specific pipelines that were previously impossible.”

— Thorsten Meyer, Perplexity Research Lead

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.

Unverified Benchmarks and Model Comparisons

Some benchmarks where SaC shows the largest gains are internally developed by Perplexity, such as WANDR, which has not been independently validated. Comparisons across different models—GPT-5.5 for SaC and OpenAI, Opus 4.7 for others—introduce uncertainties about the true performance gains attributable solely to the architecture. Furthermore, the approach’s scalability and security implications are still under discussion, and broader community validation is pending.

Next Steps for Validation and Adoption

Further independent testing is needed to confirm SaC’s performance across diverse tasks and benchmarks. Perplexity is likely to release more detailed technical documentation and open-source components to facilitate external validation. Industry adoption may follow if the method proves robust and scalable in real-world deployments, with potential integration into existing AI toolkits and frameworks.

Additionally, ongoing research will explore security, standardization, and best practices for code-generated retrieval pipelines, shaping the future landscape of AI search architectures.

Key Questions

How does Search as Code differ from traditional search methods?

Search as Code allows AI systems to generate and execute customized retrieval pipelines in code, rather than relying on fixed, monolithic search APIs. This enables more flexible, task-specific search processes.

What are the main benefits of SaC according to Perplexity?

SaC offers higher accuracy in complex retrieval tasks, reduced token usage, and improved control over search processes, making AI agents more efficient and adaptable.

Are these results verified by independent researchers?

No, some benchmarks are internally developed by Perplexity and have not yet been independently validated. External validation is expected in the coming months.

Is turning search into executable code a new idea?

No, the concept has been explored in prior research like CodeAct (ICML 2024) and by other organizations. Perplexity’s contribution is in re-architecting its search stack into modular primitives.

What are the potential risks or downsides of SaC?

Potential concerns include security risks from executing generated code, challenges in standardization, and ensuring reproducibility across different systems and models.

Source: ThorstenMeyerAI.com

You May Also Like

Technology Is Never Neutral: Pope Leo XIV’s AI Encyclical, and the Empty Chairs in the Room

Pope Leo XIV’s first encyclical addresses AI’s moral risks, highlighting the importance of ethical builders like Anthropic amid concerns over technology’s societal impact.

Tech Misfires 2025: Biggest Tech Failures and What We Learned

Just when you thought tech was infallible, 2025’s failures reveal critical lessons we can’t afford to ignore.

One markdown file, publish-ready for every platform

A web tool now enables creators to convert a single markdown file into platform-ready formats, streamlining content distribution for newsletters, blogs, and social media.

When a Content Network Starts Publishing to Itself

A large automated publishing network is unintentionally prioritizing some sites over others, leading to lopsided content distribution and potential SEO issues.