This page may contain stale information. Last updated: 2026-06-07

Definition

Search as Code (SaC) is a search architecture where AI models generate and execute Python code to compose atomic retrieval primitives into task-specific pipelines, rather than looping through fixed search API tool calls. Introduced by perplexity June 1, 2026.

Key Points

  • Paradigm shift: Model controls search process via code generation in secure sandbox
  • Agentic Search SDK: Modular primitives for retrieval, filtering, ranking, deduplication, parsing
  • Efficiency: 85% token reduction on 200-CVE security benchmark (42.9K vs 288.7K tokens)
  • Production deployment: Default in Perplexity Computer; available in Agent API
  • Benchmark claims are self-reported by Perplexity; SDK and retrieval infrastructure are proprietary

Architecture

  1. Model layer: Understands task, decides search strategy
  2. Sandbox layer: Executes deterministic code (batching, retries, joins)
  3. SDK layer: Atomic search primitives exposed to generated code

Sources