hotai.news
← Back to AI WikiAI Wiki / Solve a problem

An agent reads only the first page: how do you verify pagination completeness?

When an agent processes only the first page, check that the next-page marker reaches the subsequent call and stop according to the service’s own termination rule. Data on the first page does not establish completeness, and a short page is not necessarily the last page.

HotAI.news · Sources checked with CodexPublished on 2026-10-20Sources checked on 2026-10-20
Our take

Start troubleshooting here

When an agent processes only the first page, check that the next-page marker reaches the subsequent call and stop according to the service’s own termination rule. Data on the first page does not establish completeness, and a short page is not necessarily the last page. Preserve page cursors and stable record IDs to detect omissions, duplicates and false claims of complete retrieval.

01

Use a known multi-page collection to reproduce missing records

This applies when a contact, document or task summary contains fewer records than the source while the agent claims completeness. Use a known multi-page test collection and record page size and filters. Do not compare totals taken at different times without qualification: changes during enumeration can also produce apparent count discrepancies.

02

Check that the next-page marker is retained and followed

Inspect the response for a next-page URL or cursor, including whether result truncation removed it. Check that subsequent requests preserve filters and ordering. When an API requires the complete nextLink, do not reconstruct it yourself. If a cursor repeats without progress, stop and report the anomaly rather than reading the same page indefinitely.

03

Keep advancing cursor state in the application

Keep pagination state in the orchestration application and inspect stable IDs for duplicates while advancing until the service no longer supplies a next page. For a complete snapshot, use a consistency mechanism supported by the API or record the collection interval. Progress reports must distinguish records read from pages remaining; a truncated intermediate result is not a complete collection.

04

Compare record ID sets and confirm traversal termination

Use a fixed sample spanning at least two pages and compare source and result ID sets rather than counts alone. Include an empty page that still has a next-page marker, and test whether an intermediate failure is incorrectly reported as completion. Claim complete retrieval only after the termination condition is satisfied and all intended records are present.

Pagination differs by service; one API’s page size and field names are not universal. This article did not enumerate private contacts or documents. A dynamic collection may not offer a strict point-in-time snapshot, which should be disclosed. Deduplication can remove repeated records but cannot recover records never retrieved.

Checked sources

These sources support the concepts and methods described here. Examples and test scope are labeled separately; check the version of the tools you use.

Back to AI Wiki ↗