search.qa asks one question about a workspace as one turn of a conversation.
It returns a Job whose result is an AutomaticAgentResult. Every turn runs
the automatic search agent on its own: it opens with what a search of the
workspace finds, answers from that when it can, and otherwise reads documents,
queries tables, and selects documents from the metadata catalog. Files must
already be ingested.
A conversation
Clarifying questions
On a genuinely ambiguous question the agent may ask back instead of answering:answer.clarification_questions lists the questions and answer.answer is
None. Reply in the same conversation:
allow_clarification=False to have every turn answer under the agent’s
best reading, stated in the answer.
Structured answers
Passoutput_schema (a JSON Schema dict or a Pydantic model class, under the
same rules as automatic search’s)
to get a turn’s answer as JSON. On success answer.answer is the JSON text and
answer.structured_answer the parsed value, None if the answer still missed
the schema after the run’s corrections. A field the source does not state comes back None, whatever type the schema gives
it, so declare such fields optional in a Pydantic model you validate into.
The schema applies to the turn that sends it, not to the conversation. To
keep structured answers across a conversation, send it on every turn,
including the one that carries clarification_answers. A turn that asks
clarifying questions returns them with structured_answer set to None.
Method signature
Parameters
Returns
AJob. On success, job.result is an AutomaticAgentResult
(result_type="automatic_agent"): answer, a DeepSearchV2Result with the
answer, citations, SQL receipts, session_id and any clarification_questions;
and catalog, a FilteredSearchResult present when the agent answered from the
metadata catalog. A catalog table’s next_cursor pages through
client.search.filtered_page.