overview
What is Search as Code (SaC)?
Search as Code (SaC) is a new search architecture tool developed by Perplexity AI that enables AI agents and developers building AI systems to generate and execute Python code to assemble tailored retrieval pipelines. It bypasses traditional multi-turn tool calling interfaces by exposing search stack components as programmable primitives. This architecture moves beyond monolithic search services, allowing AI models to directly program and control the search stack. The generated Python code is executed within a secure sandbox, providing AI agents with fine-grained control over individual search steps such as retrieval, ranking, filtering, fanouts, and rendering. This approach is designed to improve the efficiency and capability of AI agents in complex, open-ended information retrieval tasks, enabling them to design bespoke search pipelines spanning thousands of operations and optimize them in-flight.