﻿# Parse Perplexity Search records separately from Agent output items

Build separate parsers for Perplexity Search result records and typed Agent output items, preserving evidence fields instead of assuming every response contains answer prose.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-perplexity-agent-search-boundary/
Language: en

A shared HTTP client can call both Perplexity Search and Agent APIs, but a shared prose parser is the wrong abstraction. The interfaces return different artifacts. Identify the response contract before normalizing it for storage or presentation.

## Parse Search as records

The [Search overview](https://docs.perplexity.ai/docs/search/overview) describes a `results` list with `title`, `url`, `snippet`, `date`, and `last_updated`, plus request metadata. Keep source records distinct. An empty `snippet` is permitted, and nullable dates must remain unknown rather than being replaced with the request time. A result card can exist without usable answer evidence.

## Parse Agent as typed output

The [Agent quickstart](https://docs.perplexity.ai/docs/agent-api/quickstart) describes `output_text` as an SDK convenience and `output` as the underlying collection. Message items contain output-text content; other item types can describe tool work. Do not stringify that entire collection and treat the resulting JSON as the assistant's answer.

## Keep normalization explicit

Define an internal source record separately from an answer record. Search records can feed the application's own model. Agent output may already include generated text and associated evidence. A consumer requiring sources should not silently receive only aggregated prose, and a consumer expecting an answer should not mistake a search snippet for a completed synthesis.

## Preserve the transport distinction

The [compatibility guide](https://docs.perplexity.ai/docs/agent-api/openai-compatibility) concerns the Agent interface, not a promise that standalone Search uses the same response shape. Store the interface identity with request diagnostics. This makes an incorrectly selected parser distinguishable from an empty result or an unsupported model request.

## Verify useful fixtures

Include Search with empty text, Agent with several output item types, and an answer whose source metadata must survive rendering. The article on [provider response normalization](/journal/learn-openrouter-response-contract/) explains field-level adaptation. The guide to [content-part contracts](/journal/provider-message-content-parts-contract/) shows why nested types need deliberate handling. A good abstraction unifies what consumers need while preserving the differences that determine whether evidence and answers are actually present.
