> ## Documentation Index
> Fetch the complete documentation index at: https://e2e.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# How agent steps work

> What the model sees, what it may do, how a step ends, and what it costs.

An agent step is one `agent.act`, `agent.assert`, `agent.waitFor`, or
`agent.extract` call. The model reads the screen, asks for actions, and ends
the step with a verdict. Every step has a deadline and a model-call budget.

## Who does what

The executor chooses the actions and returns the verdict. The runner
redacts the screen, authorizes and performs each action, enforces budgets,
fills secrets, and writes the report. The built-in agent is the executor
unless the agents entry sets a [custom one](https://e2e.com/docs/executors).

## What the model sees

For `act`, the first prompt holds the instruction, the params, the completed
steps, and a redacted text snapshot of the screen: roles, names, text, and
states. It holds no raw HTML, cookies, headers, or environment values.
Password fields are masked, unless a page script hides one from e2e
([where redaction stops](https://e2e.com/docs/reference/security#where-redaction-stops)).
A configured secret value on screen becomes `<secret:name>`.

After an action, the model gets the changes to the screen, or a new full
snapshot when most of it changed. Node ids stay the same while their
elements exist. A failed action also returns the current screen, so the
model can choose its next action.

Default judgments from `assert`, `waitFor`, and `extract` see the instruction,
the current screen and its location, and the agent's `context`, never completed steps or the
acting agent's summaries. They can use a separate [judge model](https://e2e.com/docs/models#a-judge-of-its-own).
Built-in exploring assertions use `agents.<name>.model`, even when `judge` is set.

`vision: true` adds a masked screenshot, and `vision: 'only'` judges the
screenshot alone. See the [agent reference](https://e2e.com/docs/reference/agent#vision) for
the modes. Screenshots mask secure fields only
([after a secret fill](https://e2e.com/docs/reference/security#screenshots-after-a-secret-fill)).

## What the model may do

The agent gets the tools the target's engine supports, such as `tap`,
`type`, `press`, `select`, `scroll`, and `navigate`. On engines with a
keyboard, it can type and press keys in the focused control. When the text
snapshot can't describe a control, pixel tools let it take a screenshot and
act at a point. See the
[tool reference](https://e2e.com/docs/reference/agent#pixel-tools-screenshot-and-the-point-verbs).

To fill a `Secret` param, the model calls `type_secret`. The model sees only
the secret's name and purpose. The runner checks the field the model
picked, then fills the value itself. The value never enters prompts,
transcripts, reports, or AI traces.

A targeted action times out after at most 15 seconds. [Project tools](https://e2e.com/docs/tools)
add your own operations, with declared budgets and platforms.

The built-in agent presses Save, Submit, or another control that commits a
change once for each commit the step asks for. It retries only when the
current screen shows that the first press did not commit, such as a
validation error, or when the tap only closed the keyboard.

The agent checks a save on the current screen unless the step asks it to leave.
A silent save can end the step as `failed`. Specify how to check it, for
example "save the product, then confirm it appears in the product list".
A click before the page is ready can also leave no trace. Wait for the page
before saving. The agent makes one press when the outcome is unclear.

The loop detects repeated calls and cycles. It warns after three failed
actions in a row and asks for a verdict after five. Consecutive calls to
`observe` or `screenshot` can wait longer, including during assertion
exploration.

| Wait | Notice | Verdict |
| --- | ---: | ---: |
| Looks without a change to the listing, location, or tabs | 6 | 10 |
| Total consecutive looks, even when the screen changes | 12 | 20 |

Changes to the listing, location, or tabs reset the first count. Pixel
changes alone, such as a spinner, leave the count in place. The loop also
asks for a verdict when the budget or deadline is near.

## Assertion exploration

With `explore: true`, `agent.assert` can scroll and combine evidence from several
viewports using read-only tools. The viewport remains where exploration ends.
Use it for content elsewhere on the current screen, and `waitFor` for changes over time. See
[assertion exploration](https://e2e.com/docs/reference/agent#agent-assert) for tools, budgets, and verdicts.

## How a step ends

A step ends with one of three verdicts:

- `passed`: the screen shows that the step succeeded.
- `failed`: the required condition is false or can't be shown. Too little
  evidence is `ASSERTION_INCONCLUSIVE`.
- `blocked`: a prerequisite, the environment, or a limit stopped the step
  before a product verdict. The error code sets the exit code.

Only `failed` and `blocked` carry an error code.

| Blocked by | Codes | Exit |
| --- | --- | ---: |
| A credential the app rejected, or one that is not configured | `AUTH_CREDENTIAL_INVALID`, `AUTH_CREDENTIAL_UNAVAILABLE` | 2 |
| An environment that is down | `ENVIRONMENT_UNAVAILABLE` | 3 |
| Seed data or a prerequisite outside the product that is not there | `SEED_DATA_MISSING`, `TEST_SETUP_FAILED` | 2 |
| A budget or the clock | `STEP_BUDGET_EXHAUSTED`, `STEP_TIMEOUT` | 1 |
| An interaction the toolset cannot perform | `AUTOMATION_UNSUPPORTED` | 1 |

The [errors reference](https://e2e.com/docs/reference/errors#agenterror) lists every code a
verdict can carry.

When a step only asks for actions, the agent may send its verdict in the
same turn as the last action, and the step returns without another model
call. The runner takes that verdict after those actions run, and refuses it
when one failed or the last one changed nothing.

## What a step costs

Each call has a model-call budget and a default timeout. See
[budgets](https://e2e.com/docs/reference/agent#budgets).

- `assert` without exploration and `extract` make one judgment, plus one repair call if the
  answer is malformed. When the data is not on screen, `extract` fails with
  `ASSERTION_INCONCLUSIVE` and returns no placeholder.
- `waitFor` makes no model call while the screen and its location stay the same.
- A screenshot adds input tokens to every call that carries it. `act` asks
  for one only when the text snapshot is not enough.
- The [replay cache](https://e2e.com/docs/cache) reruns passing `act` steps with no model calls.
- Under a [custom executor](https://e2e.com/docs/executors#what-the-executor-handles), `assert`
  uses the `act` budgets.

Use `expect` for exact checks, and give each `act` one
[atomic goal](https://e2e.com/docs/core-concepts#goals). When the provider caches prompts,
`--debug` shows the cached share of input tokens per step.

## Next

<CardGroup cols={2}>
  <Card title="Project tools" icon="wrench" href="/tools">
    Add your own tools to the agent.
  </Card>
  <Card title="Custom executors" icon="gears" href="/executors">
    Keep the loop with your prompt, or replace it.
  </Card>
</CardGroup>
