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 method called Search as Code, allowing AI systems to dynamically assemble search pipelines using code. This approach aims to improve accuracy and control in AI search tasks, with early benchmarks showing promising results. The development builds on prior ideas but re-architects search stacks for better agent performance.

Perplexity announced the release of Search as Code (SaC) on June 1, 2026, a new framework that allows AI agents to assemble custom search pipelines dynamically using code. This approach aims to address limitations in traditional search methods, especially for complex, multi-step tasks, by exposing the search stack as composable primitives that models can control directly. The development marks a significant shift in how search is integrated into AI systems, emphasizing flexibility and precision.

Perplexity’s Search as Code approach involves breaking down the search process into atomic components—retrieval, filtering, ranking, and rendering—that are accessible via a Python SDK. The AI model acts as the control plane, generating code to orchestrate these components in real-time, rather than relying on a monolithic search API. This enables models to adapt search strategies on the fly, improving control and efficiency.

In their case study, Perplexity demonstrated SaC’s effectiveness by identifying over 200 high-severity CVEs with 100% accuracy, while reducing token usage by 85%. The system used a multi-stage retrieval pipeline, combining vendor-specific templates, targeted refinements, and schema-bound verification, illustrating how models can write bespoke retrieval programs. Benchmarks across multiple datasets showed SaC outperforming existing systems, with up to 2.5× better results on WANDR and improvements on four out of five tests.

While promising, the company acknowledges that some benchmarks are proprietary, and comparisons involve different models, which introduces some uncertainty about the results’ generality. The approach is rooted in prior research, notably the CodeAct framework and recent work by Anthropic, which advocate transforming tool calls into executable code within sandboxed environments.

At a glance
reportWhen: announced June 1, 2026
The developmentPerplexity has launched Search as Code (SaC), a new framework for AI search that enables models to create custom retrieval pipelines by writing and executing code, aiming to enhance agent capabilities.
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
Python No Spill Clean and Fill Aquarium Maintenance System, Gravel Cleaner and Water Changer, 50 Foot

Python No Spill Clean and Fill Aquarium Maintenance System, Gravel Cleaner and Water Changer, 50 Foot

Will not disturb fish or decor during routine aquarium maintenance

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
JCTLIYXG Multi Surface Pipe Profiling Tool, Pipe Cutting Template Multi Functional Shape Duplicator, Lightweight and Wear-Resistant Fiberglass Material for Tiles Floors DIY Pro Plumbing (0-6" Pipes)

JCTLIYXG Multi Surface Pipe Profiling Tool, Pipe Cutting Template Multi Functional Shape Duplicator, Lightweight and Wear-Resistant Fiberglass Material for Tiles Floors DIY Pro Plumbing (0-6" Pipes)

Multi-Surface Shaping with Precision: Achieve accurate pipeline shaping and surface shaping at any angle. This pipe profile tool…

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Implications for AI Search and Agent Control

This development signals a potential paradigm shift in how AI systems perform search tasks, emphasizing flexibility, control, and efficiency. By enabling models to write and execute custom retrieval pipelines, SaC could significantly improve performance on complex, multi-step queries and reduce costs associated with large language models.

It also demonstrates a move toward more programmable AI systems, where control over search processes is embedded within the model’s reasoning, rather than relying solely on fixed APIs. This could influence future AI architectures, encouraging more modular and adaptable search frameworks that better serve agent-based applications in enterprise, research, and consumer domains.

However, the approach’s novelty is partly evolutionary, building on existing ideas about code-based tool integration. Its success depends on wider adoption and independent validation, especially given the proprietary benchmarks and model comparisons involved.

Amazon

custom retrieval and ranking software

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Prior Work on Code-Driven Search and Agent Architectures

The concept of transforming tool calls into executable code within AI agents has been explored in recent research, notably the CodeAct paper (ICML 2024), which showed improved success rates across multiple models. Similarly, in late 2025, Anthropic published work on loading tools as sandboxed code to reduce context size and improve scalability.

Perplexity’s innovation lies in re-architecting its entire search stack into atomic primitives, enabling the model to control the search process directly, rather than relying on external APIs or monolithic endpoints. While the idea is not entirely new, their engineering effort to rebuild the search stack as a composable, code-driven system is notable.

Critics point out that some of the benchmarks used to demonstrate SaC’s effectiveness are proprietary or self-created, which warrants cautious interpretation until independent replication occurs.

“Transforming search into a programmable, code-based process could be a game-changer for AI agents, enabling unprecedented control and efficiency.”

— Thorsten Meyer, AI researcher

Amazon

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Independent Validation and Benchmark Transparency

It is not yet clear how well SaC will perform outside of Perplexity’s internal benchmarks, which include proprietary tests like WANDR. Independent replication and validation by third parties are needed to confirm the claimed performance gains. Additionally, some comparisons involve different models and configurations, complicating direct assessment of SaC’s relative advantages.

Further, the benchmarks used are either self-developed or not fully published, raising questions about their objectivity and reproducibility.

Broader Adoption and External Testing of SaC

The next steps involve wider testing by independent researchers and developers to verify SaC’s effectiveness across diverse tasks and environments. Perplexity is expected to release more detailed documentation and open some benchmarks for external evaluation. Future updates may include integrating SaC into broader AI platforms and exploring its scalability for enterprise use cases.

Monitoring how the AI community responds and whether other vendors adopt similar architectures will be key to understanding SaC’s long-term impact.

Key Questions

How does Search as Code differ from traditional search methods?

Instead of using a fixed search API, SaC exposes the search stack as composable primitives that models can control by writing code, enabling dynamic, task-specific retrieval pipelines.

What are the main benefits of SaC according to Perplexity?

SaC offers higher accuracy, reduced token costs, and greater flexibility for complex, multi-step search tasks by allowing models to orchestrate search processes directly.

Has SaC been independently tested outside of Perplexity?

No, independent validation is still pending. Most results come from Perplexity’s internal benchmarks, some of which are proprietary.

Is this approach entirely new?

The idea of turning tool calls into executable code has been explored previously, but Perplexity’s contribution is in re-architecting its entire search stack into a modular, programmable system.

What are potential challenges for adopting SaC?

Wider adoption depends on external validation, integration complexity, and whether the approach scales effectively across different tasks and models.

Source: ThorstenMeyerAI.com

You May Also Like

Forward-Deployed: The Integration Wall, and the Role That Now Pays $700K to Climb It

Forward-Deployed Engineers now command up to $700K in total compensation, becoming the highest-paid IC role in tech due to their critical integration work.

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

Analysis of when owning and operating open-weight AI models becomes more cost-effective than paying for API access, based on recent developments in hardware and model performance.

The Power Bottleneck: AI Data Centers and the Grid Cliff Approaching 2027-2028

AI data centers face a power bottleneck as grid expansion delays threaten to limit hyperscaler growth by 2027-2028, impacting AI deployment and costs.

CTOs Are Escaping

Senior CTOs and technical leaders are shifting from conventional SaaS companies to roles at Anthropic, focusing on model-layer work and AI innovation.