Skip to main content
The Answer API searches relevant sources and synthesizes a cited, factual answer in one call. It supports streaming and non-streaming modes (non-streaming by default).

Wire up Valyu Answer (search-grounded answers) with the Python SDK.

Open in Cursor

Basic usage

Common patterns

Structured output

Pass a JSON schema to structured_output and response.contents comes back as a structured object (a dict) instead of a string. Detect it with isinstance(response.contents, dict):

Streaming

Set streaming=True to receive the answer progressively. The method returns a generator yielding typed chunks:
For open-ended, multi-step work (reports, diligence, deliverables), reach for DeepResearch instead of Answer.

Reference

query (str, required) - the question to answer.