Skip to content
Interface language: English
Audit / Signal

An AI agent and the whole database: how to check a read is complete

Define scope, follow pagination and compare record identities while separating fetched content from completed assessment.

Article language: English

A woman holds the edge of a thick partition beside a relief map and a small niche with a teapot.
In this article

A report contains 30 assessed descriptions and the sentence, "I reviewed the entire catalogue." A few lines above, the tool response contained a link to the next page. The assistant said goodbye to the database while it still had a great deal left to say.

Consider a fictional equipment rental business. It asks an agent to assess published Polish descriptions. The agreed scope contains 245 records whose identifiers the company retained in a reference export. The agent received the first thirty and assessed them quite sensibly. The problem comes before assessment: it never fetched the other 215 descriptions. A better prompt asking for care will not cause an unsent request to reach the server by itself.

"Entire" needs an address and conditions

Before counting pages, record what must be fetched. In our rental business the task covers public Polish descriptions from one catalogue in an agreed state. The archive of withdrawn equipment and drafts of new entries are outside the assignment. The administrator panel's count of all records may therefore differ from the list available to the agent.

Do not try to reconcile the numbers by broadening permissions. First compare the definitions of the sets. If the agent was to read public descriptions, lack of access to private drafts is consistent with the task. If someone expected drafts too, a new decision about scope and access is needed. Broader permissions do not clarify an assignment.

In your own AI data-flow register, record the read source and the role used. The article on preparing an AI data-flow register (in Polish) discusses how to document that flow. The report for this task needs the project, language, status and method for establishing the reference state. Do not copy an access key's value or credentials into a control table. The person accepting the work needs to reconstruct its scope, not inherit a secret.

Also check what the API, the interface through which a program retrieves data, returns. A list of titles and identifiers may be a complete index while still lacking the descriptions needed for assessment. The task then has two reads: collect the right entries and fetch each entry's content. Do not turn evidence of the first into evidence of the second.

In our example, the reference export contains identifiers for 245 descriptions. After fetching, the agent must show that the received identifier set matches, and retain a version marker for each description. A list of product names would be too weak: two entries can have similar names, and one product may change its name during the work. Matching identifiers do not prove that the content versions match. An export containing only IDs and a current read do not establish the earlier state of the descriptions; any other available historical evidence must be assessed separately.

If the system offers no reliable total count or export, name that limitation. You can confirm that the documented pagination path was followed to the end. That is different evidence from comparison with an independently established set. The report should explain which evidence actually exists instead of choosing the most attractive number on screen.

The end of a page is not the end of a catalogue

GitHub REST API pagination documentation describes a Link header with addresses for subsequent pages. It also notes that a per_page value above the allowed maximum may be lowered without a request error. Merely requesting a huge batch therefore does not prove it was received.

An integration should use the continuation method specified by the particular system. It might be a link, page number or cursor, a received marker for where reading continues. Do not assume two APIs use the same fields. If the response contains a next-page address, the agent should notice and handle it instead of treating a convenient list length as the server's decision to stop.

In AIP-158, Google allows a page shorter than requested, even an empty one, while the collection has not ended. The absence of a next token signals the end. The document also distinguishes a continuation token from permission: every request still requires authorisation.

The rule "fewer than 100 arrived, so we're done" therefore needs support in the chosen input's contract. Do not transfer it from another service. In a controlled test, return a shorter page with a valid continuation. The next entry should still reach the set. If the agent stops, a concrete acceptance defect has been found before assessing the quality of its opinions on descriptions.

Also distinguish the end of an API page from a tool truncating the displayed response. The server may have returned a full page while the assistant saw only its beginning. The missing part needs to be read or obtained by another route. A tool call alone does not prove the entire returned content reached the material used for the work.

This boundary comes before using long context with AI (in Polish). There we check whether the model used a supplied exception. Here we ask whether the relevant record reached assessment at all. Changing the model may leave the same gap if both receive an identically truncated list.

At each step retain the input cursor marker, number of entries received and continuation information. The full product content need not be copied into every log entry. Detecting a repeated cursor is useful: an integration circling the same page should not produce an ever larger report of supposedly increasing completeness.

In our task, language and status should remain the same throughout the read. If someone changes the filter from Polish descriptions to all languages after page three, the rest of the list answers a different question. A saved cursor should not hide that change. If scope must be widened, start a separate run and retain its conditions. The team can then compare both results instead of guessing where other records began entering the set.

The total matches, but forty entries are missing

For this material, a separate reproducible offline test was performed using 245 synthetic identifiers; its script and result accompany the editorial package. With pages of 40 entries, the correct run has six full pages and a final page of five records. These are not customer data or results from a particular service. A small fixture lets us establish in advance exactly what should return.

