﻿# Exa Search streaming needs outputSchema and a synthesis-aware consumer

Build Exa Search streaming around outputSchema synthesis and typed completion events, preserving final output separately from partial rendered text.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-exa-schema-streaming-output/
Language: en

## Identify which artifact streams

A comparison interface may want to display an explanation while research synthesis progresses. That is different from receiving ordinary ranked search results as one JSON response. Decide whether the interface needs generated output before enabling streaming, rather than treating the flag as a universal way to make every search response arrive incrementally.

## Validate the synthesis request

The [Search reference](https://exa.ai/docs/reference/search) says `stream` is used with `outputSchema`; otherwise Search returns its normal JSON response. The [quickstart](https://exa.ai/docs/search/quickstart) documents synthesis eligibility and separates ranked `results` from `output.content` and `output.grounding`. Validate those request choices before opening a stream consumer, including unsupported search-mode combinations.

## Consume the documented event lifecycle

[Deep Search documentation](https://exa.ai/docs/search/deep-search) instructs consumers to read typed events until `done`. It says the final event includes completed output and search time, with costs when available. Keep the parser aligned with those event types and preserve unknown observations for diagnosis instead of assuming every incoming data fragment is answer text.

## Separate preview from committed output

Render partial prose as a preview, then reconcile the saved artifact from the completed result. A browser disconnect after several visible paragraphs does not establish completed synthesis. Keep an interrupted state if no documented completion was observed. Do not store the partial text as the final explanation merely because it looks grammatically finished.

For structured output, avoid treating an incomplete JSON prefix as a valid business object. Keep partially rendered progress separate from the object accepted by the application's schema validator. Only then attach the final field-level grounding used by the review interface or export step.

## Measure caller completion honestly

Record first visible progress separately from time to a usable completed artifact. The former describes responsiveness; the latter matters when another process needs validated data. A streaming interface can improve perceived speed without shortening all required work, so report both measurements under the same reviewed task configuration.

The existing guides to [terminal SSE handling](/journal/provider-sse-terminal-eof-contract/) and [response contracts](/journal/learn-openrouter-response-contract/) help validate that boundary. Use stored cases with a complete stream, an interrupted prefix, and an unexpected event. The consumer should preserve the evidence and execution state without inventing completion or conflating a preview with the final grounded result.
