📊 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 published a new approach called Search as Code, proposing that AI agents should dynamically assemble search pipelines in code rather than rely on fixed search APIs. This method has shown promising results in tests, though some claims remain unverified or context-dependent.

Perplexity has unveiled a new search architecture called Search as Code (SaC), claiming it significantly improves the control and accuracy of AI agents during complex retrieval tasks. This development marks a shift from traditional search paradigms, emphasizing customizable, code-driven pipelines to enhance AI reasoning and task execution.

The core idea behind SaC is to replace monolithic search endpoints with a modular, programmable stack, allowing AI models to assemble retrieval, filtering, and ranking operations dynamically in code. Perplexity’s team built this system into a Python SDK, where the model generates and executes code that orchestrates the search process in a sandbox environment.

In tests focused on vulnerability identification, SaC achieved 100% accuracy while reducing token usage by 85%, outperforming conventional search systems that scored below 25%. The approach involves a three-stage process: fan-out over vendor advisories, refinement via language models, and schema-bound verification, enabling bespoke retrieval pipelines tailored to specific tasks.

Perplexity reports that SaC leads on four out of five benchmark tests, tying with OpenAI on the fifth, and surpassing competitors significantly on the WANDR benchmark. These results suggest that code-driven search pipelines can deliver both higher accuracy and efficiency, especially in complex, multi-step tasks.

At a glance
reportWhen: announced June 1, 2026
The developmentPerplexity announced on June 1, 2026, that it has developed and tested a new search architecture called Search as Code, which outperforms traditional search methods in AI agent tasks.
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
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.

Implications of Search as Code for AI Development

This development matters because it addresses fundamental limitations in how AI systems retrieve and process information, especially for multi-step, complex tasks requiring precise control. By enabling models to write and execute their own retrieval pipelines, SaC could lead to more autonomous, accurate, and efficient AI agents. However, the approach’s novelty and the claims’ preliminary nature mean that broader validation and independent replication are necessary before widespread adoption.

Digital Marketing Strategies: A Modular Guide to Acquiring, Engaging, and Retaining Customers Online

Digital Marketing Strategies: A Modular Guide to Acquiring, Engaging, and Retaining Customers Online

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Evolution of Search Architectures in AI Agents

Traditional search systems treat search as a fixed process: accept a query, retrieve results, and return a set of documents. Recent advances, including Perplexity’s answer engine launched in 2022, have begun to optimize search for AI reasoning. The concept of turning search into programmable code builds on earlier ideas from the CodeAct paper (ICML 2024) and similar frameworks like Hugging Face’s smolagents and Cloudflare’s Code Mode, which demonstrated that embedding tools as code APIs improves success rates and control in AI tasks.

Perplexity’s innovation lies in re-architecting its entire search stack into atomic primitives, allowing the system to be composed dynamically by the model. While the idea of executable code for agents is not new, applying it specifically to search pipelines at scale is a notable engineering achievement that differentiates SaC from previous approaches.

“Perplexity’s Search as Code approach significantly advances the control and flexibility of AI retrieval processes, but it builds on well-established concepts in AI tool integration.”

— Thorsten Meyer, AI researcher

The AI Content Machine: The Developer’s Blueprint to Automating Niche Sites, Engineering High-CTR Affiliate Links, and Scaling Digital Real Estate

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Validation and Independent Replication of SaC Results

While initial tests show promising results, some benchmarks are proprietary or self-designed, and independent validation remains pending. The largest performance gains were observed on a benchmark (WANDR) that Perplexity developed, raising questions about potential overfitting or bias. Comparisons across different models also involve varying hardware and configurations, which complicates definitive conclusions about SaC’s superiority.

Further, claims about the novelty of the approach are nuanced, as similar ideas have appeared in recent literature and products, indicating that SaC is an evolution rather than a revolution in search architecture.

Broader Testing and Industry Adoption of Search as Code

Next steps include independent replication of results, broader benchmarking across diverse tasks, and potential integration into commercial AI systems. Perplexity may also release more detailed technical documentation and open-source components, enabling other developers to evaluate and build upon SaC. Industry watchers will be monitoring whether this approach becomes a standard in agent-centric AI applications, especially as models grow more capable of writing and executing code in real-time.

Key Questions

How does Search as Code improve over traditional search methods?

SaC allows AI models to assemble customized retrieval pipelines dynamically in code, providing greater control, precision, and efficiency, especially for complex multi-step tasks.

Are the reported results from Perplexity independently verified?

No, the results are based on Perplexity’s internal tests. Independent validation and replication are still pending and necessary for broader acceptance.

Is Search as Code a completely new idea?

Not entirely. The concept of turning search tools into executable code has been explored in recent research and products. SaC’s innovation is in re-architecting the entire search stack into composable primitives.

Will this approach be adopted widely in the AI industry?

Potentially, if further testing confirms its advantages. Industry adoption depends on validation, ease of integration, and demonstrated improvements in real-world applications.

What are the main challenges facing Search as Code?

Key challenges include ensuring robustness across diverse tasks, validating benchmarks independently, and managing the complexity of dynamically generated code pipelines.

Source: ThorstenMeyerAI.com

You May Also Like

Boost Your Small Business Efficiency Using ChatGPT’s AI Tools

OpenAI introduces a new initiative offering training, resources, and partner tools to help small businesses leverage ChatGPT for increased productivity.

Who Were The Pioneers Of Document Processing Before AI?

Exploring the origins of document processing, key figures, and how automation has transformed the field over the past 50 years.

After the Paycheck: The Book I Wrote Because Nobody Else Would Tell the Truth About AI and Your Income

Author Thorsten Meyer releases ‘After the Paycheck,’ analyzing how AI transforms jobs, ownership, and economic security, emphasizing ownership over automation.

Apertus. The architectural template.

Apertus, a Swiss federal-research AI model with open data and multilingual support, sets a new template for European sovereign AI infrastructure.