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 launched a new search architecture called Search as Code, allowing AI agents to dynamically build retrieval pipelines. This approach improves accuracy and reduces token usage, positioning Perplexity ahead in AI search innovation, though some claims need independent validation.

Perplexity has unveiled Search as Code (SaC), a new search architecture that enables AI agents to assemble custom retrieval pipelines dynamically, marking a significant shift in how search is integrated into AI systems. This development aims to address the limitations of traditional search methods for multi-step, agent-driven tasks, making it highly relevant for advancing AI capabilities.

On June 1, 2026, Perplexity’s research team published a detailed explanation of SaC, arguing that conventional search systems are too rigid for the needs of modern AI agents. Instead of treating search as a static endpoint that returns a fixed set of results, SaC exposes core components—retrieval, filtering, ranking, and rendering—as atomic primitives accessible through a Python SDK. This allows AI models to generate code that constructs tailored search pipelines on the fly.

The approach involves three layers: the model as the control center that writes retrieval code, a sandbox environment for executing this code deterministically, and the primitive set of search functions. The goal is to give models granular control over the search process, enabling more precise and context-aware retrieval strategies. A key insight is that code acts not only as an orchestrator but also as a gap-filler, allowing complex, custom operations like regex filtering or parallel fetching without bloating the SDK.

Perplexity demonstrated SaC’s effectiveness through a case study focused on identifying and characterizing over 200 high-severity vulnerabilities (CVEs). The system achieved 100% accuracy while reducing token usage by 85%, outperforming other systems that scored under 25%. Benchmark tests across multiple tasks showed SaC leading in four out of five, with performance gains up to 2.5 times over competitors. These results suggest SaC’s potential to significantly enhance AI search capabilities, especially in complex, multi-step tasks.

At a glance
reportWhen: announced June 1, 2026
The developmentPerplexity announced on June 1, 2026, the release of Search as Code, a novel framework for AI-driven search architecture designed for agent-level 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
Agentic AI Builder Blueprint 2026: Build Practical AI Agents, RAG Apps, MCP Workflows, Automation Systems, Evaluation Pipelines, and Production-Ready LLM Tools Step by Step

Agentic AI Builder Blueprint 2026: Build Practical AI Agents, RAG Apps, MCP Workflows, Automation Systems, Evaluation Pipelines, and Production-Ready LLM Tools Step by Step

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

programmatic search API SDK

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Implications for AI Search and Agent Capabilities

The introduction of Search as Code represents a major step toward more flexible, efficient, and precise AI search systems. By enabling models to generate and execute custom retrieval pipelines, this approach could dramatically improve performance in tasks requiring complex information gathering, reasoning, and decision-making. It positions Perplexity as a leader in AI search innovation, potentially influencing the development of future AI systems that rely heavily on dynamic, code-driven search strategies.

However, the approach also raises questions about reproducibility and independent validation, as some benchmark results are based on proprietary or self-created tests. The broader AI community will need to assess whether SaC’s advantages hold across diverse real-world applications and models.

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.

Evolution of Search Architectures in AI Agents

Traditional search systems, including those optimized for AI, have relied on fixed pipelines that accept a query and return a static set of results. This model works well for simple, one-off queries but struggles with multi-step, agent-driven tasks that require frequent, fine-grained retrieval operations. Starting around 2022, AI companies began experimenting with more flexible search architectures, including tool-based approaches and code-based retrieval strategies.

Perplexity’s SaC builds on prior work, such as the CodeAct framework (ICML 2024) and Anthropic’s MCP system (November 2025), which demonstrated that turning tools into executable code in a sandbox can drastically reduce context size and improve agent performance. While these ideas are not entirely new, Perplexity’s engineering effort to re-architect its search stack into composable primitives is a notable advancement, enabling more granular control over search processes.

“Perplexity’s Search as Code is a significant engineering achievement that could redefine how AI systems perform complex search tasks.”

— Thorsten Meyer, AI researcher

Spring Boot 4 with AI Microservices: Design Enterprise-Grade Generative AI, RAG Pipelines, AI Agents, and Cloud-Native Java Systems (Morden developer toolkit Book 2)

Spring Boot 4 with AI Microservices: Design Enterprise-Grade Generative AI, RAG Pipelines, AI Agents, and Cloud-Native Java Systems (Morden developer toolkit Book 2)

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Validation and Reproducibility of Benchmark Results

Most of SaC’s performance claims are based on proprietary benchmarks or tests conducted internally by Perplexity. The most significant benchmark, WANDR, has not been independently validated, raising questions about reproducibility. Additionally, the comparison involves different models running on different hardware or configurations, which complicates direct performance assessments. There is also uncertainty about how well SaC generalizes beyond the specific tasks tested, especially in real-world, multi-domain scenarios.

Independent Testing and Broader Adoption of SaC

Next steps include independent replication of Perplexity’s benchmarks, broader testing across diverse models and tasks, and potential integration into commercial AI products. The AI community will likely scrutinize SaC’s architecture, especially its scalability and robustness in real-world applications. Perplexity may also release more detailed technical documentation or open-source components to facilitate external validation and adoption.

Key Questions

How does Search as Code differ from traditional search methods?

SaC allows AI models to generate and execute custom retrieval pipelines using primitive search components, rather than relying on fixed, monolithic search endpoints. This enables more flexible, precise, and context-aware search strategies tailored to each task.

What are the main advantages of SaC according to Perplexity?

SaC improves accuracy, reduces token usage, and provides granular control over search processes, leading to better performance in complex, multi-step tasks involving large-scale retrieval.

Are the benchmark results from Perplexity independently verified?

No, most results are from internal or proprietary benchmarks; independent validation is still pending, and some results, like those from WANDR, have not been independently replicated.

Will SaC be available for wider use?

It is not yet clear. Next steps include external testing, potential open-sourcing, and integration into commercial products, but no specific release timeline has been announced.

Does this mean Perplexity is the first to develop such a system?

No, the concept of turning tools into executable code for agents has been explored by other research, such as the CodeAct framework and Anthropic’s MCP system. Perplexity’s contribution lies in its engineering of a re-architected, primitive-based search stack.

Source: ThorstenMeyerAI.com

You May Also Like

Disk Is the Contract: Inside Threlmark’s Local-First Architecture

Threlmark treats disk storage as the definitive source of truth, enabling offline use, portability, and simplicity without relying on traditional databases.

The labor share. Is value really moving from labor to capital? The data isn’t on anyone’s side yet.

Examining whether AI is truly reallocating value from labor to capital, with current data showing stable aggregate labor share but rising marginal signals.

Threlmark: Disk Is the Contract

Threlmark launches a new approach where the roadmap is a plain JSON file on disk, enabling open, interoperable, and durable planning tools.

“This is going to be a niche device” – Analysts react to the $1,000+ Steam Machine price reveal

Experts say the new Steam Machine priced over $1,000 will appeal to a niche audience, raising questions about its market impact and future prospects.