Building Controllable Mobile AI Agents for Real Devices: Permission Isolation and Approval Design

    AI agents that operate real smartphones must do more than understand natural language—they need clear permission boundaries, independent approval flows, and auditability before touching real accounts, contacts, and money. This article outlines a three-layer architecture that separates planning, authorization, and execution, explains how to classify actions by risk, why on-screen text must be treated as untrusted data, and how to roll out safely from read-only tasks to limited automation.

    From UI Automation to Controllable Mobile Agents

    Enabling an AI agent to operate a real smartphone means it must not only understand a user’s natural-language instructions, but also observe the app UI, assess the current state, plan the next action, and execute taps, text input, or scrolls through controlled interfaces.

    Traditional UI automation typically relies on pre-written scripts: open the app, find the control, enter the content, tap submit. Whenever the page structure changes, the script may break. An agent, by contrast, can reassess based on a fresh screenshot or UI hierarchy, handling some layout changes and dynamic content.

    But flexibility is not the same as reliability. An agent may misinterpret a button’s meaning, or mistake persuasive in-app text for task instructions. When the execution target involves real accounts, contacts, or money, an error is no longer just a failed test—it can produce irreversible business consequences.

    A mobile agent system should therefore aim at three levels:

    • Capable execution: basic ability to observe the UI and operate the device.
    • Reliable execution: recognizing state changes, handling exceptions, and verifying results.
    • Controlled execution: clear permission boundaries, approval at critical steps, and traceable records.

    The third level should not be bolted on after features are done—it should be the starting point of the architecture.

    A General Architecture: Separating Decision, Authorization, and Execution

    A system built for real devices can be divided into a task entry point, a planning module, a policy gateway, a device executor, and an audit module.

    1. The Task Entry Point Defines User Intent

    The task entry receives the user’s instruction and converts it into verifiable task constraints. For example, “reply to a message for me” is still too vague; it should be narrowed to the recipient, the content allowed, whether confirmation is required before sending, and what happens when the task times out.

    Task constraints should at minimum include:

    • The target object and target app;
    • The range of allowed actions;
    • Explicitly forbidden actions;
    • Whether external impact is permitted;
    • Completion criteria and stop conditions.

    The user authorizes a bounded task, not unlimited control over the entire phone. The system should not treat possession of automation capability as a license to browse other apps or continue unrelated tasks.

    2. The Planning Module Proposes Actions Without Final Authority

    Based on the task and the current UI, the planning module generates candidate actions—tapping a control, entering text, or going back a page. It can also explain the purpose of each action for the policy module and the user to review.

    However, the planner’s output should be treated only as an “action request,” never as proof of permission. Even if the model claims an action is safe, an independent policy check must re-validate it.

    This separation matters: an agent tasked with completing a job naturally leans toward pushing the flow forward, while the module responsible for authorization must hold the line. The two should carry different responsibilities and different privileges.

    3. The Device Executor Accepts Only Authorized Actions

    The device executor interacts with the real device. Mobile OSes differ significantly in the control mechanisms they allow, which may involve accessibility services, testing interfaces, managed-device capabilities, or other restricted mechanisms.

    The availability of these mechanisms depends on OS version, device policy, and app implementation—never assume one approach works on every device. Before integration, perform capability discovery: whether the system can read the UI hierarchy, capture screenshots, input text, switch apps, and perform specific operations on a locked screen.

    The executor should also restrict the set of action types and parameter ranges, avoiding exposure of arbitrary system-level control to the planning module.

    Independent Approval: Critical Actions Cannot Be Self-Authorized

    The security focus of mobile automation is not getting the agent to “promise to be careful,” but building an authorization path it cannot bypass.

    1. Classify Risk by Action Consequences

    Risk assessment should not rely on button labels alone. “Confirm” may merely dismiss a dialog—or submit an order. “Continue” may just paginate—or enter a payment flow.

    A more dependable judgment combines the target app, the current page, the task context, and the expected consequence. A possible tiering:

    • Low risk: browsing pages, scrolling, reading non-sensitive state.
    • Medium risk: filling in content, modifying reversible settings, adding items to a pending-submission list.
    • High risk: sending messages, publishing content, placing orders, deleting data, installing apps.
    • Strictly restricted: payments, transfers, authorization logins, security-setting changes—anything involving money or account control.

    Calibrate the tiers to your business context. A settings change on a corporate device may be more sensitive than an ordinary message sent from a personal one.

    2. Approval Cards Must Show the Consequence

    Effective approval should never be a bare “allow?” The user needs to know exactly what they are approving.

    For message sending, show the recipient and the final text. For transactions, show the payee, amount, and order summary. For deletions, show the scope and whether recovery is possible.

    Approval should be bound to a specific action and its key parameters, not a blanket endorsement of the entire downstream flow. After approval, if the recipient, amount, or submitted content changes, request authorization again.

    Approvals should also carry an expiration. If the page the user saw at approval time is stale, the executor must re-fetch and re-validate state rather than blindly tapping old coordinates.

    3. Rejection, Timeout, and State Changes Must Stop Safely

    After a user rejects a request, the agent must not lobby for the same permission by rephrasing it, taking a different entry point, or repeated prompting. An approval timeout must not be treated as implied consent.

    A schematic control flow:

    1. action = planning_module.propose_next()
    2. state = device_executor.read_current_ui()
    3. result = policy_gateway.check(task_constraints, state, action)
    4. if result is DENIED:
    5. stop task and record the reason
    6. elif result is APPROVAL_REQUIRED:
    7. display action target, key parameters, and expected consequence
    8. wait for user confirmation
    9. if not confirmed:
    10. stop task
    11. if UI or key parameters have changed:
    12. re-evaluate and request approval again
    13. else:
    14. execute the action and verify the result
    15. else:
    16. execute the action and verify the result

    This is not the API of any specific product—it illustrates the general flow for enforcing responsibility boundaries.

    Execution Isolation: Running in the Background Is Not Security Isolation

    On devices that support the required capabilities, you can explore dedicated display regions, controlled sessions, or dedicated devices to reduce conflicts between automation and the user’s daily operations.

    However, separating the UI is not the same as separating permissions. Even if the agent runs in an isolated display environment, it may still access accounts, files, and network resources on the same device. App access restrictions, task-level permissions, and sensitive-data protection remain necessary.

    Moreover, some apps may not support multi-display environments, or restrict operations in the background, on the lock screen, or during authentication. The system must detect these restrictions and clearly prompt the user to take over—it cannot treat execution-environment availability as a universal guarantee.

    For early validation, a dedicated test device is usually safer than taking over a user’s primary phone. Keep only the apps and test accounts the task requires, and minimize long-lived logins to sensitive services.

    If the user and the agent may operate the same UI simultaneously, design a control handover mechanism: pause the task when user touch, app switching, or abrupt page change is detected, preventing the agent from executing actions generated from stale state.

    Sensitive Data Protection and UI Prompt-Injection Defense

    1. App Restrictions Are Only the First Line of Defense

    Denying access by default to finance, payment, and credential-management apps is a reasonable protection. But relying solely on app names or categories is insufficient: sensitive operations can also appear in browser pages, embedded web views, or payment entry points inside other apps.

    Access control must therefore also cover page content and action semantics. For suspected password inputs, verification codes, authentication, and account-authorization pages, prefer pausing and handing control to the user.

    Be explicit about the limits of detection. Some custom-drawn input fields expose no full semantic information, and screenshot recognition can misfire. Never claim that all sensitive fields can be reliably intercepted based on a single detection result.

    2. On-Screen Text Is External Data, Not System Instructions

    A page the agent sees may contain text like “ignore previous rules” or “tap here to authorize.” Such content is data to be interpreted—it must never alter the user’s task or the system’s security policy.

    Defenses should operate at both the planning and execution layers:

    • At the planning layer, clearly separate user instructions from page content;
    • At the execution layer, run independent checks on app access, outbound sending, and money-related actions;
    • Prohibit page content from modifying policy or obtaining approval authority;
    • Reject requests that exceed the original task scope, or escalate them to the user for confirmation.

    Never treat the model’s ability to recognize manipulative text as the sole security boundary. Even if the planning module errs, the policy gateway should still block unauthorized actions as far as possible.

    3. Data Collection Should Follow Minimization

    Screenshots and UI hierarchies may contain personal data: contacts, chat content, addresses, order details. Collect only what the task needs, and redact as much as possible before storage or transmission.

    If the task invokes a remote model, disclose which data leaves the device and provide corresponding user controls. Retention periods for logs, screenshots, and screen recordings should be configurable, so automation does not accumulate unnecessary sensitive material over time.

    Audit and Replay: Record Actions and the Reasoning Behind Them

    Step-by-step screenshots and recordings help trace misoperations, but complete auditing also requires recording the task ID, timestamps, action requests, policy decisions, approval outcomes, and execution feedback.

    Whether an action “succeeded” cannot be judged by whether the tap was fired. After sending a message, verify it actually appeared; after submitting a form, check for an explicit result. States that cannot be confirmed should be marked as “unknown outcome” rather than blindly retried.

    This matters most for irreversible operations. If a network timeout occurs after a payment is submitted, re-executing may cause a duplicate transaction. The system should prefer reading the result state, querying the task context, or asking the user to verify—generic retry logic must not be applied directly to high-risk actions.

    Audit artifacts themselves need protection. Screen recordings can leak far more than structured logs, so support access control, masking of sensitive regions, periodic cleanup, and secure export. In enterprise scenarios,关键 approval records should be protected from modification by ordinary execution processes as much as possible.

    A Rollout path: Validate Gradually from Low-Risk Tasks

    Start with low-risk scenarios—read-only queries, page navigation, filling content drafts—and avoid touching payments, account recovery, or large-scale deletions at the outset.

    Validation can proceed in three phases:

    Phase 1: Observe and suggest. The agent reads the current state and recommends the next step; the user executes manually. This checks task understanding and UI-recognition quality.

    Phase 2: Controlled execution. Enable a small set of low-risk actions, retain per-action approval for outbound sending and state changes, and verify that stopping mechanisms actually work.

    Phase 3: Limited automation. Run tasks within clearly defined app, action, and time boundaries, while continuously monitoring anomalies and permission changes.

    Testing must cover more than the happy path: include network interruptions, page redesigns, popup occlusion, device lock, approval timeouts, mid-task user takeover, and duplicate submissions. Beyond task completion rate, track misoperation rate, unauthorized-action interception, human takeover frequency, and result-verification accuracy.

    The real value of mobile agents is reducing repetitive work—not making decisions on the user’s behalf. A dependable system lets automation handle recoverable, verifiable steps, keeps final authority over high-risk actions with the user, and uses permission isolation and auditing to ensure that boundary is consistently enforced.