Computer-Use and Browser Agents › Working example: reconciling a task list
Language AI HandbookAll chapters A compound objective marks task 2 done and archives task 1. The grant carries each operation and record separately. After marking task 2 done, the policy reads the accepted outcome, returns to the task list, takes a new view of task 1 and confirms the archive. It uses the same runtime for both writes. The success predicate checks both final task states.
PythonIn [33]Expand
def compound_policy(obs, history):
if obs.page == "confirm":
return choose(obs, "Archive task", "Confirm archive")
if "done" not in history:
return choose(
obs, "Open task 2" if obs.page == "tasks" else "Mark done"
)
if obs.page == "tasks":
return choose(obs, "Open task 1")
if history[-1] == "done":
return choose(obs, "Back")
return choose(obs, "Archive")PythonIn [34]Expand
app = MockApp()
compound_grant = Grant(done=frozenset({2}), archive=frozenset({1}))
finished = lambda local: (
local.tasks[2] == "done" and local.tasks[1] == "archived"
)
success, outcomes = run_episode(app, compound_policy, compound_grant, finished)ConsoleOut [35]Expand
Compound goal complete: True | outcomes: ('open', 'done', 'back', 'open', 'ask_archive', 'archive')
Final local tasks: {1: 'archived', 2: 'done', 3: 'done'}A final result can describe each operation separately. If the first write succeeded and the archive was denied, report a partial outcome. A single failed label loses information about a completed write. A single done label can conceal an unmet part of the request. The fixture is sequential. An application that promises an atomic multi-record change needs transactional support or a specified compensation policy at its own boundary.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!