The Computer-Use Loop
In this article
- Trace one step of a computer-use agent from the model's proposed click to the screenshot your code sends back.
- Write the expected page state before an action and check the new page against it afterwards.
- Set a retry limit and a stop rule that end a loop which makes no progress.
- Pick the right recovery for a cookie banner, a pop-up dialog, a wrong page and an expired session.
- Terms defined here: perceive-act loop, action space, post-action verification.
Overview
An agent is collecting supplier invoices from a supplier's web portal that has no API. It clicks the "Invoices" link and moves on. Did the invoice list open? Or did the click land on a cookie banner that slid over the page a moment earlier? If nothing in your code looks, the agent keeps going on a page it misreads, and its final "done" means nothing.
Here you follow a computer-use agent one step at a time: what it looks at, which actions it may take, and how your code decides whether a step worked. By the end you can set two limits that end a loop going nowhere, and a recovery rule for four pages you did not expect, including the one page that must go to a person.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- One step on the wire
- What the loop sees and does
- Expect, act, check
- Bounds that end the loop
- Four pages you did not expect
- Common mistakes
- In production
- Sources
- Check yourself, 13 questions