Perplexity Publishes a Search Pipeline for Coding Agents Before They Edit Code

The cookbook turns documentation lookup into a saved, inspectable artifact—but it explicitly leaves the final migration judgment to the agent, repository review and tests.

By 3 min read
Perplexity Publishes a Search Pipeline for Coding Agents Before They Edit Code
Perplexity Publishes a Search Pipeline for Coding Agents Before They Edit Code

Listen to this story

The audio brief

About 1:36
0:001:36
Read transcript
Perplexity has published a cookbook that turns dependency-migration research into a source-linked handoff for a coding agent—before the agent edits anything. The example focuses on upgrading Pydantic from version 1.10.15 to 2.13.5 in a FastAPI-related codebase. Its Search SDK asks five narrowly defined questions covering validators, model APIs, configuration, settings, and FastAPI migration guidance. Each question is restricted to an approved official documentation site, including docs.pydantic.dev and fastapi.tiangolo.com, so a relevant-looking result from elsewhere does not qualify. The searches run with three-way concurrency, while the pipeline keeps no more than two results per topic and extracts passages capped at 500 tokens. Everything is saved in an agent-context dot M-D file: queries, titles, URLs, excerpts, and a separate “Retrieval gaps” section for topics where usable evidence was not found. If any topic is missing evidence, the script exits with status one. A missing API key produces status two. But this is deliberately not an automated migration. The agent must treat passages as untrusted evidence, inspect the repository for Pydantic 1 usage, plan changes before editing, cite source URLs, and run the existing tests. The benefit is an inspectable, repeatable research policy—not a guarantee of correctness. The open constraint is coverage: a tightly scoped live search can still miss documentation about an important breaking change.

Story brief

3 key points

An example migration workflow turns bounded web research into an auditable handoff for a coding agent. For a Pydantic 1.10.15→2.13.5 upgrade, Perplexity’s Search SDK searches five predefined topics on approved official domains, selects up to two results per topic, and extracts passages capped at 500 tokens. It writes agent-context.md with queries, URLs, titles, excerpts, and retrieval gaps. The guardrails improve...

  1. 01

    Three-way concurrency keeps the five-search collection bounded and reproducible.

  2. 02

    The script exits status 1 when any topic lacks usable evidence; missing API keys return status 2.

  3. 03

    Agents must treat passages as untrusted evidence, plan changes before editing, cite URLs, and run existing tests.

Perplexity has published a cookbook for turning dependency-migration research into a repeatable program that produces a source-linked brief for a coding agent before it edits code. Its example targets a Pydantic upgrade in a FastAPI-related codebase, separating the task of finding current documentation from the harder job of deciding how a particular repository should change.

The guide uses Perplexity’s Search SDK to build an agent-context.md file for a migration from Pydantic 1.10.15 to 2.13.5. That file preserves each collected item’s search query, page title, URL and extracted passage, while placing failed retrievals in a separate Retrieval gaps section.

The example is deliberately narrow. It defines five questions around validators, model APIs, configuration, settings and FastAPI migration guidance. Each search is tied to an exact official documentation host, including docs.pydantic.dev and fastapi.tiangolo.com, rather than accepting a result merely because it appears relevant.

The script runs its five web searches together, with a concurrency limit of three, and keeps at most two results for each topic. It then asks content.snippets for passages relevant to the original query, capped at 500 tokens for each page. Those limits make the research stage bounded and reproducible, but they also mean the artifact is a selected record rather than a complete account of every breaking change.

Perplexity builds the limitation into the workflow. The collector writes the context file before checking whether every planned topic has evidence. It exits with status 1 if any topic lacks usable material, allowing a person, continuous-integration system or later agent to inspect the gaps instead of treating a partial packet as complete. A missing API key produces status 2.

What the agent is still expected to do

  • Treat retrieved passages as untrusted evidence rather than instructions.
  • Inspect the repository for relevant Pydantic 1 usage and propose a migration plan before editing.
  • Cite the artifact’s source URLs for migration claims and run the repository’s existing tests after edits.

That division of labor is the cookbook’s central design choice. The search program controls the queries, approved domains, result limits, failure handling and output format; the coding agent must still interpret the evidence against the application itself. Perplexity says live results can change as documentation and search results change, and advises users to review the generated URLs and passages before relying on them.

For teams that revisit upgrades as target versions move, the appeal is not that search makes an agent’s migration correct. It is that the research policy can be rerun and inspected: a reviewer can see what the agent was given, where it came from and which planned questions failed to return usable evidence. The unresolved question is whether that visible trail is enough to catch the important documentation a tightly scoped search did not retrieve.

Sources

  1. docs.perplexity.aiSearch as Code for coding agents - Perplexity

Loading discussion...

Perplexity Publishes a Search Pipeline for Coding Agents Before They Edit Code | Superpower Daily