From Voice Assistant to AI Agent: A Practical Architecture for Rebuilding Device Assistants

    Traditional voice assistants are limited by fixed intent recognition. This article explains why device assistants need an architecture shift from rules to models, and outlines a five-layer on-device AI agent design covering screen perception, cross-app retrieval, tool calling, entry points, privacy, and evaluation.

    Why Voice Assistants Need a New “Brain”

    For more than a decade, mobile voice assistants have stayed within a fixed-intent paradigm: a wake word, slot filling, and a mapping to preset system capabilities such as setting an alarm, checking the weather, or changing a song. That architecture is stable inside a closed task set, but its ceiling is low. Once a request falls outside predefined intents, the system can only say it does not understand.

    Large language models change this situation by adding three capabilities:

    1. Open-domain language understanding. They do not depend on enumerating intents and can handle vague, multi-turn natural language with context.
    2. Task planning. They can break a complex goal into executable steps and decide when to call external tools.
    3. Contextual reasoning. They can judge a request using screen content, conversation history, and device state.

    “Replacing the brain” is therefore not a simple model swap. It is an architectural rebuild from rule-driven behavior to model-driven behavior. The core challenge is connecting a general model safely and efficiently to local device capabilities and user data.

    Overall Architecture: Five Layers

    A mature on-device AI agent architecture can usually be divided into five layers:

    1. ┌──────────────────────────────────────────┐
    2. │ Interaction: voice / text / system entry │
    3. ├──────────────────────────────────────────┤
    4. │ Perception: screen understanding / state │
    5. ├──────────────────────────────────────────┤
    6. │ Context: session memory / semantic index │
    7. ├──────────────────────────────────────────┤
    8. │ Planning: model reasoning / orchestration│
    9. ├──────────────────────────────────────────┤
    10. │ Execution: system APIs / apps / search │
    11. └──────────────────────────────────────────┘
    • The interaction layer unifies multimodal input, including a long-press side-button voice entry, a continuous conversation entry in the system status area, and a right-click invocation.
    • The perception layer turns the current screen, clipboard, notifications, and other device state into structured descriptions the model can use.
    • The context layer manages short-term dialogue memory and cross-app semantic indexes, such as contacts and message summaries.
    • The planning layer is handled by the large model, which returns either a natural-language reply or a structured tool-call request.
    • The execution layer maps tool calls to system interfaces and sends results back to the model for the next reasoning turn.

    Screen Perception and Cross-App Retrieval

    Being able to “see” is the first feature that separates an agent from a traditional assistant. Implementations generally follow two paths:

    1. System accessibility tree. The system exposes the current interface’s control hierarchy and text, which is summarized and injected into the model context. This is real-time and accurate, but it requires strict permission control.
    2. On-device semantic index. Messages, documents, photos, and other device data are indexed locally as vectors. At query time, retrieval-augmented generation (RAG) supplies relevant passages to the model.

    Cross-app retrieval needs a unified retrieval interface that abstracts data from different apps into a standard retrieval protocol:

    1. {
    2. "tool": "search_device_content",
    3. "parameters": {
    4. "query": "meeting time discussed with Li Ming last month",
    5. "scope": ["messages", "calendar", "notes"],
    6. "time_range": "last_30_days"
    7. }
    8. }

    The system returns structured, redacted results, and the model decides the next action, such as creating a calendar event or sending a confirmation. A key design point is that retrieval results are not shown as raw data. They pass permission checks and field filtering so that user authorization stays minimal.

    Multi-Step Execution and Tool Calling

    Function calling is the basis of what an agent can “do.” Engineering practice should use a unified tool registration protocol:

    1. @tool(
    2. name="create_calendar_event",
    3. description="Create a calendar reminder for the user",
    4. parameters={
    5. "title": "Meeting subject",
    6. "time": "ISO 8601 time",
    7. "attendees": "Attendee list; may be empty"
    8. },
    9. risk_level="low"
    10. )
    11. def create_calendar_event(title, time, attendees=None):
    12. # Call the system calendar interface and return the creation result
    13. ...

    On each reasoning turn, the planning layer outputs a decision such as:

    1. {
    2. "thought": "The user wants to attend this concert. Check ticket channels first, then set a reminder.",
    3. "actions": [
    4. {"tool": "web_search", "args": {"query": "concert ticket channels"}},
    5. {"tool": "create_calendar_event", "args": {"title": "Concert", "time": "..."}}
    6. ]
    7. }

    Multi-step execution needs to handle three boundary cases:

    • Failure recovery. If a tool call fails, keep the context and retry or fall back to asking the user. Do not clear the session.
    • Risk levels. High-sensitivity actions such as payments, sending messages, and deleting data require a second confirmation.
    • Timeouts and interruption. Long-running tasks should support resuming from a checkpoint, with intermediate state persisted locally.

    Rebuilding the Entry Points

    Entry design determines how often the agent is used. Common industry practice includes:

    1. System-level shortcuts. A long-press side button or a persistent entry in the pull-down control center lowers the cost of invocation.
    2. Continuous conversation. After the entry expands, follow-up questions are supported and the model keeps the full dialogue state, so the user does not restate the request.
    3. Context-aware invocation. The assistant can be opened directly on an image, file, or selected text, with that content injected as the default context.
    4. Spatial interaction. On new form factors such as headsets, gaze, gestures, and voice can be combined for accessible operation.

    Privacy and Security in Device–Cloud Collaboration

    Once an external large model is introduced, privacy becomes the main trust issue. A practical approach is “local first, with device–cloud collaboration”:

    • Local processing. Sensitive work such as screen summaries and message retrieval should stay on device when possible, or be redacted locally before upload.
    • Selective upload. Send only the minimum information required to complete the task to the cloud model.
    • Revocable authorization. Each category of data access needs its own authorization, which the user can review and withdraw at any time.
    • Audit logs. All tool calls should be traceable, and high-risk actions should leave a clear evidence trail.

    In implementation, data can be classified by sensitivity—public, internal, or confidential—with a different processing pipeline for each level. Confidential data, for example, may participate only in local model inference and must not leave the device.

    Rollout Guidance and Evaluation

    1. Start with high-frequency scenarios. Cover calendar tasks, message retrieval, and cross-app information summaries first, where users feel the value immediately, then gradually open longer-tail tasks.
    2. Build an evaluation baseline. Continuously regress on five metrics: intent-understanding accuracy, task completion rate, average number of turns, average latency, and error rate.
    3. Staged rollout and rollback. Release new capabilities to user cohorts, and keep a traditional rule-based fallback so the system can revert quickly if the model is unavailable.
    4. Use cloud services where they fit. For enterprise deployment, general-purpose capabilities from platforms such as Baidu AI Cloud—object storage, logging, and monitoring and alerting—can support the data pipeline and observability needed for service stability.

    Conclusion

    Moving from a traditional voice assistant to an AI agent means, for the first time, letting an open-domain model orchestrate the capabilities already on the phone. Screen perception solves “can see,” cross-app retrieval solves “can find,” and tool calling solves “can do.” The privacy architecture decides how far that path can go. For developers, the more important choice is not which foundation model to use, but how to invest in context engineering, the tool protocol, and security boundaries. Those three areas set the experience ceiling and are the technical assets most worth retaining behind every change of “brain.”