---
title: "Get better answers from a Library"
description: "Document preparation and management practices that improve or protect the material an agent reads from a Library."
lang: en
status: public-preview
lastUpdated: 2026-09-04
url: https://duale.ai/en/docs/libraries/best-practices
---

## AI-generated summary

Habit-level practices for preparing, loading, and maintaining Library documents so that agent answers improve and stay current.

- Covers six habits: document preparation, exact-reference text, answer completeness, batch loading, corpus currency, and storage.
- Each habit pairs a concrete action with a repeatable check that proves the change worked.
- Requires ownership, access, and inventory clarity before any corpus change is made.
- Upload order controls what an agent reads because a new version is a new document.

Summaries were generated by AI. Generative AI is experimental.

---

Your documents are loaded, your agent answers from them, and the answers are not yet good enough.

An agent can use the passages it reads, so the documents you upload shape the source material available to it. The SDK
does not expose the passages behind a terminal answer. Each habit below improves or protects the material the agent can
read, and each is a change you can make this week.

## Before you start

These three checks keep every change below within resources you control:

- You can upload a document to the Library you work on, and delete one from it. [Access and isolation](https://duale.ai/en/docs/libraries/access.md) names the actions a grant carries.
- You can change the source file, or reach the team that produces it.
- You know which agent reaches which Library today.

Resolve any ownership, access, or inventory gap before you change the corpus.

## Prepare a document that indexes well

Keep each logical record concise and on one page.

The platform splits each document page by page, and a passage never crosses a page boundary. [How an agent finds an answer](https://duale.ai/en/docs/libraries/what-agents-can-do.md) covers that mechanism. Four habits follow, and each applies while you still hold the source file.

- **Do not let a record straddle a page break.** A table that breaks across a page becomes two passages, and neither carries the other one's context.
- **Keep a heading with the text it introduces.** The passage that answers a question then holds the words that name its subject.
- **Give every page readable text when the answer depends on words.** OCR can recover words from a picture, but the
  result is best effort. A page without readable text produces no text passage; an extracted picture can still answer
  a visual question when an image-capable model can carry it.
- **Supply a recording as a transcript or as a subtitle file.** The platform reads text, not speech.

When extraction produces neither searchable text nor a searchable picture, correct the source file and upload it again.
[Errors and reliability](https://duale.ai/en/docs/sdk/errors.md) names that failure and the other causes.

[Limits](https://duale.ai/en/docs/libraries/limits.md) lists the supported subtitle formats and the other accepted file types.

Extraction is best effort, so when visual meaning has to be exactly right,
[extract it yourself and upload the text](https://duale.ai/en/docs/libraries/patterns.md).

## Write for the tool the question needs

Put the exact string a person would quote into the text of the document.

An agent answers a question about meaning with a ranked search, and a question about an exact string with a literal match. The model picks the tool for each call, so what you control is the text that each tool matches.

- **Keep every exact reference in the text.** An invoice number, an error code, a part reference, or a symbol in code
  must appear in the document text. Do not rely on a filename or on OCR to recover it from a rendered image.
- **Name the file for the string a person would type.** A listing filters on part of a filename, so a name that carries the customer, the period, and the subject narrows a long list to the documents that matter.
- **Say on the first page what the document holds.** A question rarely uses the wording buried inside a document. A first page that names the subject, the period, and the parties gives the ranked search something to match.

## Keep an answer complete

Grant each agent the Libraries its work needs, and no more.

A search and a literal match can both stop before they have read everything, and the result reports that they stopped.
One call covers every Library the agent can read, so an agent that can read fewer of them is more likely to finish.

- **Split the corpus by reader group, then grant one group to one agent.** [Design your Libraries](https://duale.ai/en/docs/libraries/design.md) covers that layout decision, including the case where one application serves several end customers.
- **Check whether the search finished before you conclude that a document is absent.** [How an agent finds an answer](https://duale.ai/en/docs/libraries/what-agents-can-do.md) covers how an incomplete answer reads.

## Load a batch without surprises

Upload each file once, then poll it until it is readable.

A large import becomes readable over time rather than all at once, and the order in which files finish is not guaranteed. Plan the import around that.

- **Poll a document rather than uploading it again.** Every upload creates a new document, so a second upload adds a copy instead of replacing the one in flight.
- **Wait for a document to become readable before a task depends on it.** A document that is still on its way appears in a listing with its current status, and a search does not reach it yet.
- **Send a large batch well ahead of the deadline that needs it.** You cannot predict which file finishes last, so leave room for the whole batch rather than for one file.

[Manage libraries](https://duale.ai/en/docs/sdk/manage-libraries.md) has the calls that upload, poll, and wait. When a duplicate reaches `ready`, delete the copy you do not want.

## Keep the corpus current

Upload the new version, wait until it is readable, then delete the old one.

A document has no update in place. A new version of a file is a new document with its own identifier, so the order of
those calls decides what an agent reads in between. Keep the order above and at least one version stays readable. The
reverse order opens a gap until the new document is readable, and stopping after the upload leaves both versions
answerable.

**Delete a document when it stops answering a question, even when nothing replaces it.** A superseded document you leave in place still competes with the current one.

[Manage libraries](https://duale.ai/en/docs/sdk/manage-libraries.md) has the three calls in order.

### Refresh what changed, not everything

Record your own fingerprint of each file in the document's `tags` when you upload it. On the next run, compare the
source with that tag and upload only the files whose fingerprint changed.

The platform does not tell you which of your files changed. A document reports
its filename, size, and status, but nothing else you can compare with a source
file. A tag you write closes that gap. Store a compact hash and source timestamp,
and check the tag limit on [Limits](https://duale.ai/en/docs/libraries/limits.md).

The habit also reduces storage cost. A full nightly refresh creates a superseded copy for every file, while a
change-only refresh creates one only for a file that changed. [Limits](https://duale.ai/en/docs/libraries/limits.md) gives the resulting
totals.

An update replaces the whole tag map instead of merging into it. Read the
current tags first when you need to keep another key.

## Keep storage predictable

Delete a document on the day you no longer need it.

The platform meters stored volume over time, so volume and duration determine the bill.

- **Plan the deletion when you plan the upload.** A deleted document waits in the Recently deleted window before it becomes eligible for asynchronous removal, and it counts as stored volume for that whole window. [Limits](https://duale.ai/en/docs/libraries/limits.md) states the window and the other numbers.
- **Delete a Library you created for one task when the task ends.** A Library at a task path is an ordinary Library. Nothing expires it, and its documents are metered until someone deletes them.
- **Review stored documents on a fixed date each month.** List the documents in each active Library, then use the
  Dashboard to include the documents in Recently deleted because they still count as stored volume.

## One check per practice

Each check below is small and repeatable. Run the matching check after every change to the corpus, not once at the start.

| Habit                            | The check that proves it                                                                                                                                                             |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| A document indexes well          | Ask a question that only one important text passage answers. A correct answer that names its page proves that passage is searchable; repeat for each critical section.               |
| A figure is reachable            | Ask the agent a question that only one figure answers. An answer that names its page proves that figure is reachable; repeat for each critical figure.                               |
| An exact reference is present    | Ask for the invoice number, the error code, or the part reference. The agent quotes the string back from the document text.                                                          |
| Reach supports a complete answer | Ask a question that you know one document answers. The expected passage, with no report that the search stopped early, proves that question completed under the current grants.      |
| A batch is loaded                | Count the documents in the `ready` state across every listing response, then compare that count with the number of files you sent.                                                   |
| The corpus is current            | Ask for the value that changed. The answer names the new version and not the superseded one.                                                                                         |
| Storage is what you planned      | List active and Recently deleted documents. Confirm that each active document still answers a current question and that each deleted document has a known end to its restore window. |

Use a failed check to choose the section to repair, then run the same check after the change.

## Related content

- [The documents your agents can read](https://duale.ai/en/docs/libraries.md)
- [How an agent finds an answer in your documents](https://duale.ai/en/docs/libraries/what-agents-can-do.md)
- [Manage Libraries and documents with the SDK](https://duale.ai/en/docs/sdk/manage-libraries.md)
- [Architecture patterns for Libraries](https://duale.ai/en/docs/libraries/patterns.md)
- [Build an agent that passes review](https://duale.ai/en/docs/security/secure-integration.md)
- [How the platform protects and removes your documents](https://duale.ai/en/docs/libraries/security.md)

---

## Sitemap

See the full [Markdown sitemap](https://duale.ai/sitemap.md) for all pages.
