Embedding Full Applications in AI Assistants: Engineering Practices for Connectors and Plugins
This article explores the architectural and engineering practices behind embedding full third-party application interfaces within AI assistants. It covers the layered architecture, sandboxed view rendering, bidirectional messaging channels, structured tool declarations, and context synchronization strategies that enable assistants to not only read the visible state of an embedded application but also safely perform actions on behalf of users. It also discusses permission boundaries, security considerations, typical enterprise use cases, and a practical rollout sequence for engineering teams.
1. Background: From Text-Based Q&A to Interactive Application Windows
Early AI assistants were primarily text-based. Users input questions, models returned text, and the interaction boundary was clear—yet capabilities were limited. When users needed to view a report, edit a form, or adjust schedules in a calendar view, pure text interfaces fell short. This gave rise to a new requirement: allowing third-party applications to run with full interfaces inside the assistant, while enabling the assistant to read the contents of the window and perform operations on the user’s behalf.
This direction yields two direct benefits. First, users no longer need to switch between multiple systems; tasks can be completed within a single session. Second, the assistant is no longer limited to describing data—it can offer recommendations based on the real-time state of the interface or execute steps directly.
Implementing this capability depends on several foundational mechanisms: rendering and isolation of the interface container, a message channel between the host (assistant) and the application, structured descriptions of tool capabilities, and strategies for synchronizing state within a session. The remainder of this article discusses each of these mechanisms in detail.
2. Core Concepts and Role Definitions
Before discussing implementation, terminology needs to be unified. This article uses the following concepts:
- Host: The AI assistant client or server that carries conversation and model inference.
- Application: A functional module developed by a third party or internal team, providing business logic and user interface.
- Embedded View: The window area within the host that displays the application interface, which can be a full page or a panel.
- Tool: A callable capability that the application declares to the host. Each tool includes a name, description of purpose, input parameter structure, and return format.
- Context: Information that the host can read and provide to the model in a session, including user messages, tool results, and the visible state of the embedded view.
Once roles are clarified, the boundaries of permissions and responsibilities become easier to define. The host is responsible for identity authentication, session management, and user authorization. The application is responsible for the correctness of business data and its own data storage. Communication between the two must go through explicitly defined message formats rather than shared memory or global variables.
3. Overall Architecture
A reliable embedded application architecture typically consists of four layers:
┌──────────────────────────────────────────┐│ Host Layer: Dialog UI, Model Inference, ││ Session State │├──────────────────────────────────────────┤│ Channel Layer: Message Bus, Capability ││ Registry, Permission Enforcement │├──────────────────────────────────────────┤│ View Layer: Sandboxed Embedded App UI │├──────────────────────────────────────────┤│ Service Layer: Business APIs, Data ││ Storage, Audit Logs │└──────────────────────────────────────────┘
The channel layer is the critical component of the entire architecture. It converts the model’s tool-call requests into instructions for the corresponding application, converts the application’s UI events into context that the model can understand, and performs permission checks at both ends. Without a channel layer, the host would have to guess the interface state, and security boundaries would be impossible to enforce.
The service layer maintains interface compatibility with existing systems. The embedded view is simply a new presentation entry; business rules should remain on the server side. This avoids duplicating the same logic in both the UI and the backend, and also simplifies auditing.
4. Detailed Discussion of Key Mechanisms
4.1 Rendering and Isolation
The application interface runs inside the host and must therefore be isolated from the host environment. Common approaches include:
- Using a separate rendering context, such as a sandboxed frame, to restrict the application’s direct access to the host DOM and global objects.
- Restricting script sources through content security policies, allowing only registered domain resources to be loaded.
- Setting explicit permission declarations for the embedded view’s size, focus, and clipboard access, with high-risk capabilities disabled by default.
- Allocating separate storage namespaces to each application to prevent applications from reading or writing each other’s data.
Isolation policies need to be balanced with product experience. Overly strict restrictions can lead to incomplete application functionality, while overly loose restrictions increase the risk of data leakage. In practice, it is recommended to start with minimal permissions and grant additional permissions incrementally based on specific business needs. Each expansion should be documented with its rationale and undergo a security review.
4.2 Bidirectional Communication
Bidirectional communication consists of two paths.
Uplink path: The application notifies the host of interface events, such as a user selecting a row in a table or modifying a field. The host may choose to write these events into context for the model to reference in subsequent responses. Uplink messages should be as structured as possible, containing only essential fields, and should avoid indiscriminately uploading raw page data.
Downlink path: The host converts the model’s decisions into instructions executable by the application, such as opening a view, filling in a form field, or triggering a data refresh. Downlink instructions must pass permission checks and display confirmation information to the user before execution, especially for operations involving writes or deletions.
Communication messages should adopt a structured, versioned format that includes message type, request ID, timestamp, and payload. The version number facilitates future evolution, while the request ID helps with tracing and retries.
4.3 Tool Capability Declarations
The tool description determines whether the model can correctly select and invoke application capabilities. A clear description should include the following elements:
- Name: Use a verb-plus-object format, such as
query_customer_brief. - Description: Use one or two sentences to describe when the tool should be called, avoiding vague wording.
- Input parameters: Use a structured schema to define field types, required fields, and value ranges.
- Return format: Describe the data structure for both success and failure cases so the model can parse the results.
- Side-effect marker: Clearly indicate whether the tool is read-only or modifies data.
Here is an illustrative tool declaration. The field names are used only to demonstrate the structure and do not represent a specific product’s API specification:
{"name": "query_customer_brief","description": "Retrieves a customer overview by customer ID, used for sales visit preparation. Read-only operation.","parameters": {"type": "object","properties": {"customer_id": {"type": "string","description": "The unique identifier for the customer in the business system"},"time_range_days": {"type": "integer","minimum": 1,"maximum": 365,"description": "Number of days for which interaction records are aggregated"}},"required": ["customer_id"]},"side_effects": "none"}
The side_effects field is particularly important. The host can use it to determine whether user confirmation is needed, reducing the risk of accidental operations.
4.4 State Synchronization and Context Management
The state of an embedded view changes frequently. If every change were pushed to the model, it would consume a large portion of the context window and increase latency. A more reasonable approach is to use a layered synchronization strategy:
- At session start, pass the basic metadata of the view, such as the current application, current page type, and user identity.
- When the user asks a question related to the view, pull the view’s summarized state on demand rather than the complete dataset.
- Proactively push a brief event when the view undergoes a key change, such as form submission or approval completion.
- When the session ends or the view closes, clean up temporary state and retain only the necessary audit records.
Building on this, data timeliness also needs to be addressed. The host should annotate each piece of data in the context with its retrieval time, allowing the model to determine whether the information is stale and prompt the user to refresh when necessary.
5. Typical Applications in Enterprise Scenarios
The value of embedded applications is most evident in concrete business use cases. The following three scenarios are representative.
5.1 Sales Preparation
Before visiting a customer, a salesperson typically needs to aggregate basic customer information, recent interaction records, open opportunities, and possible objections. If this information is scattered across multiple systems, preparation can be time-consuming.
An embedded application can consolidate the customer overview, opportunity list, and historical communication records into a single view. The assistant can then generate a visit outline based on the view content and highlight issues that require focused attention. The key is that the content generated by the assistant should indicate the data source and time so the salesperson can verify it.
5.2 Financial Analysis
The difficulty of financial analysis lies in complex data calibers, multi-step calculations, and the need for traceable conclusions. An embedded view can display reports, filter conditions, and key metrics. The assistant can explain the main drivers behind metric changes and suggest line items requiring further review.
It is important to emphasize that conclusions involving monetary calculations should be based on system calculation results; the model’s explanations serve only as a supplementary aid. For write operations such as adjustment entries and approval flows, a human confirmation step must be retained.
5.3 Human Resource Management
HR-related tasks involve a large amount of personal information and have the most stringent compliance requirements. Typical scenarios include attendance anomaly review, onboarding process tracking, and performance material organization.
In these scenarios, the view should display only the minimum fields required to complete the task. The assistant’s context should not include sensitive information such as national ID numbers or salary details unless explicitly authorized by the user and permitted by the process. All reads and modifications should be recorded in audit logs.
6. Permissions, Security, and Compliance
Embedded applications connect conversational AI with business systems, which introduces additional security risks. The following points need to be considered at the design stage:
- Least privilege: Each application obtains only the data access required to perform its functions, further narrowed by user role.
- Input validation: Both the host and the server must validate tool parameters to prevent anomalous values generated by the model from entering business logic directly.
- Output redaction: Data returned to the model should strip out unnecessary sensitive fields.
- Write-operation confirmation: Any tool that modifies data must display the changes before execution and obtain explicit user confirmation.
- Audit trail: Record who accessed what data through which tool at what time; retention periods should comply with regulatory requirements.
- Prompt injection defense: Text content in the view may contain instructions designed to mislead the model. The host should treat view data as data, not as instructions.
At the infrastructure level, generic cloud service categories can be used to build the supporting environment, such as object storage for exported files, message queues for asynchronous long-running tasks, container platforms for service deployment, and logging and monitoring services for operational visibility. The specific selection should be based on the enterprise’s existing technology stack and compliance requirements.
7. Engineering Rollout Steps
The implementation process can proceed in the following order:
- Identify scenarios: Select high-frequency tasks with clear data boundaries and strong UI dependency as the initial pilot cases.
- Define the capability list: For each scenario, list tool names, parameters, return structures, and side-effect markers, and organize a review.
- Build the channel layer: Implement the four foundational modules—message format, capability registry, permission checks, and event logging.
- Integrate views: Complete sandbox configuration, size adaptation, and basic interaction testing.
- Develop evaluation sets: Prepare a set of typical questions and expected behaviors, covering normal paths, boundary inputs, and error cases.
- Roll out gradually: Start with a small group of users and monitor mis-invocation rates, response times, and user feedback.
- Iterate continuously: Adjust tool descriptions and permission scopes based on logs, avoiding overly broad descriptions that lead to accidental invocations.
The evaluation phase is often underestimated. The model’s tool-selection accuracy is affected by the wording of descriptions—the same capability phrased differently may produce significantly different invocation frequencies. Tool descriptions should therefore be version-managed like API documentation, with regression testing after every modification.
8. Pre-Launch Checklist
- Does every tool have a clear description and a side-effect marker?
- Do all write operations include a user confirmation step?
- Is the view running in an isolated environment with only the necessary permissions?
- Has the data returned to the model been redacted?
- Do the audit logs cover both read and write operations?
- Have tests been conducted for prompt injection, privilege escalation, and parameter anomalies?
- In the event of a failure, can an application’s entry point be quickly disabled without affecting the overall session?
9. Trade-offs and Considerations
Embedded applications are not suitable for every scenario. For simple information lookups, plain-text responses are adequate, and an additional interface only adds complexity. For tasks requiring frequent interaction and low-latency responses, the rendering and communication overhead of embedded views may become a bottleneck.
Regarding architecture selection, there is a trade-off between uniformity and flexibility. A unified channel protocol simplifies management and auditing but restricts the application’s expressiveness. An open integration approach offers more flexibility at the cost of higher governance overhead. In practice, most teams first unify the core protocol and security policies, then allow business teams to design their interfaces autonomously within the established framework.
Overall, embedded applications connect conversation, interface, and business systems into a single workflow. Their value depends on three conditions: whether tool descriptions are clear, whether permission boundaries are strictly enforced, and whether business rules remain reliably handled by the server side. Getting these three aspects right enables the assistant to see the interface and act on the user’s behalf safely.
