Computer-Use and Browser Agents › Action spaces
Language AI HandbookAll chapters An action space describes what the policy can propose. The runtime defines which proposals it can execute for a particular view and which operations the application has authorized. A small vocabulary makes faults easier to diagnose. The right vocabulary depends on the environment and its instrumentation.
- Coordinate input lets you point or scroll where the interface offers no structured element. Accuracy depends on a valid coordinate frame, current geometry and explicit bounds.
- Observation-indexed actions carry an element reference that the runtime resolves against a current view. The same integer can represent different elements in different views. Pair it with a view identity and check current availability.
- Task-level actions can use application features such as a vetted read or explicit archive request. Give state-changing actions a clear scope and outcome. If a structured interface can identify the exact record and return a verifiable result, it can remove ambiguity that a sequence of clicks would otherwise leave.
Action schema in code
The local fixture accepts only clicks on known controls and a request to re-observe. An epoch, meaning the runtime-generated version number of the current view, travels with the proposal. The policy receives display data separated from the runtime’s control map. The fixture uses Python annotations for readability and validates proposals again at execution time. A type annotation does not validate an object created by the caller.
PythonIn [7]Expand
from dataclasses import dataclass, field
from math import isclose
@dataclass(frozen=True)
class Action:
epoch: int
kind: str
element_id: int | None = NoneThe observation exposes roles, names, enabled state and simple boxes. The boxes illustrate viewport units. The mock takes only element actions and does not perform coordinate clicks, OCR or real hit tests. A frozen observation limits accidental mutation in this exercise. A remote policy would receive serialized data and a server would validate the parsed response at the boundary.
PythonIn [8]Expand
@dataclass(frozen=True)
class Element:
id: int
role: str
name: str
bbox: tuple[int, int, int, int]
enabled: bool = True
@dataclass(frozen=True)
class Observation:
epoch: int
page: str
elements: tuple[Element, ...]
text: str = ""
viewport: tuple[int, int] = (800, 600)
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!