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 announced a new approach called Search as Code (SaC), allowing AI systems to build custom retrieval pipelines in code instead of using fixed search APIs. Early results show high accuracy and efficiency, but the idea is not entirely new, and some claims require independent verification.

Perplexity has introduced a new framework called Search as Code (SaC), which allows AI systems to construct custom retrieval pipelines dynamically in code rather than relying on fixed search APIs. This development aims to improve accuracy and control in AI search operations, addressing limitations of traditional search methods in agent-based tasks.

On June 1, 2026, Perplexity’s research team published a detailed argument for replacing traditional search with SaC, emphasizing the ability of AI agents to write and execute code that orchestrates retrieval, filtering, and ranking processes. Their approach involves exposing the components of the search stack as atomic primitives accessible via a Python SDK, enabling models to create tailored pipelines on the fly.

The core claim is that SaC enables AI models to outperform conventional search methods significantly. In a case study focused on identifying and characterizing over 200 high-severity vulnerabilities (CVEs), SaC achieved 100% accuracy while reducing token usage by 85% compared to other systems. These results are based on a multi-stage retrieval process where the model writes bespoke code to query vendor advisories, refine results, and verify data, rather than repeatedly calling a monolithic search endpoint.

Perplexity reports that SaC outperforms existing benchmarks on four out of five tests, tying on the fifth, and demonstrates a 2.5× advantage on their proprietary WANDR benchmark. The approach also shows lower cost at high reasoning settings, indicating efficiency gains. However, some of the benchmark results are based on internal tests not yet independently verified, and comparisons involve different models and configurations, raising questions about the robustness of the claims.

At a glance
reportWhen: announced June 1, 2026
The developmentPerplexity has launched Search as Code, a new framework that enables AI agents to dynamically assemble search pipelines in code, claiming performance benefits.
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 for AI Search and Retrieval Efficiency

This development signals a potential shift in how AI systems handle search tasks, moving from static APIs to dynamic, code-based retrieval pipelines. If validated, SaC could enable AI agents to perform more complex, multi-step tasks with higher accuracy and lower resource consumption. It also underscores the trend toward integrating programming and reasoning directly into AI workflows, which could influence future AI architecture designs and commercial search implementations.

For users and developers, this offers the promise of more adaptable and precise search capabilities, especially in scenarios requiring multi-faceted data gathering and verification. However, the reliance on custom code generation and execution introduces new challenges around security, robustness, and standardization that will need addressing as the approach matures.

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.

Evolution of Search and Agent Architectures

The idea of turning tools into executable code for AI agents is not new. The concept was formalized in the CodeAct paper (ICML 2024), which demonstrated that models trained on code outperform those using predefined tool calls. Cloudflare’s Code Mode and Anthropic’s MCP also explored similar ideas, emphasizing the benefits of sandboxed code execution for high-scale agent tasks.

Perplexity’s innovation lies in re-architecting its search stack into atomic primitives, enabling the model to assemble custom retrieval pipelines in code. While the core concept is not entirely novel, the engineering effort to rebuild the search infrastructure into a composable, programmable framework is significant and distinguishes their approach. The broader trend points toward more flexible, code-driven AI workflows, but widespread adoption remains uncertain pending further validation.

“Perplexity’s Search as Code represents a meaningful step toward more flexible, precise AI retrieval systems, but the core idea is a continuation of existing research rather than a revolutionary breakthrough.”

— Thorsten Meyer, AI researcher

RAG-Driven Generative AI: Build custom retrieval augmented generation pipelines with LlamaIndex, Deep Lake, and Pinecone

RAG-Driven Generative AI: Build custom retrieval augmented generation pipelines with LlamaIndex, Deep Lake, and Pinecone

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Validation and Replication of Performance Claims

Many of the benchmark results, including the proprietary WANDR test, are based on internal testing and have not yet been independently verified. The comparisons involve different models and configurations, which complicates direct assessment of SaC’s true performance advantages. It remains unclear how well SaC will perform across a broader range of real-world tasks and datasets.

Additionally, the approach’s security, robustness, and scalability in production environments are still untested at scale, and the industry will need time to evaluate these aspects thoroughly.

Independent Testing and Industry Adoption Timeline

Further validation by independent researchers and third-party benchmarks will be critical to confirm SaC’s effectiveness. Expect academic and industry labs to attempt replication over the coming months. Meanwhile, Perplexity is likely to continue refining its framework, with potential updates to its search infrastructure and broader integration into commercial products. Monitoring how the approach scales and performs in diverse applications will determine its long-term impact.

Key Questions

How does Search as Code differ from traditional search APIs?

SaC allows AI models to write and execute code that dynamically assembles retrieval pipelines, rather than relying on fixed, monolithic search endpoints. This provides greater flexibility, control, and efficiency for complex, multi-step tasks.

Are the performance improvements claimed by Perplexity confirmed?

The results are based on internal benchmarks and a proprietary test suite. Independent verification is pending, and comparisons involve different models and configurations, so caution is advised before generalizing these findings.

Is this approach applicable to all AI search systems?

While the concept of turning tools into code is broadly applicable, the specific engineering effort required to re-architect search stacks into primitives is substantial. Widespread adoption depends on validation, scalability, and integration challenges.

What are the potential risks of using code-generated search pipelines?

Security and robustness concerns include code injection, sandboxing failures, and unexpected behavior. Proper safeguards and testing are essential before deploying in production environments.

When can we expect broader industry adoption of Search as Code?

Industry adoption will depend on independent validation, performance in real-world applications, and the development of standards for safe, scalable implementation. It may take months to years for widespread integration.

Source: ThorstenMeyerAI.com

You May Also Like
SpaceX Owns Every Layer of AI Now. The Model Is Still the Weak Link.

SpaceX Owns Every Layer of AI Now. The Model Is Still the Weak Link.

SpaceX has purchased Cursor for $60 billion, gaining control over every layer of AI infrastructure, yet the core AI model still shows vulnerabilities.
RHEO On The Web: Find Your Flow

RHEO On The Web: Find Your Flow

Discover RHEO’s web version — a private, instant, browser-based fluid simulation for calm, creativity, and ambient displays, with no sign-up or downloads.
The Delegation Ladder: The Four Agentic Loops, And What Each One Lets You Stop Doing

The Delegation Ladder: The Four Agentic Loops, And What Each One Lets You Stop Doing

Exploring the four agentic loops in AI engineering, how they enable automation, and what each one allows you to stop doing.
The prospectus. Where the AI labs’ singular governance history meets the auditor.

The prospectus. Where the AI labs’ singular governance history meets the auditor.

OpenAI is preparing to file its IPO prospectus, exposing its complex governance structure and legal history, which pose risks for investors and regulators.