Agent Runtimes: Architecture and Practice for System-Level AI in Operating Systems

    This article examines how operating systems can evolve into agent runtimes that manage cross-application context, plan tasks, and invoke app capabilities under explicit permissions. It covers a three-layer system architecture, structured capability exposure, on-device and cloud model trade-offs, security and privacy controls, developer recommendations, enterprise adoption paths, and open questions around standardization, reliability, and user trust.

    1. Background: From In-App Intelligence to System-Level Intelligence

    In the past, most AI features were embedded inside individual applications. A user opened an app, the app called a model to complete a task, and the context available to the model was limited to that app’s data. Information could not flow naturally between applications, so users had to switch between interfaces and copy content themselves.

    The limitations of this model are clear. Cross-app tasks—for example, “adjust my schedule based on the flight information in an email and notify the people traveling with me”—require users to manually connect multiple steps. A similar shift has occurred in information retrieval: traditional entry points built around link lists and advertising are being replaced by generated answers. As the entry point changes, content distribution and the allocation of user attention change with it.

    The system-level intelligence approach moves context management and task scheduling down to the operating system layer. The system holds cross-application state, understands user intent, and then decides which capability of which application to invoke. Users shift from “opening an app proactively” to “describing a goal and letting the system decompose and execute it.”

    2. Three-Layer Architecture for a System-Level Agent

    A practical system-level agent is typically divided into three layers.

    1. Perception layer: Collects context such as currently visible screen content, calendar events, notifications, location, and device state. The core constraint at this layer is authorization. Each type of information should have an independent switch, and users should be able to view and revoke access at any time.
    2. Decision layer: Understands natural-language instructions and performs intent recognition, task planning, and step sequencing. The model can be deployed on-device or in the cloud, with the choice determined by latency, privacy, and compute requirements.
    3. Execution layer: Maps planning results to concrete application calls. The execution layer needs to know what each application can do, which parameters are required, and which permissions are needed. Standardized capability descriptions are key at this layer.

    Clear interfaces should be maintained between the three layers. The perception layer outputs structured context, the decision layer outputs a structured plan, and the execution layer returns results with status codes. This allows each layer to be replaced and tested independently.

    3. Capability Exposure: How Applications Are Invoked by the System

    For an application to be invoked by a system-level agent, it needs to declare in a structured form what it can do. A common approach is to provide a description for each atomic capability, including its name, purpose, parameter definitions, required permissions, and whether user confirmation is required. The following is an illustrative capability description. The field names are for demonstration purposes and are not a specification for any particular platform:

    1. {
    2. "capability": "order.track",
    3. "description": "Query the logistics status of the specified order",
    4. "parameters": {
    5. "orderId": { "type": "string", "required": true }
    6. },
    7. "permissions": ["read:orders"],
    8. "requiresConfirmation": false,
    9. "errorCodes": ["ORDER_NOT_FOUND", "AUTH_EXPIRED"]
    10. }

    The choice of capability granularity directly affects system usability. If capabilities are too coarse, the system cannot compose flexible task flows. If they are too fine-grained, the number of descriptions expands and matching accuracy drops. In practice, a better approach is to use “one thing a user can complete independently” as the capability unit—for example, “query an order,” “create a reminder,” or “send a message draft.”

    The scheduling logic of the execution layer can be abstracted into the following flow. The illustrative code is also intended only to explain the idea:

    1. def dispatch(intent, registry, user_ctx):
    2. capability = registry.match(intent)
    3. if capability is None:
    4. return ask_user_for_clarification(intent)
    5. if not user_ctx.has_permissions(capability.permissions):
    6. return request_consent(capability.permissions)
    7. if capability.requires_confirmation:
    8. return ask_user_confirm(capability, intent.params)
    9. result = capability.invoke(**intent.params)
    10. log_action(capability.name, intent.params, result.status)
    11. return result

    This logic reflects three principles: match before authorizing, confirm high-risk operations before execution, and leave a record for every call.

    4. On-Device Models: Advantages and Boundaries

    Running inference locally on the device offers three main benefits. First, latency is lower because network round trips are eliminated, making interaction closer to real time. Second, privacy risk is lower because sensitive data does not need to leave the device. Third, offline availability allows basic functions to keep working when the network is unstable.

    The limits of on-device models are equally clear. Device memory, compute, and power consumption all have upper bounds, so model size can only be controlled within a certain range. Common engineering techniques include quantization (reducing the numerical precision of weights), knowledge distillation (using a large model to guide the training of a smaller model), and operator-level optimization. These techniques introduce accuracy loss and require trade-offs between task quality and resource consumption.

    A reasonable architecture usually adopts on-device and cloud collaboration. Simple, high-frequency tasks involving privacy are handled by on-device models; complex reasoning or tasks that require the latest external information are handled in the cloud. The routing strategy itself also needs evaluation, because incorrect routing harms both experience and cost.

    5. Security and Privacy Design

    A system-level agent has a much broader permission scope than a single application, so security design must be stricter.

    The principle of least privilege is foundational. The system should request only the permissions needed to complete the current task, and those permissions should be time-bound. Users should be able to view and revoke granted permissions in a unified interface.

    Indirect prompt injection is a risk that requires particular attention. Web page content, document text, and notification text may all contain instructions that induce the model to perform unexpected operations. The countermeasure is to treat all external content as data rather than instructions, and to require the operation plan output by the model to pass policy validation before it enters the execution layer.

    Irreversible operations must require secondary confirmation. For operations such as payments, data deletion, and sending messages externally, even if the model judges the user’s intent to be clear, the system should display the full content before execution and wait for user confirmation.

    Audit logs are also essential. Every cross-application call should record the trigger source, parameter summary, execution result, and timestamp, so users can query it and problems can be traced later. The logs themselves need to be desensitized to avoid secondary leakage.

    6. Practical Recommendations for Developers

    First, inventory the atomic capabilities that an application can expose externally, divided by user tasks, and avoid opening all internal interfaces at once.

    Second, write clear natural-language descriptions and parameter documentation for each capability. Description quality directly affects the accuracy of intent matching.

    Third, unify error codes and return structures. The system needs to decide whether to retry, ask the user for clarification, or abandon the task based on the error type.

    Fourth, define confirmation policies for high-risk capabilities, and clearly show the operation target and scope of impact in the interface.

    Fifth, build an evaluation set. Collect real user utterances, covering common expressions, colloquial phrasing, and ambiguous cases, and continuously track matching accuracy and false trigger rates.

    Sixth, retain complete call-chain logs and regularly inspect abnormal patterns, such as a large number of repeated calls in a short period or operations that clearly do not match user intent.

    7. Enterprise Adoption Path

    When introducing this type of capability, enterprises can proceed in three stages.

    The first stage is a pilot. Select one or two high-frequency, low-risk business processes—such as ticket lookup or meeting scheduling—and validate whether capability descriptions, authorization flows, and the logging system are usable.

    The second stage is expansion. Connect more systems and applications, and introduce unified permission management and a policy engine so that security rules are configured centrally rather than scattered across individual capabilities.

    The third stage is scaled operations. Establish a capability catalog and version management mechanism, and conduct regular regression testing. Backend support usually relies on general infrastructure such as object storage, message queues, logging services, and monitoring and alerting. Capacity needs to be reserved for peak periods of agent calls, and alert thresholds need to be set.

    8. Open Questions

    System-level agents are still at an early stage, and several questions have not yet reached consensus.

    First, the degree of standardization in capability descriptions. Differences in description formats and semantics across platforms may increase development costs.

    Second, the reliability of automated scheduling. In multi-step tasks, failure at any step may affect the overall result, and the design of rollback mechanisms is not yet mature.

    Third, user trust. Users need to understand why the system made a certain decision, and explainability and controllability directly affect willingness to use it.

    For developers, a relatively safe strategy at this stage is to structure application capabilities first while keeping them decoupled from specific implementations. This way, regardless of how future standards converge, applications can adapt at lower cost.