retrieve_documents.
Authentication and enablement
- No integration needed.
- Off by default. Add it to an agent’s tools.
- The workspace must have document collections switched on (runtime flag
document_collections.enabled), and the platform’s default model and embeddings must be configured.
Inputs
collection(required): collection key(s), matched case-insensitively, for example a claim number.questions(required): up to 40 questions, each{"key": "vehicle", "question": "What vehicle was the insured driving?", "search": "insured driver vehicle make model"}.keyis optional and names the answer’s row.searchis optional: a few words to search the documents with, which defaults to the question. Give it when a question lists its allowed answers, because that list makes a poor search.instructions(optional): extra answer rules for this call, such as formats or allowed categories.filters(optional): the same filters asretrieve_documents, to narrow bydoc_type, date and so on.scope(optional):collection(the default) orworkspace.
document_answer, or all rules when the agent injects rules into every model call.
Output
- One answer per question, in the order asked: the answer, the exact quote, the file, the page, and a link to the page.
- An answer whose quote could not be found in the passage is kept but marked unverified, never shown as exact. Rows of tables and forms that OCR read column by column are accepted when every number and most of the words are on the page.
- Questions the documents do not answer come back as Not stated.
- A question that fails, for example on a model error, reports its own error; the other questions still answer.
Limits and side effects
- Read-only.
- Up to 40 questions per call, answered 6 at a time. Each answer reads the 8 best passages for its question.
- Shows the agent at most 30,000 characters of answers and says when it cut them.
- Asks the model for schema-checked JSON and retries a question once when its reply cannot be read.
- Cost grows with the number of questions: per question, one search, one re-rank and one model answer.
Expected errors
- Document collections not enabled, or no model configured.
- No questions, an empty question, or more than 40 questions.
scopeset tolibrary.- A malformed filter.