Document-Reading Agents
Give your AI agents one tool to read any document — 100+ formats, structured output, every framework.
What it looks like in practice
Picture an agent asked to answer a question from a customer's uploaded contract — a 40-page scanned PDF with a few tables. Before it can reason about anything, the agent has to open that file, read it in the right order, and get the tables out intact. That single “read the document” step is where most agent workflows quietly break.
Why documents break agents
Agents think in text and tool calls. They can't natively open a PDF, a DOCX, or a scan — so you bolt on a loader for each format. Every format brings its own failure mode: scans need OCR, spreadsheets need structure, multi-column pages need reading-order detection, and headers and footers leak into the text. The agent's tool surface turns into a pile of format-specific loaders that work on the happy path and fall over on the next unusual file.
Worse, when extraction is subtly wrong — a scrambled reading order, a dropped table, a header glued onto a paragraph — the agent has no way to know. It reasons over the garbled text and hands back a confident, wrong answer. Bad input doesn't raise an error; it produces a plausible hallucination.
One tool, any document
Xberg gives the agent a single read-any-document tool. It detects the format, runs OCR when the page is a scan, preserves tables and reading order, and returns structured, machine-readable content the model can actually reason over — the same call whether the file is a clean PDF, a photographed form, or a spreadsheet.
- Reads 100+ formats — native and scanned — behind one interface.
- Preserves reading order and table structure, so the model sees the document the way a person would.
- Returns structured output: clean text, tables, and metadata, not a wall of scrambled characters.
- Ships native tools for LangChain, LlamaIndex, and CrewAI — drop it into the agent you already have.
- Same API in 12 languages, so your stack stays consistent.
In code
Register Xberg as a tool and the agent calls it on its own whenever it needs to read a file:
from crewai import Agentfrom crewai_tools import XbergToolanalyst = Agent(role="Contract Analyst",goal="Answer questions grounded in uploaded documents",tools=[XbergTool()],)# The agent decides when to read:# "Open contract.pdf and list the termination clauses."
What the agent receives
Instead of raw bytes, the model gets structured content it can ground its answer in:
{"content": "MASTER SERVICES AGREEMENT\n\n1. Term and Termination…","tables": [{ "rows": 6, "columns": 3 }],"metadata": { "format": "pdf", "pages": 40, "ocr": true }}
Why it matters for agents
- One tool instead of five — a smaller, more reliable tool surface for the agent.
- Clean input means fewer confident-but-wrong answers from garbled text.
- Framework-agnostic: the same extraction behind LangChain, LlamaIndex, or CrewAI.
- Self-hostable, so agents can read sensitive documents without anything leaving your environment.
More use cases
RAG Pipeline Ingestion
Turn a pile of PDFs, Office docs, and HTML into clean, chunked, embedded data for your vector database — in one call.
Replace Legacy IDP
Swap brittle, template-based processing for one API that returns schema-mapped JSON — no templates to maintain.
Bulk Archive Digitization
Structure millions of legacy and scanned documents for search and ML — built for batch on a Rust-native core.