Search as Code: Perplexity Is Right About the Future — Just Not First to It

📊 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 has developed a new approach called Search as Code, allowing AI systems to create custom retrieval pipelines via code, leading to significant improvements in accuracy and token efficiency. The development builds on prior research, but its practical deployment and benchmarks are still under evaluation.

Perplexity has unveiled Search as Code (SaC), a novel framework that allows AI models to dynamically assemble and execute custom search pipelines by writing code in real-time. This development aims to address the limitations of traditional search systems, especially in multi-step, agent-based tasks, and is now being shipped as part of Perplexity’s offerings.

On June 1, 2026, Perplexity’s research team announced the release of Search as Code, which transforms the way AI systems handle search operations. Instead of relying on fixed search endpoints that accept queries and return static results, SaC exposes the search stack’s components—retrieval, filtering, ranking, and rendering—as atomic, programmable primitives accessible via a Python SDK.

This architecture enables AI models to generate and execute code that orchestrates search processes tailored to specific tasks, allowing for greater control and adaptability. The approach was demonstrated through a case study involving the identification and characterization of over 200 high-severity vulnerabilities. The results showed 100% accuracy and an 85% reduction in token usage compared to traditional systems, with the model writing multi-stage retrieval programs instead of repeatedly calling a single API endpoint.

Perplexity reports that SaC outperforms existing systems on multiple benchmarks, including WANDR, where it achieved a 2.5× improvement over rivals. The system’s design incorporates a three-layer setup: the model as the control plane, a sandbox for execution, and the primitive set of search components. This architecture emphasizes that code is not only orchestrator but also a gap-filler, enabling precise and efficient retrieval strategies.

At a glance
updateWhen: announced June 1, 2026
The developmentPerplexity announced on June 1, 2026, that it is shipping Search as Code, a new framework for AI-driven search pipelines that enhances control, accuracy, and efficiency.
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
Amazon

Python SDK for search pipelines

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

AI search pipeline tools

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Implications of Search as Code for AI Search Strategies

This development signals a shift toward more flexible, controllable, and efficient AI search systems, especially for complex, multi-step tasks performed by autonomous agents. By enabling models to assemble custom retrieval pipelines, SaC may significantly improve accuracy and reduce operational costs, setting a new standard for AI-driven search architectures.

While the results are promising, the approach’s adoption depends on independent validation of benchmarks, understanding its scalability, and assessing how broadly it can be integrated into existing AI workflows. The concept aligns with prior research advocating code-based tool integration, but Perplexity’s engineering effort to re-architect its search stack is a notable advance.

Amazon

custom search engine software

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Background on Search Architectures and Related Research

Traditional search systems treat search as a fixed pipeline, which limits flexibility in multi-step, agent-based AI tasks. The idea of using code to orchestrate search processes is not new; prior research, such as the ICML 2024 CodeAct paper, demonstrated that models trained on code outperform those using predefined tool calls. Similarly, Anthropic’s 2025 work on code execution with MCP argued that turning tools into code APIs reduces context overhead and improves performance.

Perplexity’s innovation lies in re-architecting its search stack into atomic primitives, enabling models to write and execute tailored retrieval programs dynamically. This approach builds on the broader trend of integrating code execution into AI workflows, but its specific implementation for search pipelines is a recent and practical evolution.

“Search as Code represents a meaningful step toward more controllable and efficient AI search systems, leveraging code to orchestrate retrieval processes dynamically.”

— Thorsten Meyer, AI researcher

Amazon

search as code development kit

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Unverified Aspects and Benchmark Reliability

Several aspects of the development remain unconfirmed or uncertain. The most significant is that the benchmark where SaC achieved the largest margin, WANDR, was internally developed by Perplexity, raising questions about independent validation. The results on pre-existing benchmarks are more credible, but the overall generalizability and scalability of SaC are still unproven. Additionally, the comparison involves different models and configurations, which complicates direct attribution of performance gains solely to the SaC architecture.

It is also unclear how well SaC will perform in real-world, large-scale deployments, or how it compares when integrated with other models or systems outside Perplexity’s environment. The long-term operational stability and cost implications are still under assessment.

Next Steps for Validation and Adoption of SaC

Further independent testing and replication of benchmarks like WANDR are needed to confirm SaC’s advantages. Perplexity is expected to publish more detailed results and possibly open-source components of their system, which will facilitate broader evaluation. Industry observers will monitor how quickly other AI providers adopt similar architectures or incorporate code-based search orchestration. Additionally, real-world pilot deployments and scalability tests will determine how practical and impactful SaC can be in commercial AI applications.

Key Questions

What is Search as Code and why is it important?

Search as Code is an approach that enables AI models to generate and execute custom search pipelines by writing code, rather than relying on fixed search endpoints. It allows for more flexible, precise, and efficient retrieval strategies, especially in complex, multi-step tasks performed by autonomous agents.

Has Perplexity proven that Search as Code works in real-world applications?

Perplexity has demonstrated promising results through internal benchmarks and a case study on vulnerability analysis, but independent validation and real-world deployment data are still pending. Its broader effectiveness remains to be confirmed.

How does Search as Code compare to previous AI retrieval methods?

Unlike traditional fixed pipelines or tool-call formats, SaC allows models to write tailored, multi-stage retrieval programs, leading to higher accuracy and token efficiency. It builds on prior research but offers a new, re-architected system for search operations.

What are the main limitations or uncertainties around SaC?

The biggest uncertainties involve the independence and reproducibility of benchmark results, the system’s scalability in large deployments, and how well it generalizes beyond controlled test cases. Further validation is needed.

What happens next for Perplexity’s Search as Code development?

Perplexity is expected to publish more detailed results, open-source components, and conduct real-world tests to validate SaC’s performance. Industry adoption and independent replication will shape its future impact.

Source: ThorstenMeyerAI.com

You May Also Like

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

A critical look at Dario Amodei’s transparency and its strategic implications for Anthropic amid recent government actions on AI models.

India: Build the Rails First

India has built a digital infrastructure for direct benefit transfer, focusing on scalable, low-cost delivery rather than generous benefits. The impact and ongoing challenges are examined.

One Model, a Whole Portfolio: What Ten Days on Fable Mean for a Business Building on Frontier AI

A solo experiment with Anthropic’s Claude Fable 5 demonstrated how one AI model can manage an entire business portfolio, highlighting new operational possibilities.

The conversion. What turning the largest nonprofit into a company did to charity law.

OpenAI transformed from a nonprofit into a company retaining control, diverging from standard divestiture practices, raising legal and ethical questions.