Skip to main content
createAgent builds the built-in agent extended with your tools: AI SDK tools with declared semantics. A test API that seeds data, an internal endpoint, a device toolkit. The model can call them mid-flow, and the runner still budgets, serializes, and records every call.
e2e.config.ts
Now agent.act('seed three items and check out') can call your test API. createAgent() with no tools is exactly what runs by default; system appends guidance and model sets the model. Tool names are the model’s vocabulary, and the agent’s own names (observe, tap, type, type_secret, press, select, scroll, navigate, screenshot, tap_at, complete_step) are reserved: createAgent rejects a project tool that reuses one, since it would be shadowed on one engine and live on another.

Declare what a tool does

defineTool takes the AI SDK tool and its semantics: A failed call still consumes its reserved slot and is recorded as a failure. Parallel tool calls cannot exceed the budget by checking it at the same time.

Observe from a tool

A read-only tool can look at the screen through the same redacted view the executor uses. This tool saves the available pixels as report evidence:
observe() returns the redacted tree and, with pixels: true, the masked screenshot, under the same pixel-withholding policy as the executor. A mutating tool must request observations in a separate read-only call; its body already occupies the action queue. attachScreenshot(pixels, label) files the image as a screenshot artifact of the step. It lands in the attempt’s artifact directory, in the report’s artifact records, and in a configured artifact store, and the call resolves with the artifact’s id. Use a unique label for each capture so later images do not overwrite earlier ones.

Device toolkits

@e2edev/agent-device ships a ready tool pack for its engine:
It adds open_app, swipe, type_text, alert, and screenshot, scoped to the device platforms. See the agent-device reference.

Custom executors

When tools are not enough: your own prompt or your own loop.

How agent steps work

What the model sees and what it may do.