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 finds what the turn needs itself, read in the light of the conversation, through a navigator over the workspace’s files, sections and pages (or, for a workspace in a bring-your-own bucket or customer storage, by searching it), then reads documents, queries tables, and selects documents from the metadata catalog until it can answer. 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, evidences (its citations), sql_receipts, session_id and any clarification_questions; and catalog, a FilteredSearchResult present when the agent answered from the metadata catalog. A QA answer comes back without Ground jobs: answer.grounding_job_ids is null. To locate its quotes, run client.documents.ground yourself on answer.evidences, one job per file, as in Quote locations.