Cross-Device AI Agent Architecture: From Remote Control to Local Execution

    This article breaks down the architecture of cross-device AI agents that let a mobile device remotely direct a desktop agent to operate a computer. It covers the five-layer reference design, task lifecycle modeling as a recoverable state machine, a least-privilege permission model with explicit consent, reliability techniques for improving low GUI automation success rates, and the trade-offs between local and cloud execution. Developers will find a practical implementation checklist, observability guidance, and the safety guardrails required when an agent can operate a real machine.

    1. The Problem: What a Cross-Device Agent Actually Solves

    AI agents are shifting from interactive question answering to autonomously completing tasks. In earlier designs, the user acted as a supervisor: confirming every step and manually carrying each intermediate result forward. The core goal of a cross-device agent is to replace this “human watching the machine” pattern with “human issues instructions, machine closes the loop.”

    A typical cross-device agent scenario can be abstracted into three parts:

    • Remote controller (mobile): initiates tasks, adjusts direction, and checks progress. It does no heavy computation.
    • Executor (desktop): has access to the local file system and graphical interface. This is the actual sandbox.
    • Task bus (messaging and state channel): delivers instructions, returns status, and resumes after disconnects.

    The scenario described in the source article — scanning a QR code on a phone to pair, then remotely commanding a desktop agent to operate the computer — is essentially engineering this three-part model. The leap it delivers is not just a new entry point. It redraws where execution happens and where the trust boundary sits.

    2. Reference Architecture: Layers and Responsibility Boundaries

    A robust cross-device agent system is best decomposed into five layers:

    1. Access layer: a mobile app or lightweight web page that keeps only three capabilities — task creation, parameter tuning, and progress viewing.
    2. Session and orchestration layer: maintains long conversation context and task decomposition results, converting natural-language goals into an executable step graph (DAG).
    3. Execution layer: the local runner on the desktop, with controlled access to files, clipboard, windows, and the graphical interface.
    4. Permission and security layer: requires explicit authorization for sensitive actions such as accessing a new application or directory. Default deny, allow on demand.
    5. Observability layer: logs, metrics, and traces to support failure diagnosis and success-rate measurement.

    The most important design principle here is that the execution layer must stay local. Three reasons:

    • Latency: GUI operations are high-frequency with short feedback loops. Round-tripping to the cloud significantly amplifies operation delay.
    • Privacy: local files and screen content are highly sensitive. Keeping them on-device greatly reduces compliance pressure.
    • Availability: network jitter should not roll back a task that is already 90% complete.

    3. Task Lifecycle: From Natural Language to a Recoverable State Machine

    The reliability of a cross-device agent depends almost entirely on how rigorously tasks are modeled. Model tasks as an explicit state machine rather than “one big loop”:

    1. CREATED -> PLANNED -> RUNNING -> (WAITING_FOR_CONSENT)
    2. -> SUCCEEDED | FAILED | CANCELED
    3. any state --network drop--> PAUSED --reconnect--> RUNNING

    Key engineering points:

    • Idempotency: every step carries a unique step_id so replays do not duplicate side effects (such as sending the same email twice).
    • Checkpoints: persist state once each sub-goal completes, then resume from the latest checkpoint after a disconnect.
    • Compensation: for irreversible actions (sending, submitting), add a second confirmation or a delayed queue.
    • Timeout and retry: distinguish retryable errors (element did not appear) from non-retryable ones (permission denied).

    Illustrative pseudocode:

    1. def run_task(task):
    2. plan = planner(task.goal) # generate the step DAG
    3. for step in plan:
    4. if step.needs_consent:
    5. wait_for_user_approval(step) # block until the mobile side confirms
    6. result = executor.run(step, timeout=step.timeout)
    7. if not result.ok and result.retryable:
    8. result = retry_with_backoff(step)
    9. checkpoint(step.id, result) # persist the checkpoint
    10. return summarize(plan)

    4. Permission Model: Least Privilege and Ask Before Acting

    The source article notes that the agent asks for user permission before accessing a new application. In engineering terms, this maps to a capability list plus explicit authorization model:

    • Capability declaration: on startup, the executor declares the resource domains it can access (directory allowlist, application allowlist).
    • Per-access authorization: the first time a new resource domain is touched, the task is suspended and an authorization request is pushed to the remote controller.
    • Authorization granularity: distinguish “this time only,” “within this task,” and “long-term trust,” defaulting to the shortest validity.
    • Audit trail: write every authorization and access to a tamper-resistant log for traceability.

    One point deserves emphasis: authorization should not be a simple yes/no popup. It should carry context — what is being accessed, why, and the scope of impact. Otherwise users fall into authorization fatigue and click approve reflexively, which renders the security mechanism useless.

    5. Reliability: Treating a ~50% Success Rate as the Starting Point

    Early cross-device agents achieve a combined success rate of only about half in real desktop environments. This is not unusual. GUIs are designed for human vision: unstable control naming, layouts that shift with window changes, and the lack of unified semantics for cross-application drag-and-drop all make automation fragile.

    General techniques for raising the success rate:

    • Dual-channel targeting: prefer accessibility interfaces or the control tree, falling back to visual recognition when that fails.
    • Semantic caching: cache and version the targeting strategy for a given type of button on a given type of page.
    • Precondition checks: assert preconditions before acting (is the window in the foreground, does the file exist).
    • Fail fast: abort and report after N consecutive steps with no progress, avoiding idle spinning.
    • Human takeover: turn the failure point into an interactive resume rather than restarting the whole task.

    For metrics, collect at least: task success rate, step success rate, average number of steps, human takeover rate, authorization denial rate, and average execution time. Without these, “success rate” is only a subjective impression.

    6. Local vs. Cloud Execution: How to Choose

    The industry keeps oscillating on one architectural question: move tasks from local to cloud, or pull them back from cloud to local. Neither is inherently better; the constraints differ.

    Dimension Local execution Cloud execution
    Data privacy Data never leaves the device, low compliance pressure Context must be uploaded, costly to redact
    Latency Fast feedback for GUI operations Round trips add lag to interaction
    Environment fidelity Faces the real desktop directly Requires a virtual desktop with limited fidelity
    Ops and scale Depends on user devices being online Central scheduling, elastic scaling
    Reproducibility Large environment variance Uniform environments, easy to reproduce

    The practical recommendation is a hybrid: orchestration and inference in the cloud, sensitive execution local. Batch workloads that can be virtualized go to the cloud; tasks that depend heavily on local files and the GUI stay on the device. When a product line stops accepting new users and its capabilities are folded into a unified cloud entry point, it usually means the team chose operability first — a common trade-off at the scaling stage.

    7. Observability and Safety Guardrails

    Once a cross-device agent can operate a real computer, safety guardrails are not optional:

    • Dangerous action list: deletion, bulk overwrite, outbound sending, install and uninstall all require a second confirmation.
    • Rate limiting: cap write operations per unit time to prevent runaway propagation.
    • Sandboxed directories: mount only the working directory by default, avoiding full-disk write access.
    • End-to-end encryption: the channel between remote controller and executor must be encrypted with mutual device authentication.
    • Reversibility by design: prefer implementation paths that can be rolled back.

    On the observability side, treat the “task” as a first-class citizen in your tracing system: one task maps to one trace, steps are spans, and authorization waits are distinct events. When reviewing why something failed, you can go straight to the specific step and a snapshot of the interface state at that moment.

    8. Implementation Checklist for Developers

    To build the same capability in your own system, proceed in this order:

    1. Build the executor sandbox first: directory allowlist, capability declaration, audit log.
    2. Then build the task state machine: checkpoints, idempotency, compensation, timeout policy.
    3. Connect the remote controller: initiation, tuning, and viewing only, keeping it lightweight.
    4. Establish the authorization flow: contextual authorization requests with tiered trust.
    5. Fill in observability: task-level traces, a success-rate dashboard, failure snapshots.
    6. Finally, do the hybrid deployment: virtualizable workloads to the cloud, sensitive workloads on-device.

    9. Conclusion

    The value of a cross-device agent lies not in the surface fact that a phone can command a computer, but in making the execution location, trust boundary, and task state explicit. Whoever does the state machine, permissions, and observability solidly can push the early ~50% success rate toward production readiness. Baidu AI Cloud’s accumulated capabilities in container platforms, log services, and monitoring and alerting provide standard building blocks for this kind of “cloud orchestration plus on-device execution” hybrid architecture. The real differentiation still comes from patiently refining your task modeling and security boundaries.