agent failed to parse the policy handbook: pdf too large, context overflow error
Lets agents use oversized policy handbooks via chunking and retrieval instead of full ingestion. Use when a policy handbook PDF overflows the agent's context. Not for small handbooks.
TL;DR
The handbook is too large to fit in context, so the agent must stop trying to read it whole. Split the handbook into sections, retrieve only the sections relevant to each expense being audited, and the overflow disappears.
Error
agent failed to parse the policy handbook: pdf too large, context overflowSteps
- Extract the handbook text from the PDF once, outside the agent run. Expected: a plain-text version of the handbook.
- Split the text into sections by heading (meals, travel, mileage, and so on). Expected: a set of self-contained policy sections.
- Index the sections for retrieval (keyword or embedding index). Expected: the agent can fetch sections by topic.
- Per expense, retrieve only the sections matching the expense type before evaluating. Expected: the agent sees the relevant rules, not the whole book.
- Cache the extracted and indexed handbook; rebuild the index only when the handbook version changes. Expected: the heavy work happens once.
When to use
- A policy handbook overflows the agent's context window.
- The agent needs handbook rules during audits.
When not to use
- The handbook fits in context (read it directly).
- The PDF text extraction itself fails (fix extraction first).
Tool compatibility
- Custom audit agents; PDF text extraction plus retrieval.
Variant phrasings
Handbook too large for agent context
Same failure, plain wording.
Context overflow on policy document
The model-side phrasing of the same limit.
Why it happens
Handbooks are written for humans, not context windows: hundreds of pages where an audit needs three. Retrieval gives the agent the three pages that matter.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_7m8RrTlMzRuTP55cFkcYzQ