AI SDK
Use agent-device/ai-sdk to give an AI SDK agent a typed set of tools for navigating and inspecting an app. The tools run in-process, share one named session, and default to the focused perceive-and-act surface most agents need.
Make an iOS simulator or device available to agent-device, then configure an AI SDK model. String model IDs use AI Gateway by default:
Alternatively, pass a model from your configured AI SDK provider. See the AI SDK guide to choosing a provider.
Set AI_MODEL to a model available through your configured AI SDK provider. The agent sees the available device tools and chooses the calls needed to complete the prompt. The returned client targets the same session; keep cleanup in finally so the device is released even if generation fails.
Options
set: 'core' is the default. It exposes the perceive-and-act loop: open, close, snapshot, click, press, fill, type, get, is, find, wait, back, scroll, swipe, alert, and screenshot.
- Pass
set: 'all'when the agent also needs device-management or observability commands. - Pass
approval: { close: 'user-approval' }to require approval for a command.createAgentDeviceTools()returns the map astoolApproval, ready to pass toToolLoopAgent.
See the Node.js API when the host application needs deterministic setup or other direct device control outside the agent loop. See the AI SDK reference for ToolLoopAgent.
