A project tool is an AI SDK tool that the agent can call during a goal, such as a request to your test API or a data setup step.
Add a tool
Wrap the tool with defineTool and put it in the agent’s tools:
The agent can now seed a cart before it checks out:
The config load fails with INVALID_CONFIG for a tool named like a
grammar verb (tap, screenshot) or a tool the harness adds:
complete_step, locate, test_lines, start_recording,
stop_recording, or report_finding. It also fails for a value
defineTool didn’t build, and for tools on an entry with a custom
executor.
Declare what a tool does
defineTool takes the AI SDK tool and these annotations:
Observe from a tool
A read-only tool can observe the redacted screen through getToolContext.
This example saves a masked screenshot as report evidence when pixels are
available:
observe()returns a redacted text snapshot.tree: trueadds the node tree andpixels: truea masked screenshot, under the built-in agent’s rules, so no pixels after a secret fill.- In a
mutates: truetool,observe()fails withPOLICY_DENIED. Observe in a separate read-only tool. attachScreenshot(pixels, label)adds the image to the step’s artifacts and returns its artifact id. A reused label overwrites the earlier image.
Device toolkits
@e2e-dev/mobile has a ready tool pack, mobileTools, with open_app,
swipe, and alert. Spread it to add your own tools beside it:
See Agent tools for the setup.