Overview
Mindset AI SDK 3 lets you embed multiple AI agents on a single webpage. Each agent operates independently with complete state isolation—conversations, inputs, and errors in one agent don’t affect others. This enables you to provide specialized agents for different contexts: a sales assistant in your checkout flow, a support bot in your account section, and a product expert on your catalog pages—all on the same site.SDK 3 Required: Multi-agent embedding is available in SDK 3.
Quick Start
Include the SDK once, define multiple agents, and initialize—all agents render automatically.How It Works
Instance Isolation
Each agent receives a unique instance ID ({agentUid}::{uuid}), ensuring complete isolation:
Shadow DOM
Each agent renders inside its own Shadow DOM container, providing:- CSS Isolation — Your website styles don’t affect agents, and vice versa
- DOM Isolation — Agent elements don’t interfere with your page’s JavaScript
Configuration
Agent Tag Attributes
Initialization Options
Theme and font customization apply to all agents on the page. Individual agents cannot have different themes.
Dynamic Agent Embedding
The SDK automatically detects agents added after initialization—useful for single-page applications and conditional loading.Use Cases
Single Page Applications — Add agents on route changes without re-initializing Conditional Display — Show agents based on user actions or state Lazy Loading — Add agents only when their section becomes visibleFlexible UI with Multiple Agents
When using Flexible UI (via<mindset-container>), only the first container on the page receives full flexible UI support. Subsequent containers render their agents as standard floating chat windows.
What is Flexible UI?
Flexible UI provides display modes like tray view, pill button, and smooth transitions between minimized/maximized states. It’s enabled by wrapping<mindset-agent> in a <mindset-container>.
The Limitation
Recommended Pattern
Use flexible UI for your primary agent only, and standard<mindset-agent> tags for others:
Best Practices
Authentication with Token Refresh
Always return a fresh or refreshed token fromfetchAuthentication:
Strategic Placement
Place agents where they provide contextual help:Mobile Considerations
Consider limiting the number of agents on smaller screens:Use Cases
Contextual Support
Deploy different agents in different sections: checkout assistant, account support, product expert
Role-Based Agents
Show specialized agents based on user role: customer agent, admin agent, partner agent
Single Page Apps
Dynamically add/remove agents as users navigate between routes
Progressive Enhancement
Start with one agent, add more based on user behavior or session length
Troubleshooting
Agent not rendering
Possible causes:- Invalid
agentUid - Agent UID doesn’t match Agent Management Studio exactly (case-sensitive)
- SDK not loaded before agent tags
<mindset-agent> tags appear in the DOM.
Authentication error
Possible causes:fetchAuthenticationnot returning correct format- Token is invalid or expired
- Network request failed
fetchAuthentication returns { token: string }. Check token validity. Verify network connectivity.
Agent shows error screen
Possible causes:- SDK initialization failed
- Invalid configuration parameters
- Network connectivity issues
appUid, fetchAuthentication) are provided.
Styles look broken
Possible causes:- CSS conflicts with website styles
- Outdated SDK version
- Browser compatibility issues
Multiple agents sharing state
Possible causes:- SDK bug (rare)
- Multiple
init()calls - Incorrect agent UID configuration
init() only once. Ensure each agent has a unique agentUid. Update SDK to latest version. If issue persists, contact support@mindset.ai.
Browser Support
Supported browsers: Chrome 90+, Firefox 88+, Safari 14+, Edge 90+Older browsers may not support Shadow DOM or other modern features required by the SDK.