Skip to main content
This guide walks you through the complete agent-native workflow using System Settings as a practical example.

Prerequisites

Before starting, ensure you’ve:
  1. Installed agent-native (installation guide)
  2. Granted Accessibility permissions to your terminal
  3. 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:
This shows all running GUI applications in alphabetical order.
For structured output (useful for agents):

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:
The -i flag filters to interactive elements only (buttons, text fields, toggles, etc.).
Each element gets a reference like @n1, @n2 that you can use to interact with it.
Use -c (compact) to remove empty structural elements: agent-native snapshot "System Settings" -i -c

Step 4: Interact with elements

Now use the references from the snapshot to interact:
From the snapshot output above, we saw the search field is @n1. Fill it with text:
The 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:
References like @n5 are stored temporarily. After any significant UI change, re-run the snapshot command to get updated references for the new UI state.

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:
JSON snapshot output structure:

Advanced options

Limit snapshot depth

Control how deep the tree traversal goes:
The -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:
Useful for waiting on dialogs or async UI updates.

Using with AI agents

Install the skill

For AI coding assistants like OpenCode or Cursor:

Add to agent instructions

Add this to your AGENTS.md, CLAUDE.md, or similar:

Common patterns

The select command opens the popup and clicks the matching menu item.
Shows all attributes and available actions for an element.

Next steps

Command reference

Complete reference for all agent-native commands

Examples

Real-world automation examples and patterns
Join the community and share your automations! Star the project on GitHub.