Aeneia conceptual photography

In the faulty variant, the third response repeats the second group of forty. The remaining pages are correct. The raw total is still 245 records. There are only 205 unique identifiers, however, and forty expected ones were not received. As long as acceptance checks only list length, a repeated page can replace a missing one without disturbing the report's favourite number.

Do not silently remove duplicates and declare success on the remaining material. Record which identifiers repeated, what is missing and at which transition it happened. If retrying is permitted, return to the appropriate point under the API's rules. Do not fill gaps from similar titles or guess that they are probably old products.

The same fixture can substitute an unexpected identifier for an expected one. Then the received count and unique count are correct, but the set is still different. That is why we compare specific elements with the reference scope. For 245 entries, their identities also need confirmation. Matching two counts alone would hide the substitution.

Only after a complete read does the check begin for whether the agent assigned results to the right entries. Accepting batch processing (in Polish) covers that later stage. It is possible to fetch 245 descriptions correctly and then swap their assessments. It is also possible to assess the 30 descriptions fetched without error and never see the rest. These are different defects with different repair points.

Another number may appear in the final report: descriptions needing improvement. Suppose the index contains all 245 entries, but fetching the content of two failed. The agent assessed the remaining 243 and identified 17 for editing. Those 17 may be a correct result for analysis of part of the set. They do not prove the two missing descriptions are good. The person accepting should see index scope, fetched-content scope and completed-assessment scope separately.

Agree on this before starting, especially when the recipient wants only a list of problems. In that format, a product absent from the report could mean "checked, no findings", "not fetched" or "not assessed". Each calls for a different action. A status inventory can be kept outside the concise recommendation list; there is no need to add 245 complete descriptions to an email. Preserve a way to find the two unresolved entries so the team can return specifically to them.

Do not replace a fetch error with an empty description. That would turn a technical problem into an apparent assessment of product content. If the company plans to commission corrections based on the report, a record whose content was not read should first be investigated. Otherwise the writer receives a task to improve text the reviewer never saw.

One list needs one point in time

During another read, the team publishes a new description and withdraws an old one. The count remains 245. If subsequent pages are made from the current state, the agent may combine the beginning of an older catalogue with the end of a newer one. Even a matching unique identifier count does not establish that the state agreed at the start was reconstructed.

Check which consistency rules the specific API offers. If it allows reading a frozen revision, continue in that revision and collect each page's marker. If it requires a restart after a change, preserve the incomplete run separately and start again. A cursor alone is not a universal guarantee that data remains unchanged.

When the service offers no such guarantee, the team can choose an agreed export or limit its conclusion to observations over the reading interval. Do not describe that as one precise snapshot of the database. In the rental example, comparison with the retained export can reveal a difference, but it does not give the server properties it does not have.

A hash of the supplied file (in Polish) helps confirm that later participants used the same export. It does not prove completeness relative to the source system. That assessment still needs the file creation method, scope and identified time boundary. Two identical incomplete files remain identically incomplete.

An interrupted read should remain visible too. GitHub's API rate-limit guidance calls for waiting the time in Retry-After when that header is present and using limited retries. A rate-limit response is not an empty final page.

In our catalogue, an agent encountering an error on page five should retain the fact that fetching is incomplete. It may resume if the token and version consistency still permit it. Otherwise it needs a new run. A later report can describe entries already assessed, but should not be labelled a complete review.

Likewise, a fragment of a streamed response (in Polish) does not replace confirmed completion. For a list, distinguish receiving page content, recognising its continuation and finishing the entire scope. An interrupted read then has its own state instead of disappearing into a generic "AI answered too briefly" error.

For a conversation with Aeneia Audit, prepare one assignment, the API input description and a small permitted reference sample. A review of the agent's workflow can then show which evidence is achievable and where the conclusion must be limited. It does not require transferring the whole real database to another conversation with a model.

The person accepting should be able to identify the scope, last recognised read state and whether the received set matches. If the agent reached only entry thirty, the report may still contain thirty useful assessments. Give them the correct name. A catalogue does not become shorter because the assistant decided its closing paragraph was a good place to stop working.

Aeneia / Aeneia editorial

Editorial article. Source links are included in the text.

About Aeneia

Brands we have worked with

  • L’Oréal
  • Garnier
  • Netflix
  • Carrefour
  • Warner Bros. Discovery
  • Biedronka
  • HBO Max
  • Wolt
  • Żabka
  • COSRX
  • Embassy of China in Poland
  • Mixa
Aeneia / Initium

From knowledge to a decision

Tell us what you want to put in order. We will agree on where to start.

Contact Aeneia

We partner with and use solutions from:

  • Google
  • OpenAI
  • Microsoft
  • Stripe
  • Anthropic
  • Linear