Step-by-step guide for embedding a Mindset AI agent in your web application (frontend)
This page provides a guide for embedding a Mindset AI agent in a Multiple Page Application.If you want to embed a Mindset AI agent in a Single Page Application (e.g., React, Vue, Angular), we recommend reading this page to understand the main concepts, then check out the Sample code for Single Page Applications.
Go to your Agent Management Studio dashboard and view your live agents. For each agent, you can display full deployment instructions with your specific configuration parameters already populated.
For agents using anonymous access, you’ll need to whitelist the URLs where your agent will be embedded. Please contact your CS manager to help you do so.
If you’re rendering the agent inside a Shadow DOM (commonly used in web components for style encapsulation), you need to explicitly pass the agent element to the mindset.init() method.
When using <mindset-container> for dynamic agent switching inside Shadow DOM:
Copy
Ask AI
const containerElement = shadowRoot.querySelector('mindset-container');await window.mindset.init({ appUid: "YOUR-APP-UID", fetchAuthentication: yourAuthFunction, container: containerElement // Use container parameter for dynamic views});
Note: Shadow DOM is typically used in web components to isolate styles and markup. If you’re not using web components or Shadow DOM, you don’t need these parameters.
The <mindset-agent> tag can be wrapped in any <div> element on your page. For a more flexible UI that remains visible without being intrusive, enable Flexible Agent UI mode.