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 announced a new approach called Search as Code (SaC), allowing AI systems to dynamically compose search pipelines in code. Early tests show significant improvements in accuracy and token efficiency, positioning SaC as a notable advancement in AI search technology.

Perplexity has unveiled a new search architecture called Search as Code (SaC) that enables AI agents to assemble custom search pipelines dynamically, moving beyond conventional fixed search endpoints. This development aims to improve accuracy and control in complex retrieval tasks, marking a significant step forward in AI search technology.

On June 1, 2026, Perplexity’s research team published a detailed explanation of SaC, proposing a shift from the traditional query-response search model to a modular, code-driven approach. SaC exposes core search functions—retrieval, filtering, ranking, and rendering—as atomic primitives within a Python SDK, allowing the AI model to generate and execute tailored code to orchestrate these components on the fly.

In their case study involving the identification of over 200 high-severity software vulnerabilities, SaC achieved 100% accuracy while reducing token usage by 85% compared to previous systems. These results suggest that SaC enables more precise and efficient retrieval, especially in multi-stage, complex tasks. The system’s architecture includes three layers: the model as the control plane, a sandbox for deterministic execution, and the primitive set for search operations.

Perplexity reports that SaC outperforms or ties with leading benchmarks in multiple tests, including DSQA, BrowseComp, WideSearch, and WANDR, often by significant margins. The approach’s core advantage is the ability to construct bespoke, multi-stage retrieval programs, rather than relying on a single, monolithic search endpoint. This flexibility is seen as a key factor in the system’s improved performance.

At a glance
reportWhen: announced June 1, 2026
The developmentOn June 1, 2026, Perplexity revealed its development of Search as Code, a method for AI systems to assemble search pipelines dynamically, marking a shift from traditional search paradigms.
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 automation

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Implications of Search as Code for AI Search Efficiency

This development is significant because it suggests a new paradigm for AI search systems, emphasizing control, flexibility, and efficiency. By enabling models to generate custom retrieval pipelines, SaC could lead to more accurate, cost-effective, and scalable AI applications across various domains where complex search and reasoning are required. It also aligns with broader trends toward integrating code execution within AI workflows, potentially transforming how AI agents interact with data sources.

Protecting User Privacy in Web Search Utilization (Advances in Information Security, Privacy, and Ethics (Aispe) Book Series)

Protecting User Privacy in Web Search Utilization (Advances in Information Security, Privacy, and Ethics (Aispe) Book Series)

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Background on Search Architectures and Recent Advances

Traditional search systems treat search as a fixed API: a query is sent, and a static set of results is returned. This model proved sufficient in the human-era of search but falls short in AI agent contexts, where multiple, rapid retrievals are needed during complex reasoning processes. Recent research, including the 2024 ICML CodeAct paper and Anthropic’s 2025 MCP work, has argued for turning tools into executable code, improving control and reducing context overhead. Perplexity’s SaC builds on these ideas by re-architecting its search stack into composable primitives, a step that requires significant engineering effort but offers tangible performance benefits.

While the conceptual foundation is not entirely new—similar ideas have appeared in academic and industry research—Perplexity’s implementation represents a notable engineering achievement. It is the first to fully reconfigure its search stack into atomic, programmable components, enabling the model to orchestrate search processes directly in code.

“SaC enables AI models to generate and execute tailored search pipelines, offering significant improvements in accuracy and efficiency.”

— Thorsten Meyer

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 Aspects and Need for Independent Validation

While early results are promising, the benchmark where SaC shows the largest gains—WANDR—is internally developed by Perplexity and has not been independently validated. Additionally, comparisons involve different models (GPT-5.5 for SaC and OpenAI, Opus 4.7 for others), which complicates direct evaluation. The broader applicability and scalability of SaC across diverse tasks remain to be tested in independent settings. The long-term benefits of this approach are still subject to further validation and real-world deployment outcomes.

Next Steps for Validation and Broader Adoption

Perplexity is expected to publish more comprehensive results, including independent benchmarks and broader testing across various models and tasks. The company may also release open-source components or APIs to allow the community to evaluate SaC’s effectiveness. Industry observers will be watching for external validation of the approach’s scalability and real-world benefits. Further research could explore integrating SaC with other AI frameworks and expanding its use cases beyond vulnerability identification.

Key Questions

How does Search as Code differ from traditional search methods?

SaC allows AI models to generate and run custom search pipelines in code, rather than relying on fixed search endpoints, enabling more flexible and precise retrieval strategies.

What are the main benefits of SaC based on Perplexity’s tests?

Early results show improved accuracy—100% in a CVE case study—and significantly reduced token usage, making retrieval more efficient and adaptable for complex tasks.

Is SaC ready for widespread deployment?

While promising, SaC’s approach is still in early stages, with validation limited to internal benchmarks. Broader testing and independent validation are needed before widespread adoption.

How does SaC relate to previous research on code-based tools for AI?

SaC builds upon academic and industry research suggesting turning tools into executable code improves control and success rates. It is a practical implementation of these ideas within a search context.

Source: ThorstenMeyerAI.com

You May Also Like

Digital Identity Wallets: Standards and Use Cases

Just how do digital identity wallets ensure security and interoperability across industries? Discover the standards and innovative use cases transforming digital identity.

The Free-Download Question: When Running Your Own Model Actually Beats Paying

Analyzing when owning AI models becomes more cost-effective than paying per token, considering hardware, operational costs, and model capabilities in 2026.

Single Digits: The April That Closed the Open-Weight Gap

In April 2026, open-weight AI models matched the performance of closed models across key benchmarks, disrupting the AI market’s pricing and strategic landscape.

Why More People Are Building Gaming Setups at Home

Just as gaming becomes more personalized, discover why building a custom setup at home is transforming players’ experiences and what you might be missing out on.