Skip to content
AI Tool

Search as Code (SaC) Review

Search as Code (SaC) is a new search architecture for AI agents that generates Python code to directly compose search primitives, bypassing multi-turn tool calling.

shipped Jun 2, 2026aifreemium
aiproduct-hunt
Search as Code (SaC) - AI tool for search code. Professional illustration showing core functionality and features.

Why it matters

1Search as Code (SaC) was officially launched by Perplexity AI on June 1, 2026, as a new search architecture for AI agents.
2It enables AI models to generate and execute Python code within a secure sandbox to assemble tailored retrieval pipelines on-demand.
3The Sonar API, which incorporates SaC, is priced at $0.00025 per 1k input tokens and $0.0025 per 1k output tokens.
4SaC exposes search stack components as programmable primitives, offering fine-grained control over retrieval, ranking, filtering, and fanouts.

Stork’s verdict on Search as Code (SaC)

SaC offers direct programming of search pipelines for agents, but demands developers manage custom code for fine-grained control.

Search as Code (SaC) reviewed by Stork AI · stork.ai/en/search-as-code-sac

Specs

API Available

Yes, public API

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.

features

Key Features of Search as Code (SaC)

Search as Code (SaC) provides a robust set of features designed to empower AI agents with advanced search capabilities, moving beyond traditional fixed search pipelines. These features enable dynamic, programmable control over information retrieval processes.

  • Enables models to generate and execute Python code within a secure sandbox for search operations.
  • Exposes search stack components as programmable primitives within an SDK.
  • Allows AI models direct control over individual search steps, including retrieval, ranking, filtering, fanouts, and rendering.
  • Bypasses traditional multi-turn tool calling interfaces for search operations, streamlining agent workflows.
  • Provides efficient access to intermediate state, such as candidate lists and ranking signals, for iterative refinement.
  • Facilitates the assembly of tailored retrieval pipelines on-demand for specific information needs.
  • Supports the design of bespoke search pipelines spanning thousands of retrieval operations.
  • Optimizes search pipelines in-flight and consumes only the most useful information as model context.
  • Incorporates search innovations like sub-document retrieval, context efficiency, and semantic understanding.

use cases

Who Should Use Search as Code (SaC)?

Search as Code (SaC) is primarily designed for AI agents and developers who require fine-grained, programmatic control over information retrieval processes for complex and dynamic tasks. Its architecture is particularly beneficial for scenarios demanding highly customized search strategies.

  • AI Agents: For constructing tailored retrieval pipelines to address complex, open-ended tasks over extended periods.
  • Developers Building AI Systems: To allow AI models to directly program and control the search stack, bypassing multi-turn function calling interfaces.
  • Researchers and Analysts: For in-depth research and information gathering, enabling the design of bespoke search pipelines that can be optimized in-flight.
  • Companies in Sensitive Domains: Deployers using Perplexity AI in areas like HR, legal, or internal decision-making, who need to ensure data transparency and conduct Data Protection Impact Assessments (DPIAs).
  • Organizations Requiring Cost-Performance Optimization: For establishing a new cost-performance frontier for agentic search by providing fine-grained control over resource consumption.

pricing

Search as Code (SaC) Pricing & Plans

Search as Code (SaC) is offered through Perplexity AI's freemium model, with pricing primarily usage-based across its API tiers. The pricing structure is designed to scale with cumulative API spending, unlocking higher rate limits as usage increases. Perplexity AI offers tiered rate limits for its Agent, Search, Embeddings, and Sonar APIs. For example, the Agent API ranges from 1 QPS (Tier 0) to 17 QPS (Tier 3), while the Search API maintains a sustained rate limit of 50 QPS with a burst capacity of 50 requests. Users can monitor their current usage tier via the API Platform console.

  • Sonar API: Input tokens are priced at $0.00025 per 1k tokens ($0.25 per 1 million tokens); Output tokens are priced at $0.0025 per 1k tokens ($2.50 per 1 million tokens).
  • Sonar Pro: Input tokens are priced at $0.003 per 1k tokens ($3 per 1 million tokens); Output tokens are priced at $0.015 per 1k tokens ($15 per 1 million tokens).
  • Agent API: Pricing varies by provider and model, with direct provider rates and no markup from Perplexity AI.

Similar Tools

Search as Code (SaC) vs Competitors

Search as Code (SaC) differentiates itself in the competitive landscape by offering a programmable search architecture that empowers AI agents to generate and execute code for dynamic retrieval pipelines, contrasting with traditional fixed search models and even advanced AI search tools.

1

Exa is a web search engine built from scratch for AI workflows, optimized for relevance, freshness, and semantically-driven results rather than click-based ranking.

Similar to SaC, Exa provides structured, up-to-date information for AI agents and RAG systems, acting as a retrieval layer. While SaC emphasizes programmable primitives for dynamic pipeline assembly, Exa focuses on delivering highly relevant and semantically understood results tailored for AI consumption.

2

Parallel is an AI-native web search and research API designed as infrastructure for AI systems to search, retrieve, verify, and reason over live web information.

Parallel, like SaC, targets AI agents as its primary users, providing a different kind of web infrastructure for AI systems. It aims to go deeper into how AI agents interact with the web, offering a foundational layer for complex reasoning, which aligns with SaC's goal of evolving search to programmable primitives.

3
Cloudflare AI Search

Cloudflare AI Search offers a plug-and-play search primitive with hybrid search capabilities and built-in storage, allowing dynamic instance creation and management via API for agents.

Cloudflare AI Search directly positions itself as a 'search primitive' for agents, enabling developers to dynamically create and manage search instances, which closely mirrors SaC's concept of programmable primitives. It simplifies the infrastructure needed for agents to access and search data, similar to how SaC aims to provide building blocks for agentic search.

4

Brave Search API provides direct, structured API access to its independently built web index, offering flexibility and customization for RAG pipelines and AI systems.

The Brave Search API offers a foundational retrieval API for AI products, emphasizing control over ranking and summarization, and providing structured results. This aligns with SaC's goal of moving beyond monolithic search by offering customizable building blocks, though Brave's focus is on its independent index and structured output rather than the dynamic assembly of search pipelines through code generation.