Perplexityapi
June 1, 2026·Source

Search as Code

A search setup for developers building agents on Perplexity: the agent writes its own Python to run many searches at once instead of one at a time. Now the default in Perplexity Computer.

Search as Code announcement image
  • The agent writes Python that calls the Perplexity search stack directly, running many search operations in a single turn instead of one function call at a time.
  • The Perplexity search stack is broken into small composable pieces (retrieval, ranking, filtering) the model can batch and combine with its own logic, instead of one fixed search service.
  • The generated code runs in a secure sandbox that keeps files between turns, so an agent can build on its earlier work.
  • Runs on GPT-5.5 in high-reasoning mode.

Best for

Agents that need to pull from and sift through many sources in a single task, like deep research or data gathering.

When to use it

Building on the Perplexity Agent API and you want the agent to run many searches at once instead of looping one query at a time.

Who benefits

Developers and engineering teams building AI research or agent tools on Perplexity.

Join the newsletter to get ahead with AI.

I share strategies, new modules, free guides, and tools to get you better at using AI in your work.

Leading a team? See team programs →