Learning resourcesReviewed · Perplexity

Perplexity Agent API: Output Control

Perplexity's Output Control page is official documentation for developers using the Perplexity Agent API, explaining how to stream answers as they are generated, run long tasks in the background and get replies in a fixed JSON format. It includes Python, TypeScript and HTTP examples. The first request with a new JSON Schema typically takes 10 to 30 seconds to prepare and may time out; links the model writes inside JSON may be invalid.

Researched 14 Nov 2026

In short.

Perplexity's Output Control page documents streaming, background runs and JSON Schema structured outputs for developers using the Perplexity Agent API. The first request with a new JSON Schema typically takes 10 to 30 seconds to prepare and may time out; links the model writes inside JSON may be invalid. It explains streaming events, background polling and reconnection, and JSON Schema configuration. Its structured-output example has inconsistencies that limit its usefulness as a working template. Runtime behavior, compatibility and actual costs have not been assessed.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete page at [https://docs.perplexity.ai/docs/agent-api/output-control.md], including streaming, error handling, background runs, structured outputs, examples and notices. Linked pages and sources embedded in sample responses are excluded. No examples were executed; runtime behavior, compatibility, performance, current pricing and model availability remain unassessed.

The overview

identity

This is Perplexity's feature guide for controlling response delivery and formatting in the Agent API. The original page is [https://docs.perplexity.ai/docs/agent-api/output-control.md]. It provides SDK and HTTP examples for streaming, background execution and structured outputs.

assessment

The guide is useful for deciding how an application should receive answers and pass generated data into code. It supplies concrete parameters, event names, status handling and warnings. Its strongest material concerns integration mechanics; it provides no measured reliability or performance comparison, and the structured-output example needs correction before use as a template.

users

The examples are most relevant to developers building interactive assistants, research applications or features that consume generated JSON. Beginners need familiarity with API requests, authentication and JSON. Experienced developers can use the event types, polling states and schema rules to plan integration, although production limits are not established here.

capabilities

Streaming delivers partial answer text as it is generated; the page states that all Agent API models support it. Background runs continue server-side after a client disconnects and support retrieval by response ID. Structured outputs use JSON Schema, a description of expected fields and types.

The page describes required and optional schema properties for both streaming and non-streaming requests, through /v1/agent and its /v1/responses compatibility alias.

Using it

requirements

The HTTP examples authenticate with a bearer API key represented by PERPLEXITY_API_KEY. Python examples use the perplexity package, with Pydantic for generating a schema and validating returned JSON. TypeScript examples use @perplexity-ai/perplexity_ai. Direct HTTP examples target [https://api.perplexity.ai/v1/agent].

Installation instructions, minimum language and SDK versions, account eligibility and numerical rate limits are not supplied.

mechanism

A streaming request keeps its connection open. The Python example prints text from response.output_text.delta events and reads usage from response.completed. Error examples distinguish connection failures, rate limits and API errors.

Background requests return an ID that the client polls while status is queued or in_progress. Listed terminal states are completed, failed, cancelled and incomplete. Reconnection uses starting_after=N to resume after an event sequence number. The reconnect window has no stated duration; after expiry, the page describes HTTP 400 and retrieval of the final snapshot through an ordinary GET request.

setup

For incremental text, set stream=True in Python or stream: true in TypeScript and process the returned events. For background work, set background to true, retain the response ID and retrieve its status.

For structured output, set response_format.type to json_schema and provide json_schema.name and json_schema.schema. The stated naming rule is 1–64 alphanumeric characters. Put mandatory fields in the schema's required array. The page says other declared properties remain optional and may resolve to null; omitting required makes all declared properties optional.

example

The streaming example requests an explanation of model cards, sets effort to fast and displays incoming text fragments. It illustrates how an interface could progressively show an answer and then obtain completion usage.

The structured-output example asks for an explanation of SEC Form 10-K sections while imposing a financial-metrics schema containing company, revenue and net income. Its displayed response contains explanatory prose instead of that metrics object. This is a documentation inconsistency; actual schema enforcement remains unassessed.

Assessment & evidence

limitations

The first request using a new schema is documented as typically needing 10–30 seconds of preparation and potentially timing out. The stated format guarantee excludes outputs that exceed max_tokens. Generated URLs inside structured JSON may be fabricated or broken; the page recommends using links from citations or search_results.

For interfaces needing search results immediately, the page recommends considering non-streaming requests. It also states an alphanumeric schema-name rule while examples use financial_metrics, which contains an underscore. Acceptance of underscores is unverified.

reasoning

The documented controls address two separate needs: when an application receives an answer and how its content is arranged. A schema can make fields easier for code to consume, while the warning about generated links shows that a structured format does not establish factual accuracy.

The practical implication is to match the request to its schema and validate completed output before using it downstream. This guidance follows the documented caveats and example inconsistencies; no runtime results support a stronger reliability claim.

alternatives

Within the Agent API, streaming suits progressive text display, non-streaming is suggested when immediate search-result display matters, and background mode is suggested for runs lasting minutes. Background runs can also be streamed and reconnected within their reconnect window.

The page provides no comparison with competing APIs or local tools. Relative cost, speed and reliability are unknown.

evidence

The evidence is the complete Perplexity Output Control page, including its request examples, response bodies and warnings. Those response bodies are documentation examples rather than independently observed results. No code or API requests were executed.

Linked background-mode, API-reference and model pages were not assessed. Search snippets and generated explanations embedded in sample responses do not establish facts about API performance.

Access & freshness

costs

Actual API prices and expected workload costs are unknown from this page. Example responses contain token usage and USD cost breakdowns, including token, cache and search-tool entries. One lists total_cost as 0.04332 USD. These documentation examples do not establish current rates or predict another request's cost.

rights

The page supplies no documentation licence, sample-code licence, generated-output ownership terms or data-handling terms. Rights to redistribute the page or reuse its examples are therefore unknown from this evidence. Commercial API terms are also not established.

freshness

This page was captured on 2026-11-14 at 22:33:37 UTC. It supplies no explicit page publication date, last-update date or SDK version. Dates and model identifiers inside example responses do not confirm current model availability or compatibility.

actions

Before adopting the examples, confirm current SDK requirements, model access, pricing and applicable terms. Align the requested task with its schema, confirm schema-name acceptance and validate returned JSON.

Handle connection failures, rate limits, schema preparation delays and unsuccessful terminal states. For background runs, retain the response ID and last event sequence and confirm the reconnect-window duration. Obtain output links from citations or search_results as the page recommends.

Evidence for this report

selected-page.txtselected · checked 2026-11-14