A barber shop books customers in an old program. It has no way in for other code. People ring to move a booking.
The first try is a macro. It repeats the same clicks every day and never looks. A new booking moves the rows. A notice covers the screen. Then the macro changes the wrong thing, or nothing.
This is computer use. The model reads a screenshot and asks for one action.
- Code draws the screen as a picture and sends it with the job.
- The model asks to click a point or to type, as a tool call.
- A guard refuses any click on a delete button.
- Code does the action and takes a new picture.
For example, a notice appears. The model clicks OK, then looks again.
sequenceDiagram
participant Code as Your code
participant Model
participant Program
loop until the job is done
Code->>Program: take a screenshot
Code->>Model: the job and the picture
Model-->>Code: click or type
alt the button deletes something
Code->>Code: refuse and say why
else the action is safe
Code->>Program: do it
end
end
- Working a program by sight is computer use.
- The picture of the program is a screenshot.
- The delete check is a guard.
- Each action is a tool call.
uv run lab computer-use naive
uv run lab computer-useAdd --case 2 or --case 3 to try the other cases.
There are three calls from customers. A call counts when the asked change is saved and nothing else changed.
| Version | Changes made correctly | Tokens used |
|---|---|---|
| Recorded macro | 1 | 0 |
| Look, then act | 3 | 19132 |
Now break it. Open the pattern file and find risky. Make it always say no. Then run the test:
uv run pytest tests/promises/test_computer_use.pyThe test fails, because the model can now delete a booking.
- The model may click one spot again and again. Check that your screen shows a change. Our first screen had no cursor in the box, and the model got stuck there.
- Code stops after a set number of actions. Look at the printed actions to see where it stuck.
The program here is drawn by code and is very plain. A real screen is busier and harder. The macro costs nothing to run. Use a real way in, such as a tool, when there is one.
This lab uses its own click and type tools. Some model makers offer a built in computer tool. This lab does not use it. Run a real one in a sealed machine.
Go to Generate screens from typed blocks. There the model helps build the screen.