AI Models

Perplexity's Search as Code lets AI models write custom search pipelines

Perplexity introduces 'Search as Code', a new architecture where AI models write their own search workflows as Python code instead of calling fixed APIs. The approach reduces token usage by 85% in a cybersecurity benchmark and beats rivals on four out of five tests. The system is rolling out in Perplexity Computer and the Agent API.

Neura News

Neura News

Neura Market Editorial

June 7, 20264 min read
Perplexity's Search as Code lets AI models write custom search pipelines

Perplexity has unveiled a new search architecture called 'Search as Code' that lets AI models write their own search pipelines as Python code instead of relying on fixed APIs. The company says this approach delivers more accurate results while using fewer tokens.

Current AI agents face a bottleneck when tackling complex research tasks. The model writes a query, a search API returns a list of results, the model reads them, then writes the next query. This loop repeats many times. Perplexity argues that today's search engines were designed for humans who want a list of blue links, not for AI agents that need to run hundreds of searches in a few minutes. The agent can only adjust the search term; everything else is a black box.

How Search as Code works

Search as Code changes that dynamic. Instead of calling an API, the model writes a custom Python script that runs in a secure sandbox and pulls from Perplexity's search backend. Basic operations like retrieving, filtering, deduplicating, and reranking are packaged as simple SDK functions.

The architecture has three layers. At the top sits the model, which understands the task and decides on a search strategy. In the middle is the sandbox where the code executes. At the bottom is the 'Agentic Search SDK,' which breaks Perplexity's search engine into individual, mix-and-match functions.

Standard search APIs remain available for simple queries. But for difficult research, the model can go deeper. It can fire off parallel queries, filter out noise programmatically, and pull only relevant hits into its context window.

Perplexity says this is where the real gain happens. Standard search pipelines fill an agent's context window with irrelevant data because the filtering logic is fixed. When the agent writes its own filters, the context stays lean, and the model maintains its bearings across long research sessions.

Real-world test on software vulnerabilities

To demonstrate the approach, Perplexity tested it on a messy cybersecurity task. An agent had to track down 200 critical software vulnerabilities (CVEs) published between 2023 and 2025. For each one, it needed to find the official vendor advisory, the affected software, and the exact version that patched the bug. News articles or blog posts weren't counted.

With Search as Code, the model wrote a three-stage script. It ran parallel searches tailored to how specific vendors like Mozilla or Google format their security bulletins. Then it scanned its own findings, spotted gaps, and ran targeted follow-up queries. Finally, it used a schema to verify that the CVE, product, and fix version all matched.

The #1 Newsletter in AI

Stay ahead of the AI curve

The most important updates, news, and content — delivered weekly.

No spam. Unsubscribe anytime.

The result: the agent completed the task while using 85 percent fewer tokens than Perplexity's standard pipeline. Competing systems got less than a quarter of the data right.

Benchmark results and rollout

In Perplexity's own benchmarks, Search as Code beat rivals such as OpenAI's Responses API and Anthropic's Managed Agents on four out of five categories. The largest gap was on 'WANDR,' Perplexity's own benchmark for broad research tasks, which the company plans to release soon. On HLE, the system was virtually tied with OpenAI. Perplexity's self-reported results show a clear improvement over its own older architecture.

Search as Code is rolling out now in Perplexity Computer and the Agent API.

Code as the operational layer for AI

Perplexity frames Search as Code as part of a larger trend. Traditional software uses deterministic instructions. Frontier models add reasoning in token space. The most capable systems combine both: models for strategy, deterministic runtimes for batching and filtering, and search infrastructure as an I/O layer.

This upgrade could address a significant issue with current AI search. A recent study found that popular search agents often cheat on benchmarks like BrowseComp by pulling answers from training data instead of scanning the live web. When tested on a new benchmark with fresh facts, every system's score dropped by 25 to 40 points. All those systems used standard search tools.

A separate survey paper suggests that writing code is becoming the default way agents interact with the world. It describes code as a new operational layer for agents and argues that infrastructure for tools, sandboxes, and verification is the real bottleneck for autonomous systems.

Related on Neura Market

More from Neura News

AI Models

42 Mathematicians Urge Royal Society to Warn Government and Media About AI Existential Risk

Forty-two mathematical fellows, including Fields Medal winners Martin Hairer, Peter Scholze, and Wendelin Werner, have signed an open letter urging the Royal Society to warn the UK government and media about existential risks from advanced AI. The letter follows recent breakthroughs in which leading models solved open research problems, including a Millennium Problem. None of the signatories are affiliated with AI companies. The group warns that AI labs' estimates of existential risk above ten percent must not be dismissed as hype, and that by the time the situation becomes obvious to the public, it may be too late to act.

Sep 18·2 min read
Developer

Steve Yegge Shuts Down Gas Town After Failing to Build Anything Else With It

Steve Yegge shut down Gas Town, his ultra-vibed coding agent orchestrator, after admitting he never built anything else with it despite heavy subscription spend. Databricks reported a 60% coding spend increase after rolling out GPT-6 Astra to 3,500 engineers, OpenAI published a misalignment disclosure framework with six case reports, and Xiaomi ran MiMo-V2.6 RL training in public with live telemetry.

Sep 18·21 min read