Search as Code: Perplexity Is Right About the Future — Just Not First to It
AIThis post was created with the assistance of artificial intelligence (AI).

📊 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.

Buying for a business?Offer from Amazon

Get business pricing on monitors, keyboards and dev gear

  • Business-only prices and quantity discounts
  • Tax-exempt purchasing
  • Multiple users, one account, clear invoices
As an affiliate, we earn on qualifying purchases.

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

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

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

Python SDK for AI search pipelines

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

AI search pipeline tools

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.

Amazon

custom retrieval and ranking software

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

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.

Amazon

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

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

EVERGREEN BESTSE

Evergreen bestsellers Picks

As an affiliate, we earn on qualifying purchases.

You May Also Like

The Future Of Counteracting Covert Russian Campaigns Using AI

OpenAI banned ChatGPT accounts linked to Russian origin supporting a covert influence network around the International Burke Institute, highlighting AI’s role in countering disinformation.

Can AI Help NTT DATA Group Speed Up Incident Analysis To Half An Hour?

NTT DATA Group claims to reduce incident analysis time to 30 minutes with OpenAI Codex, but details on measurement and scope remain undisclosed.

Discover The Top AI Developments We Unveiled In July 2026

Google announced major AI updates in July 2026, including new Gemini models and robotics system, expanding AI across software, robotics, and safety sectors.

AI Industry Alert: Zhang Yiming’s Unexpected Statement Escalates The Global Fight

ByteDance founder Zhang Yiming reportedly makes a rare public statement on AI competition, but details remain unconfirmed, raising industry concerns.