Technical Architecture and Implementation of Cross-Platform AI Office Assistants

    This article explores the technical architecture and implementation practices for building cross-platform AI office assistants. It addresses the shift of office demands from desktop to mobile environments and proposes a five-layer architecture covering client entry, access, orchestration, model, and delivery layers. Key topics include using instant messaging as an interaction protocol, transitioning from conversational flows to task state machines, dynamic model routing based on capabilities, ensuring cross-platform state consistency, and maintaining security and observability. Finally, it provides a phased implementation roadmap for moving from a proof of concept to daily production.

    1. The Starting Point: Office Demands are Leaving the Desk

    The implicit assumption of traditional office automation is that “a person is sitting in front of a computer.” However, in real work scenarios, the time and location of demands are highly random: during commuting, in airport waiting areas, or between meetings. At these times, the user only has a smartphone in hand, resulting in high input costs, a small screen, and the inability to run a local development environment. If an effective interaction cannot be completed before the subway arrives at the station, the demand is forced to be delayed, creating a “last mile” loss.

    Therefore, a usable cross-platform office assistant must solve three engineering problems:

    • Entry Point Migration: Shift the interaction entry point from desktop applications to instant messaging and voice channels that users already use daily;
    • Execution Decoupling: Separate task submission from task execution, where the mobile end is only responsible for expressing intent and receiving results;
    • Capability Replacement: The underlying model is not a fixed asset but should be dynamically selected based on task type.

    2. Reference Architecture: Five-Layer Split

    1. [Client Entry] IM messages / Voice / Mobile / PC client
    2. ↓
    3. [Access Layer] Session gateway · Identity auth · Rate limiting · Message deduplication
    4. ↓
    5. [Orchestration Layer] Intent recognition → Task planning → Tool calling → State machine
    6. ↓
    7. [Model Layer] Multi-model routing · Capability tags · Degradation and retry
    8. ↓
    9. [Delivery Layer] Report generation · Object storage · Message push · Multi-terminal sync

    The core value of layering is that client-side changes do not affect orchestration logic, and model replacement does not affect business semantics. Each layer can evolve and be gray-released independently.

    3. Access Layer: Using IM as an Interaction Protocol, Not Just a Chat Window

    Using instant messaging tools as an entry point essentially reuses their existing identity systems, message delivery, and push capabilities, avoiding the need to build accounts and channels from scratch. Engineering-wise, four things need to be handled:

    1. Identity Mapping: Map platform-side user identifiers to unified internal identities to prevent unauthorized access to others’ data;
    2. Idempotency and Deduplication: The same message may be delivered multiple times due to retries, requiring Message ID + Session ID as the idempotency key;
    3. Long Task Receipt: Return an “accepted” acknowledgment first to prevent users from misjudging it as unresponsive;
    4. Multimodal Preprocessing: Transcribe voice to text first, retaining the original audio reference for backtracking.
    1. def on_message(msg):
    2. if seen(msg.msg_id): # Idempotency
    3. return
    4. seen.add(msg.msg_id)
    5. user = id_map.resolve(msg.sender)
    6. text = asr(msg.audio) if msg.audio else msg.text
    7. task = planner.submit(user, text, channel=msg.channel)
    8. reply(msg.chat_id, f"Task {task.id} accepted. Will push result upon completion.")

    4. Orchestration Layer: From “Conversation” to “Task State Machine”

    Office requests are often not simple Q&A but long processes involving multiple steps and external system calls. Managing them with a finite state machine rather than a pure conversation chain can significantly improve controllability:

    • RECEIVED: Accepted, waiting for parsing;
    • PLANNING: Broken down into subtasks, determining required tools;
    • EXECUTING: Calling retrieval, calculation, document generation, and other capabilities;
    • WAITING_INPUT: Insufficient information, prompting the user for follow-up (mobile ends use structured options to reduce input costs);
    • DONE / FAILED: Delivering the output or providing an understandable failure reason.

    Tool calling should be unified into declarative descriptions for easy model selection and auditing:

    1. {
    2. "name": "render_report",
    3. "description": "Render structured results into a deliverable document",
    4. "parameters": {"format": ["md", "pdf"], "template": "string"}
    5. }

    Key constraint: All external side-effect operations (sending messages, writing files, submitting approvals) must undergo permission verification and manual confirmation policies. The model is only responsible for proposing, not for holding the final execution power.

    5. Model Layer: Routing by Capability, Not Brand Binding

    The capability requirements of different tasks vary significantly: long document understanding requires a large context window, numerical and logical reasoning requires strong reasoning capabilities, and summarization and rewriting prioritize latency and cost. Abstracting the model into a pluggable backend with capability tags is a more reasonable design:

    1. routes:
    2. - match: {task: long_context, min_tokens: 100000}
    3. prefer: [model_a, model_b]
    4. - match: {task: reasoning}
    5. prefer: [model_b]
    6. - match: {task: chat}
    7. prefer: [model_c]
    8. fallback: [model_c, model_a]
    9. policy: {timeout_ms: 8000, retries: 2, cost_aware: true}

    Engineering key points:

    • Unified Abstract Interface: Shield protocol differences between different backends, so business code is unaware of specific implementations;
    • Capability Probing: Regularly calibrate the performance of each backend on target tasks using real evaluation sets, rather than relying on marketing metrics;
    • Degradation Chain: Automatically switch when the primary model times out or is rate-limited to ensure availability;
    • Cost Control: Route simple requests to smaller models, upgrading only when necessary, combined with caching and result reuse.

    On platforms such as Baidu AI Cloud, these capabilities are typically implemented using a combination of model services, container platforms, message queues, object storage, and logging and monitoring services. The specific selection should be determined based on your own load stress testing.

    6. Cross-Platform Consistency: State in the Cloud, UI on the Client

    The key to interoperability between mobile and PC is not syncing the interface, but syncing the conversation and task state:

    • The server holds the single source of truth (task state, intermediate artifacts, version numbers);
    • The client obtains incremental updates via long connections or push, carrying version numbers for conflict detection;
    • Large files do not enter the message channel; only temporary credentials for object storage are passed;
    • Mobile clients render summaries and key conclusions by default, while PC clients expand details and editable sources on demand.
    1. client → sends version v
    2. server → if v is behind, returns delta patch + artifact reference
    3. client → applies patch, idempotently re-renders UI

    7. Security, Compliance, and Observability

    • Minimum Privilege: Separate assistant identity from user identity; sensitive operations require secondary confirmation;
    • Data Boundaries: Clearly define which data can leave the domain and which must be processed locally; desensitize logs;
    • Audit Trail: Record intent, routing choices, tool calls, and results to support backtracking;
    • Metric Monitoring: Acceptance volume, first-response latency, task success rate, degradation rate, and per-task cost; configure alert thresholds;
    • Evaluation Loop: Build a regression set with real desensitized requests to compare before and after model or prompt changes.

    8. Implementation Roadmap Suggestions

    1. Phase 1: Connect a single entry point + single model + synchronous short tasks to verify the acceptance and push link;
    2. Phase 2: Introduce task state machines and asynchronous execution to support long tasks and artifact delivery;
    3. Phase 3: Integrate multi-model routing and degradation, establishing capability evaluation and cost dashboards;
    4. Phase 4: Complete the PC client and permission system, gray-release, and continuously regress.

    The true competitive moat lies not in how many entry points are connected or which model is bound, but in the three sustainably optimizable engineering metrics: task success rate, cross-platform experience consistency, and unit cost. By broadening entry points, stabilizing execution, and making models flexible, a cross-platform office assistant can transition from a demo to daily production.