---
title: "Read the record back before you call the task finished"
description: "Confirm an agent write by reading the record back and comparing the fields the task named. A status code and a closing sentence are not that read."
canonical: "https://www.agentrail.co/blog/verify-an-api-write-with-an-ai-agent?h=6AQ895XXJ8W9Y00R"
author: "Vivek Mittal"
published: "2026-11-17T12:20+00:00"
last_updated: "2026-11-17T11:06:46.681Z"
---

# Read the record back before you call the task finished

Confirm an agent write by reading the record back and comparing the fields the task named. A status code and a closing sentence are not that read.

![A white database icon with a magnifying glass on a dark gradient](https://images.ctfassets.net/1htfyfnn1o5y/5GSsr00hwjnkPOngeJVeVB/ea8931647c9a99afa4ef55add5e09e27/ce646ebc-69a4-4bb6-b856-14f011ed69a3.png?w=1600&fm=webp&q=72)

Call a write finished only after a later read matches the fields the task named. The write's status code is a claim about the call. The agent's closing sentence is a claim about the call. The stored row is the check.

The pass rule that decides the bit, including what stays ungraded, is [how to write the pass rule for one agent task](https://www.agentrail.co/blog/agent-task-success-criteria?h=6AQ895XXJ8W9Y01P).

> **Key Takeaways**
>
> After a POST, PUT, PATCH, or a tool that writes, read the record through a separate call.
>
> Compare the fields the task named. Leave extra fields out of the verdict.
>
> A 2xx body can hint at an id. The stored fields are the check.
>
> A 404, a field mismatch, or a read you could not perform means the write is not confirmed.

## Treat the write response as a claim

A write response is what the server, or the tool, said at the moment of the call. It can include a status code, an id, and an echo of the payload. It can also be empty, HTML, or a generic "ok."

A cache, an async worker, a wrong workspace, or a silent drop can sit behind a tidy status. The confirmation step is a read that fetches product state after the write.

Anthropic separates the transcript from the outcome. An agent can say a flight is booked while the database holds no reservation ([Demystifying evals for AI agents](https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents), 9 January 2026). Treat the agent's "created" line, and a bare success status, as that transcript. The subsequent read is the row.

An HTTP route, an SDK method, or an MCP tool can return that same envelope. Read the customer, file, key, or webhook the call was supposed to change.

## Read by identity, then compare the named fields

Walk the steps in order. Save the agent's summary for the note.

1. Name the record the task was supposed to change: a customer, an invoice, a webhook, a file, a key, or a row.
2. Take an identifier from the write as a pointer. If the write returned none, get by the natural key the task named.
3. Read that record with a GET, a query, or a fetch. The body under test is this read, not the write response.
4. Compare the fields the task required: URL, status, amount, path, scope, and the account, repo, or workspace. Leave unnamed fields out.
5. Record the read next to the trial: identity, the status of the read, and the field values you compared.

A match on those fields confirms the write for this task. A mismatch, a missing record, or a read you could not perform leaves it unconfirmed.

The fields that matter were chosen on the pass-rule card. The attempt you are grading may already sit in [agent journey analytics](https://www.agentrail.co/blog/agent-journey-analytics?h=6AQ895XXJ8W9Y02M). Counting confirmed trials is [agent task completion rate](https://www.agentrail.co/blog/agent-task-completion-rate?h=6AQ895XXJ8W9Y03J).

## A status code still needs the read

Read past the status code.

A 201 with an empty body still needs a natural-key lookup. A miss leaves the write unconfirmed. A 200 on a PUT can sit in front of a GET that still shows the old value, and that GET is the verdict. A 204 has no body to compare.

A 200 that echoes the request can be built without a durable write. So can a tool result of `success: true` that returns the arguments you sent. Read the store either way.

If the read returns the right id and the wrong field, write both values in the trial note. "Task required `published`. Read returned `draft`." That sentence is the failure. Ten matching fields do not replace the one field the task named.

## Say why the read failed, and withhold confirmation

A 404 means the record is not there under the identity you used. The write may have gone to another account. Look up by the natural key before you add another explanation. If the natural key also misses, the verdict is missing.

A 403 means the credential on the read cannot see the record. Leave the trial unread, and change the evidence path before you grade it.

A read that hits a different workspace than the task named is a mismatch, even when a record exists there. Note the workspace id next to the field diff.

Some stores are asynchronous. Wait only for a delay the pass rule already states. A delay chosen after a failure is a new rule, and it applies to the next trial.

A second write can create a second record. Retries that send the write again are [an idempotent API for AI agents](https://www.agentrail.co/blog/idempotent-api-for-ai-agents?h=6AQ895XXJ8W9Y04G). Confirm with a read.

A DELETE that returns 200 is confirmed when a follow-up read shows the missing state the task named, often a 404 on that identity. A 403 on that read is unread. Absence is the 404 the task named. Put the expected read on the card before the run.

## Store the read so a later review can re-check

Store these lines with the trial.

`Write: [method and path, or tool name]`

`Pointer: [id or natural key]`

`Read: [method and path, status]`

`Fields: [expected from the task] vs [returned]`

`Verdict: [confirmed | mismatch | missing | unread]`

The verdict "confirmed" requires a read you actually performed. "The agent said confirmed" is not a value of this field. Unread means you could not interpret the read: auth on the grader, a timeout, or a 5xx from the read itself. If the natural-key lookup misses, the verdict is missing.

Park the agent's last message in a note. The verdict stays the read.

Compare the read to the task. The write body is what the agent claims it sent. The shapes below are illustrations, not stored results.

`Task field: callback URL https://example.com/hooks/billing`

`Write echo: https://example.com/hooks/billing`

`Read:       https://example.com/hooks/billng`

`Verdict:    mismatch`

The echo matched the task URL. The stored URL is the mismatch.

`Task: create the customer in account A`

`Read: customer exists in account B, with the fields the task named`

`Verdict: mismatch`

The fields can match and the identity can still be wrong. Put the account, the repo, or the workspace on the evidence line.

The change to the API, the tool, or the doc, once the same mismatch keeps showing up, is [agent experience optimization](https://www.agentrail.co/blog/agent-experience-optimization?h=6AQ895XXJ8W9Y05E). Write the verdict next to the trial, then call the write finished only when that verdict is confirmed.
