Browser agents: test your site the way the agent sees it|INEMA.CLUB-PRO

Lesson 5 · 15 min

Task contract for a browser agent (goal, limits, proof, stop)

"Book a service for me on the site" sounds like a request. For a browser agent, everything is missing: which page, what it can touch, how to prove it is done, and when to stop. In this lesson you write a task contract in four parts and check with a script that the contract is complete before handing it to any agent.

Start the lesson
Dark work desk with a checklist sheet next to a keyboard and a monitor showing a form, neutral light.

In this lesson you will

  1. 1Goal: where and what
  2. 2Limits: what it can and can't do
  3. 3Proof: the text you see on the page
  4. 4Stop: when to stop and call the person

Goal: write the contract for a browser task with goal, limits, proof and stop, and check that it is complete.

01The four parts

Tap each block. Read from bottom to top when you review.

Click each block in the diagram to see what it does.

Without proof, the result is a promise. Without limits, the whole site is at stake. Without a stop, the agent keeps pushing until it makes things up.

02Writing each part

What conferir-contrato.mjs checks for, and why.

1. Goal

20 letters or more and a place: an address or a page name. "On the shop's site" won't do; "on the agendar.html page" will.

One task, one result. Two things become two contracts.

03A complete contract and a vague one

The same script checks both. The part titles also work in English and Spanish (Goal, Limits, Proof, Stop; Objetivo, Límites, Prueba, Parada).

File · kit/contratos/exemplo.md
# Contrato: horários de troca de pneu

## Objetivo
Na página http://127.0.0.1:8433/agendar.html, descobrir os horários livres de "Troca de pneu" em 2026-11-03.

## Limites
Pode preencher o formulário e clicar em "Ver horários". Não clique em "Agendar às…" nem em "Confirmar". Não saia de http://127.0.0.1:8433/.

## Prova
A página mostra "4 horários livres para Troca de pneu em 2026-11-03." Devolva os horários copiados da lista, não de memória.

## Parada
Pare e descreva a tela se aparecer login, verificação humana ou pedido de confirmação. Pare depois de 10 ações sem chegar à prova.
Terminal · check the complete contract
cd ~/projetos/formacao-webmcp-navegador-v72/kit
node conferir-contrato.mjs contratos/exemplo.md; echo "saída: $?"
Terminal · check the vague contract
cd ~/projetos/formacao-webmcp-navegador-v72/kit
node conferir-contrato.mjs contratos/vago.md; echo "saída: $?"
Example from the repository
contrato ok: 4/4 partes (objetivo, limites, prova, parada) · contratos/exemplo.md
saída: 0

All four parts are there, each with what the script checks for.

04Practice

From vague to complete, and a contract for your site. Each exercise has a "done when".

E1 · Fix the vague one

10 min

Copy kit/contratos/vago.md to meu-contrato.md and rewrite it until the script accepts it. Use the conta.html page: the proof is the list of appointments, and the stop is the login screen.

Done when: node conferir-contrato.mjs meu-contrato.md → contrato ok: 4/4 partes and saída: 0.

E2 · A task from your own site

15 min

Write the contract for a real task on your site (local or staging), read-only. The proof must be text you can find on the page right now.

Done when: node conferir-contrato.mjs contrato-site.md → contrato ok: 4/4 partes, and the proof text shows up with Ctrl+F on the page.

05Lesson quiz

Question 1 of 4

Which of these sentences works as proof in a task contract?skill

06In three sentences

Four partsGoal with a place, limits with a "no", proof in quotes, stop with a number.
Proof is not a sentenceIt's text you look for on the page and find.
Stopping is a resultStopping with the exact reason is worth more than pushing on and making things up.

Going further

Previous lessonNext lesson