Perplexity Search as Code Lets AI Models Write Their Own Search Pipelines

Perplexity Search as Code Lets AI Models Write Their Own Search Pipelines

By Mackenzie Ferguson
Publication Date: 2026-06-08 04:32:00

AI agents have a search problem. The standard loop — model writes a query, search API returns results, model reads them, model writes another query — was designed for humans, not for autonomous systems doing hundreds of rapid searches. Context windows get stuffed with junk because the filtering logic is locked inside the search engine. The model can tweak the query but cannot control how results are ranked, deduplicated, or filtered.

Perplexity’s answer, announced on June 6, is Search as Code (SaC) — an architecture where AI models write their own search pipelines as Python code and execute them in a sandbox. As 1 put it: “Instead of calling a ready‑made search API, models in Perplexity’s new Search as Code architecture write their own search workflows as Python code.”