A dependable browser agent loop distinguishes a proposed action, an attempted action, and a confirmed result. A click returning does not prove the business action completed, and a submission that times out does not prove it failed. If a submission times out, reconcile its result before another attempt, or the agent may submit twice.
Before you start
A browser agent setup and a task with a checkable result, such as a confirmation message or a changed record.
Define the expected result before the action
For each action, write what the page should show afterwards: a confirmation message, a new row in a list, a changed status. The expected result is part of the action, not an afterthought.
Write the failure signs too: an error message, an unchanged page, a missing confirmation.
Observe the page after the action
After the action, take a fresh observation: a screenshot, the accessibility tree, or the page text. Compare it with the expected result, and do not continue until it matches.
Wait for the page to settle before observing: a fixed sleep either cuts a response off mid-token or burns seconds on a fast page. Wait for the expected state instead.
Reconcile before the next attempt
If the action timed out, check whether it actually happened before you retry: look for the confirmation, the new row, or the changed record. A retry of an action that already succeeded creates a duplicate.
If the result is uncertain and cannot be reconciled, stop and escalate with the observation attached, rather than guessing.
Practice check: fictional Maple Corner order form, submit action
The table below is fictional practice material, worked out by hand from the stated actions. It is the expected result for the practice task, not a run of any agent.
| Action | Expected result | Observed | Verdict |
|---|---|---|---|
| Click submit | Confirmation page | Confirmation page | Pass |
| Click save draft | Draft saved message | Draft saved message | Pass |
| Submit, timeout | Unknown | Order in list | Pass – reconciled, no retry |
| Click delete | Row removed | Row still there | Fail – not achieved |
Three actions achieve their expected results, and the timed-out submit is reconciled by finding the order in the list, so no duplicate is created. The delete fails because the row is still there, and the agent must not claim it worked.
Expected result. UNTESTED: the actions in the practice table are worked out by hand, not measured by running a browser agent. Define the expected result for your own next action, observe the page after it, and reconcile a timeout before you retry.
Limits
- A successful click is not a successful transaction: check the result on the page.
- A timeout does not prove the operation failed: reconcile before another attempt.
