AI explained

Document parsing for AI agents: prepare files that parse well

An AI agent answers from the text it extracts, not from how your PDF looks. Five things that break parsing, a prep checklist and a check to run after upload.

By the Askocto team · · 5 min read

Document parsing is the step that turns a file, such as a PDF or a Word document, into plain text an AI agent can search and quote. What you see on the page is not what the parser gets. Tables flatten, columns interleave, scanned pages return nothing. If the text is wrong at this step, every answer built on it is wrong too, and no model setting can repair that. Prepare your files with parsing in mind, and check the result.

In short: The agent answers from extracted text. Prefer text-based files, simple layouts and clear headings, avoid scans and tricky tables, and test with questions whose answers you can find on exact lines.

What parsing does

A parser reads a file and produces text, often with some structure: headings, paragraphs, lists. The text is then split into passages and indexed so the agent can find the ones that match a question. Two things matter for you:

  • Order. Text must come out in reading order.
  • Meaning. A number must stay next to the label that explains it.

Both can fail without any visible error. The upload says it worked, and the agent confidently quotes the wrong cell of a table.

Five things that break parsing

Tables

A price list or a shipping matrix is a table to you. After parsing, it may read as one long line of numbers, with column headings far away from the values. Ask: if a person read only the extracted text, could they tell which number belongs to which row and column?

Multiple columns

Brochures and newsletters often use two or three columns. A parser can read straight across the page, mixing lines from neighboring columns into nonsense.

Headers, footers and page numbers

Repeated text, such as a company name or "Page 4 of 12", can appear in the middle of sentences when a paragraph crosses a page break. The agent may even quote the footer.

Scanned pages and photos of text

A scan is an image. Without text recognition there is nothing to read, and with it there are often errors, especially in small print, stamps and handwriting.

Information in images

Charts, screenshots and diagrams carry meaning that the text does not. If the policy sits in an infographic, the agent cannot answer from it.

A prep checklist

  1. Start from the source document, not a print of it. Export the original Word or design file to PDF instead of scanning.
  2. Use real headings and lists, not bold text and manual spacing.
  3. Convert tables that matter into short sentences or a labeled list, for example "Standard shipping, domestic: 3 to 5 working days".
  4. Remove repeated headers and footers where you can.
  5. Put key information in text, with a one-sentence description for every chart.
  6. One topic per file when possible. A single 80-page manual is harder to retrieve from than twenty focused pages.
  7. Give files clear names and dates, so you know which version you uploaded.

Check the result

After upload, test before you trust.

Check How What failure looks like
Source status Wait for Ready, not Training or Failed A Failed file has no usable text
Size Compare the character count with what you expect A large file with a tiny count means a scan or an image
Exact lookup Ask a question whose answer is a single known line The agent answers vaguely or from another file
Table lookup Ask for one cell, such as a price in a given row The agent mixes rows or columns
Page-break sentence Ask about a paragraph that crosses pages A footer appears in the answer

In Askocto, you add files (PDF, DOCX, TXT or CSV) under Build > Sources, and each source shows a status of Queued, Training, Ready or Failed and a character count. The Playground in the Test tab shows which source an answer came from, so you can see whether it quoted the file you meant. The data sources guide covers the source types.

When a file is the wrong format

Some content is better as something other than a file:

  • A few key answers: write approved Q&A pairs, so the agent gets the exact wording.
  • A policy that changes often: keep it on a web page and use a website source with scheduled retraining.
  • A table of fixed values: convert it to text, or serve it through a lookup action when it is large and live.
  • A long manual: split it by topic before upload.

Structuring a knowledge base for AI explains how to organize content in general, and training an AI agent on your help center shows how to bring in content that already lives on the web.

How parsing connects to retrieval

After parsing, text is split into passages and turned into numeric representations so that similar meanings can be found, which vector embeddings explain. Search results can then be reordered for relevance, as reranking describes. Parsing sets the ceiling for all of it: a passage with a scrambled table cannot be rescued by better search. If you want to build the pipeline yourself, RAG from scratch walks through each stage.

Keep it up to date

Files go stale. Keep a list of uploaded files with an owner, a date and a review cycle. In Askocto, the source list shows each file's status, so note the date you last retrained next to it. When a policy changes, replace the file, retrain and rerun your exact-lookup questions. A source can be Ready and still wrong. The product overview shows where sources sit among the other parts of an agent.

Frequently asked questions

What is document parsing?

It is the step that extracts text and structure from files such as PDFs and Word documents, so an AI system can search and use the content.

Why does my AI agent give wrong answers from a PDF?

Often the extracted text is wrong: a flattened table, mixed columns, a repeated footer or a scanned page. Check what was extracted and prepare the file again.

Can an AI agent read scanned documents?

Only through text recognition, which can make mistakes. Where possible, use the original digital file.

Which file type parses best?

Text-based files with simple layouts, such as TXT, DOCX with real headings, or a PDF exported from the original, tend to work best.

Train an agent on your own help center

Askocto answers the repeat questions across chat, email and voice and hands the hard ones to your team.

Keep reading

All articles
AI explainedgemini 3.6 flash
Feb 15, 20264 min read

Gemini 3.6 Flash: test speed against answer quality

Fast models are tempting for chat and voice, but speed is only worth it if answers stay right. A protocol to measure latency and quality together on your own conversations.

Read article
AI explainedkimi k2 api
Feb 13, 20264 min read

Kimi K2 API for support: an integration checklist

Using a model API in support means planning for slow calls, errors and changes. A pre-flight checklist and a thin wrapper keep Kimi K2 or any provider swappable.

Read article