Skip to main content
search.qa asks one question about a workspace as one turn of a conversation. It returns a Promise<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

On a genuinely ambiguous question the agent may ask back instead of answering: answer.clarification_questions lists the questions and answer.answer is null. Reply with clarification_answers and the same session_id, or pass allow_clarification: false to have every turn answer under the agent’s best reading.

Structured answers

Pass output_schema (a JSON Schema object, 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, null if the answer still missed the schema after the run’s corrections. A field the source does not state comes back null, whatever type the schema gives it. 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 null.

Method signature

Parameters

Returns

A Job. 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.