Agent-First PDF v0.1.0
The first release of Agent-First PDF — article text, structure and images recovered from PDF layouts, with the engine's evidence kept beside every interpretation, one child process per document by default, and a pinned PDFium build installed and verified on request.
Text pulled out of a PDF comes back shaped like the page: lines broken where
the typesetter broke them, a page number every forty lines, two columns read
across instead of down. Agent-First PDF (afpdf) returns the article instead,
as headings, paragraphs, provisions, tables and figures in reading order, each
with the page and rectangle it came from.
Why it is built this way is in The Article, Not the Page. This post covers what v0.1.0 does once it is installed.
What ships
- One extraction, two layers. The default result has document facts,
organized article blocks and continuous text.
--set output.basic=trueadds the engine’s evidence: per-page raw text, glyph styles and geometry. The SDK can rerun organization over that evidence with other options without reopening the PDF. - Incomplete results say so. Every result reports pages processed and failed, whether the page cap was hit, and how many glyphs were clipped or could not be mapped. Each page has a status, so a scanned page is reported as needing OCR instead of coming back as empty text.
- Isolated by default. The CLI and the service SDK run each document in its own child process, with a wall-clock timeout, a bounded result and a page cap. An abort or a hang becomes a typed failure for that document.
- Typed configuration.
config show/get/set/unsetwork on dot paths with validated, atomic writes, and--set KEY=VALUElasts for one invocation. Output is AFDATA protocol events, in JSON, YAML or plain text.
Limits worth knowing
The worker memory limit is enforced on Linux only. Elsewhere it defaults to zero, and asking for a nonzero limit fails every worker instead of running unlimited. There is no OCR and no model call. Table cells, caption association and formula semantics are not guaranteed. The checked-in regression fixtures are Chinese legislation and regulatory documents. The rules are written to be general, but they have not been proven on arbitrary papers or languages.
Getting it
$ brew install agentfirstkit/tap/afpdf # macOS and Linux
$ scoop bucket add agentfirstkit https://github.com/agentfirstkit/scoop-bucket && scoop install afpdf # Windows
$ cargo install agent-first-pdf --locked
PDFium is not bundled. Fetch the pinned build once per machine, then check what extraction will load:
$ afpdf engine install
$ afpdf engine status
$ afpdf extract article.pdf
To use the library, depend on agent-first-pdf with default-features = false
and turn on engine for in-process extraction or isolation for the
child-process client. The Agent Skill
tells a coding agent when to trust a page’s text and when to ask for OCR.