2026-06-01 · ← Radar
Search should not be a button. It should be programmable infrastructure for agents
Perplexity's article “Rethinking Search as Code Generation” describes Search as Code: an architecture where an agent does not call one monolithic search engine, but assembles a retrieval pipeline as code. The important point is not that search gets a new API. It is that agents get control over how evidence is found, filtered and verified.
Perplexity turns search from an answer into a set of primitives
Classic search was designed for humans. You enter a query, get a results page and choose. Early AI systems mostly inherited the same contract: the model calls a search endpoint, receives a processed bundle of results and uses it as context.
Perplexity argues that this is no longer enough for agentic work. A modern agent is not merely answering a question. It is supposed to complete work that may involve hundreds of small retrieval steps, source comparisons, deduplication, verification and follow-up queries based on intermediate results.
Search as Code addresses that boundary. Instead of one black box, it gives the agent an SDK with smaller building blocks: retrieval, ranking, filtering, fan-out, rendering and intermediate-state handling. The model then generates Python that composes those blocks into a task-specific pipeline.
For agents, bad context is the expensive part
The biggest problem with monolithic search is not only accuracy. It is control over context. When an agent needs one surgical fact and receives a broad result bundle, the noise costs tokens, latency and decision quality.
For wide tasks, one search endpoint is often not enough either. Finding vendor advisories for hundreds of CVEs requires exact phrase probes, site-scoped search, aggregator rejection, checks that a CVE is tied to a product and fixed version, and backfilling when coverage is weak. That is not naturally a linear conversation. It is a program.
Perplexity gives a case study covering more than 200 high-severity CVEs from 2023 to 2025. Its Search as Code solution reportedly reached 100% accuracy and reduced token usage from 288.7K to 42.9K. I would treat vendor-run benchmark numbers carefully, but the direction is plausible: deterministic work belongs in runtime, not in token space.
Without good primitives, this is just faster mess
Search as Code will not work automatically just because a model gets Python and the web. A bad agent can write a bad crawler as quickly as it can write a bad prompt. The value comes from breaking the search stack into the right primitives and teaching the model how to use them.
That is why two details in Perplexity's article matter more than the marketing label. First, it uses skills to teach models useful SDK composition patterns. Second, it prefers explicit filesystem persistence over implicit REPL-style state. Boring, but correct. Long agent trajectories need auditable state, not a notebook full of variables nobody can explain.
Fewer tokens and better evidence as the practical metric
High-quality agentic research will look more like a small data pipeline than a chat with a search box. The agent creates candidates, fetches them, cleans them, verifies relations, stores evidence rows and only then returns a compact conclusion to a human.
This is useful beyond Perplexity. Hermes, internal agents and enterprise research tools do not need Perplexity's private SDK to adopt the principle: the model controls strategy, code performs mechanical work and the final answer receives only the verified distillate.
Lilith's verdict
Search as Code is not another pretty name for web search. It is the moment an agent stops browsing results like a human and starts building its own investigation pipeline: candidates, filters, evidence and a bin for noise.
I keep the external link at the end. First, a concise explanation here — no hunting across someone else's site.
Original source ↗ ↗