Perplexity is reworking how its agents talk to a search engine. Instead of having models issue one function call at a time and wait for results, Search as Code (SaC) lets the model write Python that drives Perplexity's search stack directly inside a sandbox. The architecture is live in the Perplexity Agent API and is now the default search method inside Computer, the company's agent product.

CEO Aravind Srinivas described the shift as moving toward "search as codegen," a model designed for a future in which code execution plays a central role in knowledge-based work. In practice that means a single inference turn can fan out thousands of search operations, dedupe and rank them, and only surface the distilled signal to the model's context window.

Why tool calls were the bottleneck

Traditional search APIs were built for humans typing a query and scanning ten blue links. When LLMs became consumers of the same APIs, they inherited the same monolithic contract: send a query, get back a ranked resultset. Perplexity argues this contract breaks down in agent workloads, where today's most advanced AI systems, built atop code-first harnesses, can compose task-specific workflows that execute thousands of actions each minute.

The team identifies three recurring failure modes in the function-calling and MCP eras. Pipelines return coarse context that floods the window with noise when the agent needed a single surgical fact. Models can't apply domain knowledge they have about how to search, because rigid query parameters give them nowhere to encode it. And inherently parallel workflows get serialized through model turns, polluting context with intermediate state and burning tokens on every roundtrip.

Diagram of traditional search forcing sequential tool calls across model turns

The three layers underneath SaC

SaC is built on a stack of three tightly coupled components. Models act as the control plane, decomposing the user's directive into tasks and emitting Python code.

Alpha Signal

Don't miss what's next in AI

Join 300,000+ engineers and researchers who get the signal, not the noise.

  • Full access to in-depth AI research breakdowns
  • Be the first to know what's trending before it hits mainstream
  • Daily curated papers, repos, and industry moves