How do you stop a browser agent from acting on a page that already changed? We ended up putting the check inside the engine.

Reddit r/AI_Agents News

Summary

A developer shares design notes on building a shared-tab browser where human and agent both act, tackling the staleness problem by tagging every agent action with a control epoch and page revision so the engine rejects outdated actions instead of silently clicking the wrong element.

Been building a browser where a person and an agent share the same tabs, and the problem that ate the most design time wasn't the model, it was staleness. The agent reads the page, decides to click node 42, and by the time the click lands a modal has opened, the person has taken over, or the page navigated. Node 42 is now the wrong thing or gone. What we ended up with: every agent call carries a control epoch (who is driving this tab right now) and the page revision the agent's plan was computed from. If the person took over, or the document moved on, the call fails with a stale target error and the agent has to re-read. It never acts on whatever happens to be at that position now. Opening, picking and closing tabs is human only, so the agent can prepare but the person commits. The cost is real: more round trips, and the agent has to treat "stale" as a normal outcome, not an exception. The benefit is you stop getting the silent wrong click, which is the one failure nobody notices until a form is already submitted. Curious how people doing this on top of Playwright or CDP handle it. Snapshot and diff before every action, lock out human input during a run, or just accept the race? Source link in the comments if anyone wants to read the implementation.
Original Article

Similar Articles