Architecture of In-App Embedded Extensions for Intelligent Assistants
Intelligent assistants are moving from text-only replies to acting inside the same workspace where users view, fill, confirm, and execute work. This article explains how in-app embedded extensions share structured window context across people, interfaces, and assistants, and how protocol, runtime, and business layers, plus confirmation, security, state sync, and a staged rollout, keep those actions bounded and auditable.
Intelligent assistants are moving from “returning text only” to completing view, fill, confirm, and execute steps inside the same workspace. An in-app embedded extension means a partner runs a full application interface inside an intelligent app that supports the same open protocol, while the assistant acts on the structured content currently visible in the window. The goal is not another standalone website. It is to let the person, the interface, and the assistant share one task context, so users copy and paste less and switch windows less often.
Where the Problem Starts
In enterprise work, users often face a conversation, a business form, an approval flow, and knowledge documents at the same time. If the assistant can read only text the user pastes, it loses layout, selection, validation state, and action buttons. If the business system is fully closed, the assistant also cannot query or submit on the user’s behalf within an authorized scope. The value of an embedded extension is to turn “what the person is looking at” into context that can be described, authorized, and audited—not to let the assistant control the whole desktop without limits.
Typical needs fall into four groups:
- Context nearby. When the user selects a record in the window, the assistant should understand that record’s identifier, status, and available actions.
- Actions that require confirmation. Writes, approvals, and outbound sends need an explicit human confirmation. The model must not decide on its own.
- Reuse across hosts. The same application should run in any intelligent app that implements the protocol, instead of rewriting the interface for every host.
- Recoverable failure. When the network drops, permission is missing, or the interface version does not match, the error should return to the interface rather than leaving only a vague note in the chat.
How the Protocol and Runtime Split the Work
Split the system into three layers so the interface, the model, and the business system do not become tangled.
The protocol layer discovers capabilities, passes context, and constrains actions. It defines message types, permission scopes, and result structures. It does not prescribe how any one vendor’s interface looks. The application declares which views it can show, which intents it accepts, and which states it returns. The host declares which regions the assistant may read and whether it may initiate a click or a submit. Both sides start with capability negotiation, not with everything enabled by default.
The runtime hosts the window. The embedded app typically runs in an isolated browser sandbox or an equivalent isolated container, separate from the host conversation. The window can send the host a “current view snapshot”: view identifier, key fields, optional actions, and the user’s selection. The host gives those snapshots to the assistant for reasoning. If the assistant wants to act, it must first produce a structured intent. The runtime then checks that the intent falls inside the declared action set.
The business layer stays on the application’s own server. Queries, transactions, and permission decisions should not be handed to the model. The model aligns natural language and interface state into an intent. Actual reads and writes are executed by the application backend under existing business rules. Accounting, approvals, and data consistency therefore remain with the business system even if the host or the model changes.
A neutral capability declaration shows structure only. It is not a product-specific interface:
app:views: [list, detail, form]actions:- name: open_detailinput: { id }effect: read- name: submit_forminput: { id, fields }effect: writeconfirm: requiredhost:can_read: [selection, visible_fields, validation]can_invoke: [open_detail, submit_form]
How the Assistant Acts on Window Content
A reliable loop has five steps. It is not “see the screen and operate.”
Normalize the view. The interface turns the current screen into a stable structure: object type, primary key, visible fields, validation errors, and whether buttons are available. Do not treat a full-page pixel image or uncontrolled script as the only context. A version change will then cause the assistant to misread the screen.
Align the intent. If the user says “reject this one,” the assistant must bind “this one” to the current selection. If nothing is selected, or several items are selected, ask the user to clarify instead of guessing the first row.
Check permission and effect. Separate read actions from write actions. Write actions require user confirmation in the interface or the conversation by default. The confirmation text should include the object identifier and the fields that will change, not only “continue?”
Execute and acknowledge. The application backend returns success, partial success, or a business rejection. After the interface updates, it sends a new view snapshot back to the host so the assistant can continue the conversation. The receipt should contain only the fields needed to finish the task. Do not put internal stacks or sensitive details into the context.
Support undo and idempotency. Submit-style actions should carry a business idempotency key. A repeated click or an assistant retry must not create a second document. For reversible operations, provide compensation in the business system, not only a visual “undo” on the screen.
Security Boundaries
Embedded extensions enlarge the assistant’s action surface. Security needs to be stricter than a typical web integration.
Least privilege. Each view exposes only the fields required for that view. A list page should not include ID numbers, secrets, or internal notes that belong on the detail page. Grade actions as read, write, or outbound. Outbound sends and bulk writes stay off by default.
Source checks. The host accepts messages only from registered applications. The application accepts calls only from the current host session. Context pasted across windows must not inherit permissions automatically.
Human in the loop. Money movement, permission changes, external sends, deletes, and bulk updates require a second confirmation. That confirmation must be an explicit control in the interface. A model statement such as “I have confirmed” cannot replace the user’s action.
Data leaving the boundary. Content that enters the model context should support configurable redaction. Logs can record the action name, object identifier, and result code. Avoid keeping complete forms for a long time. If the organization uses cloud logging and monitoring alerts, collect the same field allowlist there.
Isolation. The embedded page and the host communicate through a restricted channel. They do not share arbitrary script execution. Third-party scripts and rich text from uncertain sources should render inside the sandbox.
State Sync and Experience
Users operate in the conversation and the window at the same time, so state can diverge. Treat the business backend as the only source of truth, the interface as a projection, and the conversation as a store of the latest confirmed intent and a short receipt summary.
Refresh behavior should distinguish three events:
- The user edits but has not submitted: keep a local draft only.
- The user submits successfully: broadcast a new snapshot.
- Someone else changes the same object: show the conflict and let the user choose overwrite or merge.
Do not let the assistant automatically retry a write while a conflict is unresolved.
Long-running work should be asynchronous. The interface shows progress and notifies the host when it finishes. Object storage fits export files and attachments. A message queue fits decoupling “accepted” from “completed.” A container platform fits stateless interfaces and gateways. These are general capability categories. Choose them by data sensitivity, latency, and audit needs, not by locking in one fixed architecture.
Engineering Checklist for Integration
Before launch, at least check the following:
- Are capabilities versioned, and can an older host safely degrade when it meets a new action?
- Does every write action have confirmation, an idempotency key, a permission check, and an audit record?
- Do empty selection, missing permission, validation failure, timeout, and partial success each have interface copy and a machine-readable error code?
- Does context use a field allowlist and a length limit, so a full-database query result is not sent into the chat?
- Do regression tests cover read-only viewing, single-record submit, concurrent edits, repeated clicks, and resuming a session after the host restarts?
- Can observability report success rate by application, action, and result code without exposing sensitive fields in plaintext?
Rollout Order
Advance in three stages. Do not open every button at the start.
Stage 1: read only. Embed list and detail views. The assistant may only explain the current record, compare fields, and draft text. This stage checks whether snapshots are stable and redaction is sufficient.
Stage 2: write a single object. Open save, submit, and similar actions, with required confirmation and idempotency. This stage checks whether the interface can express a business rejection correctly.
Stage 3: collaborative flows. Add approval, assignment, and batch handling, plus asynchronous tasks and alerts. Each new effect needs a fresh threat model. Do not reuse the permissions from the read-only stage.
Teams that use general cloud capabilities such as Baidu AI Cloud can place interface static assets, export files, asynchronous tasks, and audit logs in object storage, a message queue, a container platform, and a logging service. Business authorization should still be completed inside the organization’s own application. Cloud resources provide runtime and traceability. They do not replace action confirmation or data minimization.
Conclusion
The point of an in-app embedded extension is not to let the assistant “see a screen.” It is to turn window content into bounded, structured context, and to make every action declarable, confirmable, executable, and auditable. The protocol handles interoperability, the sandbox handles isolation, and the business system holds the truth. Moving in order—read only, single-object write, then collaborative flow—lets a team reuse the same capabilities across intelligent apps that support the same open extension, while keeping misoperation and data exposure within an acceptable range.
