Prerequisites
Before starting, ensure you’ve:- Installed agent-native (installation guide)
- Granted Accessibility permissions to your terminal
- Verified installation with
agent-native --version
Your first automation
We’ll automate a search in System Settings to demonstrate the core workflow.Step 1: List running apps
First, check what apps are currently running:Expected output
Expected output
Step 2: Open System Settings
Launch System Settings if it’s not already running:The
open command is idempotent - if the app is already running, it simply brings it to the front.Step 3: Take a snapshot
Capture the interactive elements with persistent references:-i flag filters to interactive elements only (buttons, text fields, toggles, etc.).
Example snapshot output
Example snapshot output
@n1, @n2 that you can use to interact with it.Step 4: Interact with elements
Now use the references from the snapshot to interact:- Fill the search field
- Check element state
- Get element text
From the snapshot output above, we saw the search field is The
@n1. Fill it with text:fill command clears the field first, then types the new text.Step 5: Re-snapshot after UI changes
When you click a button or navigate to a new pane, the UI changes and your old references may no longer be valid. Take a new snapshot to get fresh references:Complete workflow example
Here’s a complete script that opens System Settings, searches for “Wi-Fi”, and clicks the result:Working with JSON output
For AI agents, use--json on any command to get structured output:
Advanced options
Limit snapshot depth
Control how deep the tree traversal goes:-d flag limits tree depth (default is 8).
Filter-based interaction (without snapshot)
You can interact with elements without taking a snapshot first:Filter-based interaction is less reliable than snapshot refs because it searches the tree each time. Use snapshot refs for multi-step workflows.
Wait for elements
Wait for an element to appear before proceeding:Using with AI agents
Install the skill
For AI coding assistants like OpenCode or Cursor:Add to agent instructions
Add this to yourAGENTS.md, CLAUDE.md, or similar:
Common patterns
Fill a form with multiple fields
Fill a form with multiple fields
Select from a dropdown
Select from a dropdown
select command opens the popup and clicks the matching menu item.Inspect element details
Inspect element details
Next steps
Command reference
Complete reference for all agent-native commands
Examples
Real-world automation examples and patterns