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 build custom retrieval pipelines dynamically. This innovation aims to improve search control and efficiency for AI agents, with promising benchmark results. However, some claims require independent validation.

Perplexity has introduced Search as Code (SaC), a new framework that allows AI models to assemble custom retrieval pipelines dynamically, rather than relying on traditional fixed search APIs. This development aims to address limitations in current search methods when used by AI agents for complex, multi-step tasks. The announcement underscores a shift toward more flexible, controllable search mechanisms designed specifically for agent-driven AI workflows.

Perplexity’s SaC approach exposes core components of the search stack — such as retrieval, filtering, ranking, and rendering — as atomic, programmable primitives within a Python SDK. The AI model acts as the control plane, generating code that orchestrates these primitives in a sandboxed environment, enabling tailored search pipelines for each task. This design departs from traditional monolithic search endpoints, offering greater control and adaptability.

The company demonstrated SaC’s effectiveness through a case study involving the identification and characterization of over 200 high-severity vulnerabilities (CVEs). In this test, SaC achieved 100% accuracy while reducing token usage by 85%, outperforming non-Perplexity systems that scored under 25%. The process involved a three-stage pattern: broad fan-out over vendor advisories, targeted refinements via an LLM, and a schema-bound verifier to ensure precision. These results suggest that models can generate bespoke, multi-stage retrieval programs instead of repeatedly hitting a single search endpoint.

Benchmark tests across multiple datasets showed SaC leading in four out of five tests, tying for first on a fifth, and surpassing competitors by up to 2.5 times on certain metrics. Cost-performance analyses also indicated that even low-reasoning settings with SaC outperform most rivals at lower costs. These findings highlight the potential for SaC to improve both search accuracy and efficiency in agent-based AI systems.

At a glance
reportWhen: announced June 1, 2026
The developmentOn June 1, 2026, Perplexity revealed its Search as Code framework, transforming how AI systems handle search and retrieval tasks for agent-driven workflows.
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

programmable search primitives

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Implications for AI Search and Retrieval Control

This development signals a shift toward more flexible and controllable search mechanisms for AI agents, enabling them to adapt retrieval strategies dynamically based on the task. By exposing core search components as programmable primitives, SaC could significantly enhance the precision and efficiency of AI-driven information gathering, especially for complex, multi-step workflows. If widely adopted, this approach may redefine standards for AI search systems, making them more adaptable and capable of handling diverse, high-stakes tasks.

However, the approach’s novelty and effectiveness are still subject to validation. The benchmark results, though promising, are based on proprietary tests and a new, self-authored dataset. The broader AI community will need to verify these claims through independent replication before SaC’s full impact is confirmed.

Introdução à Programação com Python

Introdução à Programação com Python

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Evolution of Search for AI Agents

Traditional search systems, inherited from human-era paradigms, treat search as a fixed pipeline that returns a static set of results for each query. This model sufficed when AI systems made single, isolated queries. However, as AI agents take on more complex, multi-step tasks, the limitations of monolithic search endpoints become apparent, especially in controlling retrieval, filtering, and assembly of information.

The concept of turning search into programmable code is not entirely new. The idea was formalized in the CodeAct paper (ICML 2024), which demonstrated that models trained on extensive codebases can generate more effective retrieval strategies. Similarly, companies like Hugging Face and Cloudflare have developed frameworks for turning tools into executable code, emphasizing the importance of code-based approaches for scalable, flexible AI actions. Prior work by Anthropic and others has shown that embedding tools as APIs within a sandbox environment can significantly reduce context size and improve efficiency.

Perplexity’s innovation lies in re-architecting its own search stack into atomic primitives, a move that requires substantial engineering effort and could be difficult for others to replicate without similar infrastructure.

“Search as Code transforms how AI models control retrieval, enabling bespoke pipelines that adapt to complex tasks.”

— Thorsten Meyer, AI researcher at Perplexity

A Simple Guide to Retrieval Augmented Generation

A Simple Guide to Retrieval Augmented Generation

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Independent Validation and Broader Adoption Unclear

While Perplexity reports impressive benchmark results, these are based on proprietary tests and a new, internally developed dataset. Independent replication by third parties is not yet available, and the performance on broader, real-world tasks remains to be seen. Questions also remain about the scalability of SaC and its integration into existing AI systems, as well as whether other organizations can replicate the engineering effort required to re-architect their search stacks similarly.

Verification, Replication, and Industry Adoption

Next steps include independent validation of SaC’s performance through external benchmarks and real-world use cases. Researchers and industry players will likely test the approach in diverse environments to assess scalability and robustness. Additionally, further development may focus on integrating SaC into broader AI platforms, and Perplexity might release open-source tools or APIs to facilitate adoption. Monitoring how competitors respond with similar innovations will also be key to understanding SaC’s long-term impact.

Key Questions

What is Search as Code (SaC)?

Search as Code is a framework that allows AI models to generate, customize, and execute retrieval pipelines dynamically by assembling atomic search primitives as code, rather than relying on fixed search APIs.

How does SaC improve search for AI agents?

SaC provides greater control and flexibility, enabling AI agents to tailor search strategies on the fly, which can lead to higher accuracy and efficiency in complex, multi-step tasks.

Are the benchmark results from Perplexity confirmed by independent sources?

No, the results are based on proprietary tests. Independent validation is needed to confirm SaC’s performance claims across broader applications.

Can other companies implement similar search architectures?

While technically feasible, re-architecting search stacks into atomic primitives requires significant engineering effort, which may limit immediate adoption outside of organizations with substantial resources.

What are the main challenges remaining for SaC’s adoption?

Key challenges include validation of performance outside of proprietary benchmarks, integration into existing AI workflows, and demonstration of scalability in diverse, real-world scenarios.

Source: ThorstenMeyerAI.com

This content is for general information only and is not financial, tax or legal advice. Consult a qualified professional for decisions about your money.
You May Also Like

The Question No To-Do App Can Answer

A new productivity tool, Threlmark, aims to identify the most important next task across multiple projects but cannot answer the fundamental question of what that task is.

Stenvrik: News as Geography

Stenvrik launches a live news platform pinning stories to 49 global hubs on a 3D globe, offering a new geographic approach to news consumption and trend detection.

The Orchestration Layer Arrives: What Anthropic’s Finance Agents Mean for Bloomberg, FactSet, and Wall Street

Anthropic releases new AI agent templates and connectors, positioning Claude as an orchestration layer over major financial data providers, challenging Bloomberg’s UI dominance.

Anchor. The Schwarz Group model.

An analysis of Schwarz Group’s €11B investment in AI infrastructure and its implications for European industrial capital models.