How the agent finds an answer

What happens to a document between uploading it and the agent quoting from it — and why that shapes what you should upload.

The agent does not read your documents when somebody asks a question. It could not — a model is given a fixed amount of text per turn, and your knowledge base is larger than that. What happens instead is retrieval: the question is used to find the handful of passages most likely to contain the answer, and only those are given to the model.

Everything people find surprising about agent answers comes out of that sentence. This page is the detail.

The five steps

Steps 1–4 happen once per document, at upload. Step 5 happens on every message.
  1. 1

    The file is scanned

    For malware, before anything touches it. A file that fails is refused and never reaches the next step.

  2. 2

    Text is extracted

    PDF, DOCX, Markdown, plain text, and spreadsheets. What comes out is text — a diagram carries nothing, and a scan of a page is a picture, not words. A file with no text in it at all is refused here, with a message saying why.

  3. 3

    It is cut into chunks

    About 300 words each, overlapping by 50. The overlap exists so a sentence that lands on a boundary is not torn in half.

  4. 4

    Each chunk is embedded

    Turned into a list of 768 numbers that stand for its meaning, so two passages saying the same thing in different words end up near each other. This is queued, never immediate — a large document is searchable shortly after upload, not instantly.

  5. 5

    A question retrieves five chunks

    The question is embedded the same way, the five nearest chunks are found, and those are what the model is given.

NoteFive chunks. About 1,500 words.

That is the whole of what the agent sees from your knowledge base for any one question, however much you have uploaded. Uploading more does not widen that window — it widens the field the five are chosen from.

What this means for what you upload

One subject per documentA chunk is 300 words of a document. A 40-page handbook covering everything gives chunks that each cover a little of nothing.
Write the question into the textRetrieval matches meaning, and a heading that uses your customers' words — "How do I cancel?" — is nearer to their question than "Policy 4.2 Termination".
Spell out what a heading impliesA chunk arrives alone. If the price only makes sense under a heading six paragraphs up, the chunk carrying the price does not carry the heading.
Tables are not proseA spreadsheet is stored as rows the agent can filter by value, and its first 500 rows are also indexed one per passage. See Knowledge.

A worked example

Harbor & Pine's returns page started like the left-hand version. Customers asked “can I send the sofa back?” and the agent kept answering from the delivery page instead.

returns.md — before and after
## Section 7: Reverse logistics            ← before
Items may be returned within the stated period...

## Can I send something back?              ← after
Yes. You can return any item within 30 days of delivery.
Sofas and other large items are collected from your door
for a £35 fee; everything else you can post back for free.

The second version names the question the way a customer would ask it, and repeats the subject — “sofas and other large items” — inside the passage, so the chunk still makes sense when it arrives alone.

TipThe single most effective edit

Put the question, in your customers' own words, as the heading of the passage that answers it. It costs nothing and it moves that passage closer to every way somebody might ask.

When the agent misses something that is definitely there

It is almost always one of these, in this order of likelihood:

The question and the text share no meaningThey used a word your document never uses. Add their word to the document — a line of "also called …" is often the whole fix.
The answer was splitIt spanned a chunk boundary and neither half is convincing on its own. Keep an answer together in one passage.
Five was not enoughTwelve documents each mention it in passing; the five nearest are all passing mentions. One document that answers it properly beats twelve that touch it.
It is not indexed yetEmbedding is queued. A document uploaded a moment ago may not be searchable yet.
That page is a picturePart of the PDF was scanned. The pages with text were read; the scanned ones gave nothing to find.

WarningPartly scanned PDFs are the quiet one

A PDF with no text at all is refused at upload. One with a few typed pages and a scanned price list at the back is not: it uploads, it looks like every other document, and the scanned pages contribute nothing to any answer, ever. If part of a PDF came from a scanner or a photograph, check that you can select the text on those pages.

Watching it happen

Pipeline → Run in the dashboard asks your agent a question and shows each step as it happens, including which of your documents it read. When a turn has already happened, Activity shows how many passages it was built from — “read nothing” on a question your documents answer is the clearest sign of a retrieval miss.

What never happens

Your documents are never mixed with another customer'sRetrieval is filtered to your agent before results are returned, at the database level.
Your documents do not train a modelThey are embedded and stored for your agent's retrieval. That is the whole use.
The agent does not invent a citationIf retrieval returns nothing useful, the agent has nothing to quote — which is when it should say so, or hand over to a person.
A document does not give ordersPassages reach the model marked as data, below the platform's rules and your own instructions. A line in an uploaded file that says "ignore your instructions" is read as content, never followed.

If embedding is unavailable

Search falls back in two steps rather than failing. Each is a floor, not an equal.

Each step runs only when the one before it found nothing.

The keyword step finds the word you typed and nothing that merely means it:

text
Question:  "can I get my money back?"

  meaning  →  finds a passage headed "Refunds"
  keyword  →  finds nothing, because neither
              "money" nor "back" appears in it

The last step exists for a small agent whose documents have not been indexed yet: rather than answering “I could not find anything” to a question its three short documents do answer, it is given them whole — cut down to a fixed size, so a large knowledge base is never pasted in entire.

NoteWhere the limits come in

Your plan caps how many documents you may keep and how large they may be, across the whole App rather than per agent. See Plans & limits.