
- Perplexity’s new “Search as Code” lets a model write a custom Python script for each search instead of calling one fixed API endpoint.
- A three-layer design — model on top, secure sandbox in the middle, an “Agentic Search SDK” underneath — hands the agent mix-and-match functions to retrieve, filter, deduplicate and rerank.
- In Perplexity’s own evaluations the approach beat OpenAI and Anthropic on key benchmarks while cutting token costs by up to 85 percent.
- It is rolling out now in Perplexity Computer and the Agent API, aimed squarely at developers building search-driven agents.
What if the search engine stopped handing your AI a menu and instead handed it a keyboard? That is the bet behind Perplexity’s “Search as Code,” unveiled this week: rather than letting a model call a rigid search API and hope the results are relevant, the model writes its own retrieval program in Python and runs it inside a sandbox. Perplexity says the shift makes results more precise and dramatically cheaper — and that on its internal tests it edges past both OpenAI and Anthropic while spending a fraction of the tokens.
What “Search as Code” Actually Changes
For most of the agent era, “giving a model search” has meant wiring it to a fixed API: the agent sends a query string, the service returns a ranked list, and the model takes whatever comes back. That design is simple, but it leaves the most important part — how context is retrieved, filtered, aggregated and rendered — locked inside a black box the model cannot steer. Perplexity’s argument is that the most capable AI systems now need exactly that control, and traditional search was never built to provide it.
Search as Code flips the relationship. Instead of calling an endpoint, the model writes a short Python script that orchestrates the search itself, executing inside a secure sandbox. Basic operations — retrieving documents, filtering them, removing duplicates, reranking the survivors — are exposed as simple SDK functions the model can compose however the task demands. A broad research question and a narrow fact-check no longer run through the same one-size-fits-all pipeline; the agent writes a different program for each.
Trend Insight — This is the same philosophy that made code interpreters so powerful for math and data: when a model can express intent as executable code rather than a single API call, it gains controllability that prompt-tuning alone can never match. Search is simply the next surface to be “promoted” from a fixed tool to a programmable one.
Inside the Three-Layer Architecture
Perplexity breaks the system into three layers. At the top sits the model, which decides the search strategy. In the middle is the sandbox, an isolated environment where the model’s generated code runs safely without touching production systems. At the bottom is the Agentic Search SDK, which decomposes Perplexity’s search engine into individual, callable functions rather than a single monolithic endpoint.
The model as orchestrator
Because the agent handles its own filtering and deduplication inside the sandbox, it only surfaces the slices of context that actually matter — instead of dumping a long, noisy result list into the prompt and paying for every token. That self-directed pruning is where both the accuracy gains and the cost savings come from: the model reasons about what to keep before the data ever reaches its context window.
Trend Insight — Sandboxing is the unglamorous but critical piece. Letting a model run code it just wrote is exactly the kind of capability that needs strict isolation, and the fact that Perplexity built the architecture around a secure runtime — not as an afterthought — signals how seriously agentic search now takes execution safety.
Why “Up to 85% Fewer Tokens” Is the Real Headline
Benchmarks make headlines, but the economics may matter more. Perplexity reports that, compared with its standard pipeline running on the same hardware, Search as Code shows solid improvements across all five evaluated benchmarks — and beats OpenAI and Anthropic on key ones — while cutting token costs by up to 85 percent. For anyone running search-heavy agents at scale, that is not a rounding error; it is the difference between a feature that is viable in production and one that quietly bankrupts the unit economics.
Token cost has become the silent tax on every agentic workflow. Each unnecessary document pulled into context is paid for on every step of a multi-turn task, and those costs compound fast. By pushing filtering down into a sandbox before results reach the model, Search as Code attacks the problem at its source rather than trying to summarize bloat after the fact.
Trend Insight — Expect “context efficiency” to become a first-class benchmark alongside raw accuracy. As agents take on longer tasks, the labs that win may be the ones that retrieve less but better — and code-driven retrieval is a direct lever on that ratio.
What It Means for Developers
Search as Code is rolling out now inside Perplexity Computer and the Agent API, putting it directly in the hands of the developers building autonomous research and support agents. For teams that have wrestled with rigid retrieval APIs, the pitch is concrete: more control over how context is assembled, fewer wasted tokens, and the ability to tailor a retrieval program to each task instead of bending every job to fit one pipeline.
The broader signal is competitive. CEO Aravind Srinivas has framed this as a rethink of what search should be in an agent-first world, and it lands while OpenAI and Anthropic are pushing their own agent platforms. If code-driven retrieval delivers on its accuracy-and-cost promise, it pressures every rival to expose search as something more programmable than a single endpoint — and turns “how your agent searches” into a genuine point of differentiation.
Trend Insight — Watch whether competitors respond with their own “search SDKs.” The moment retrieval becomes programmable, it stops being a commodity API and becomes part of the model’s reasoning loop — and that is a much harder moat to cross than a faster ranking algorithm.
Related
- OpenAI Says “Chat Is Dead” — and Plans a ChatGPT Superapp
- Google Antigravity 2.0: 93 Agents Built an OS in 12 Hours
- Accenture Just Bet $110M to Replace the Call Center
- AI’s Hidden Economy: Where the ROI Actually Is
- China Did It Without Nvidia: Huawei Ascend Trains DeepSeek V4
Sources
- The Decoder — Perplexity’s “Search as Code” lets AI models write their own search pipelines
- Perplexity Research — Rethinking Search as Code Generation
- WinBuzzer — Perplexity Lets AI Agents Write Their Own Search Code
AI Biz Insider · AI Trends EN · aibizinsider.com
댓글 남기기