System-Level AI Assistants for Unattended Tasks: Architecture, Security, and Reliability
This article examines the technical path for system-level AI assistants that can orchestrate multi-step tasks on mobile devices without requiring the user to stay involved. It covers a five-layer on-device agent architecture, structured intent understanding and task decomposition, strict permission and security boundaries, and reliability mechanisms such as idempotent execution, checkpoint recovery, classified retries, human handoff, and rollback. It also provides pseudocode for checkpointed task execution, proposes evaluation metrics, and offers practical guidance for starting with low-risk, high-frequency tasks before expanding to complex cross-app workflows.
1. Problem Background
Mobile devices have long existed as collections of apps. To complete a task such as “turn this week’s meeting notes into a table and send it to the team,” a user typically has to switch between multiple apps, copy content, and click through each step. Every step requires the user to be present. The idea behind a system-level AI assistant is to let the system itself orchestrate these multi-step tasks so they can be completed without the user watching over them—commonly referred to as unattended operation.
The difficulty in this direction centers on three questions: whether tasks can be decomposed reliably, whether capability invocation can always stay within the permitted scope, and whether errors can be recovered from without data loss. The following sections address these three questions.
2. Layered Architecture for an On-Device Agent
A practical on-device agent is typically divided into five layers:
- Perception layer: collects input signals, including voice, text, UI state, notification events, calendar data, and other system data.
- Understanding layer: converts natural language or events into structured intents, outputting intent type, parameters, and confidence.
- Planning layer: splits an intent into ordered steps and annotates each step with dependencies and preconditions.
- Execution layer: invokes apps or system services through controlled capability interfaces, such as reading and writing files, sending messages, and querying calendars.
- Security and audit layer: spans the layers above and handles permission checks, interception of sensitive operations, and execution logging.
The benefit of layering is that each layer can be tested and replaced independently. The understanding layer can use models, the planning layer can use a combination of rules and models, and the execution layer must remain deterministic. Model output cannot be fully trusted, so the security layer must be a code path independent of the model and must not rely on the model to follow constraints voluntarily.
3. Intent Understanding and Task Decomposition
The output of intent understanding should be a structured object, not free text. A practical structure usually contains four items: intent name, parameter table, list of missing parameters, and risk level.
For example, when a user says, “Turn last Wednesday’s meeting notes into a table and send it to the product group,” an ideal output would look like this:
- Intent: generate a document summary and share it
- Parameters: source time is last Wednesday; source type is meeting notes; output format is a table; recipient is the product group
- Missing parameters: none
- Risk level: medium (involves external sending)
Task decomposition requires attention to three points. First, each step must have clear inputs and outputs so the next step can validate them. Second, irreversible actions such as sending, deleting, and paying must have confirmation checkpoints. Third, the decomposition result must allow local replanning. For example, if last Wednesday’s meeting notes cannot be found, the system should fall back to asking the user rather than guessing a file and executing against it.
4. Permission Model and Security Boundaries
Unattended operation means the system makes decisions on the user’s behalf, so permission design must be stricter than in interactive scenarios. The following principles are recommended.
Least privilege: each task receives only the permissions required to complete the current step, and those permissions are revoked immediately after the task ends.
Explicit authorization: sensitive resources such as contacts, payments, photos, and location must receive explicit user authorization on first use, and users must be able to revoke it at any time.
Action allowlist: the list of capabilities the agent can invoke is fixed by the system, and the model cannot generate new invocation interfaces from scratch.
Data and instruction isolation: text from web pages, notification text, and third-party files is always treated as data, not as instructions. External content may contain persuasive statements that attempt to change the agent’s behavior; this type of attack is commonly called prompt injection. The defense is to distinguish “user instructions” from “external data” at the code level rather than relying on the model to recognize the difference.
Risk tiers can serve as the basis for authorization policy:
| Risk level | Typical actions | Handling policy |
|---|---|---|
| Low | Read calendar, query weather | Execute automatically, log the action |
| Medium | Modify calendar, create files | Provide a summary before execution; do not execute if the user does not respond |
| High | Send externally, pay, delete | Require explicit user confirmation |
5. Reliability Design for Unattended Operation
When users cannot intervene immediately, the quality of exception handling sets the upper bound on the overall experience. The following five mechanisms are common foundational designs.
- Idempotent execution: each action carries a unique identifier, and repeated triggers take effect only once. Before sending a message, check whether the execution record already contains a successful record with the same identifier to avoid duplicate sends.
- Checkpoint recovery: persist state after each step is completed. After a system restart or network interruption, resume from the most recent checkpoint rather than starting over.
- Classified retries: transient errors (network jitter, service busy) use exponential backoff retries with a maximum count; semantic errors (resource not found, permission denied) terminate the task immediately and notify the user, since retrying is meaningless.
- Human takeover: when a branch cannot be determined automatically, pause the task and generate a to-do notification with completed steps and pending questions so the user can take over quickly.
- Rollback and dry run: for reversible operations such as modifying files, keep a snapshot from before the modification and restore it on failure. For irreversible operations, generate a preview result first and execute only after confirmation.
6. Illustrative Code: Checkpointed Task Execution Logic
The pseudocode below shows the core structure of task execution. It does not depend on any specific platform and is intended only to illustrate the flow.
class TaskRunner:def run(self, task):# Restore from checkpoint; if no record exists, start from the first stepstate = self.store.load(task.id) or task.initial_state()for step in task.steps[state.index:]:# Request user confirmation first for high-risk stepsif self.policy.requires_confirmation(step):self.notifier.ask_user(task.id, step.summary())return TaskStatus.PAUSED# The idempotency key consists of task ID and step ID and remains unchanged on retrykey = f"{task.id}:{step.id}"result = self.executor.execute_with_retry(step, idempotency_key=key)# Semantic errors terminate immediately without meaningless retriesif result.failed and result.error.is_semantic():self.notifier.report(task.id, result.error)return TaskStatus.FAILED# Save a checkpoint after each step is completedstate.index += 1self.store.save(task.id, state)return TaskStatus.DONE
This structure has three key points. First, the confirmation checkpoint occurs before execution, avoiding a situation where an action has already taken effect before the user is notified. Second, the idempotency key remains unchanged during retries, making repeated execution produce consistent results. Third, the checkpoint is written after each step, so an interruption requires redoing at most one step.
7. Evaluation Metrics
Before launch, establish a set of quantifiable metrics to determine whether the system is genuinely usable.
- Task completion rate: the proportion of tasks completed end to end with results that match expectations.
- Mis-execution rate: the proportion of actions executed without user authorization or actions that do not match the intent. This is the metric that most needs to be minimized and should have its own alert threshold.
- Interruption recovery success rate: whether tasks can correctly resume and produce consistent results after simulated scenarios such as network disconnection or process restart.
- Confirmation interruption rate: the proportion of tasks that require user intervention. If this value is too high, the value of automation is limited; if it is too low, the security threshold may be too permissive.
Specific target values should be determined based on existing business baselines rather than directly copying data from others.
8. Implementation Recommendations
Start with low-risk, high-frequency single-app tasks, accumulate enough execution logs, and then expand to complex cross-app workflows. Each capability interface should have contract tests that specify input formats, output structures, and error codes so the planning layer and execution layer can evolve independently. Before launch, also construct adversarial samples specifically to verify whether the system still respects permission boundaries in prompt injection scenarios. Finally, audit logs should be presented in a form users can view, allowing them to trace when the agent acted, based on what instruction, and what operations it performed.
