Skip to main content
Mindset AI agents on SDK 3.0 use simpler visual option configuration and have additional configuration options. Please speak to your customer success manager to enable these options in your Agent Management Studio.

Important: SDK 3.0 Configuration Behavior

Before migrating, understand how SDK 3.0 configuration affects your existing agents:
Agent configuration changes affect all versions:
  • Agent configuration details (Purpose, Personality, Policy, LLM Choice) will affect live and deployed agents even when they are still deployed using SDK 2.0
  • MCP and context assignment changes (when not using agent sessions) will affect live and deployed agents even when they are still deployed using SDK 2.0
Options configuration is version-specific:
  • Options configuration will only apply to agents deployed using SDK 3.0 and will not impact agents deployed with SDK 2.0. Feel free to experiment before updating live agents to use SDK 3.0.
  • SDK 2.0 options will not be available while the Agent Management Studio is set to manage SDK 3.0 agents. If you need to make configuration changes to options for your active agents deployed using SDK 2.0, please speak with your customer success manager.

Migration Steps

1

Replace the SDK Script

Update the script source to use SDK 3.0:
<script src="MINDSET-SERVER-URL/mindset-sdk3.umd.js"></script>
2

Add the Agent HTML Tag

Add the <mindset-agent> tag to your HTML body:
<mindset-agent
    agentUid='YOUR-AGENT-UID'>
</mindset-agent>
Replace YOUR-AGENT-UID with your agent’s unique identifier.
3

Remove SDK 2.0 Methods

Remove the JavaScript code that uses SDK 2.0 methods (initApp() and render() or startAgentThread()).Old SDK 2.0 code to remove:
mindset.initApp({ 
    appUid: "YOUR-APP-UID", 
    authToken: data.authToken,     
    containerId: "agent-div",      
    loadingText: "Please wait ..." 
})

mindset.startAgentThread({
    agentUid: "YOUR-AGENT-UID",  
    initialQuestion: "Some text to send to the agent"
});
4

Create Authentication Function

Wrap your existing authentication code into an async function:
async function getAuthToken() {
    const currentUserId = 'session123'
    const userAuthTokenServerUrl = `YOUR-BACKEND-API-RETURNING-AUTHTOKEN`
    // e.g. https://mycompany-backend/api/getusertoken/${currentUserId}
    
    try {
        const headers = {
            "accept": "application/json",
            "Content-Type": "application/json"
        };
        const response = await fetch(userAuthTokenServerUrl, {
            method: 'POST',
            headers: headers,
            body: JSON.stringify({"currentUserId": `${currentUserId}`})
        });
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        const responseData = await response.json();
        return responseData.authToken;
    } catch (error) {
        console.log('Error fetching auth token:', error);
        throw error;
    }
}
This function fetches the authentication token from your backend and returns it to the SDK.
5

Initialize SDK 3.0

Pass your authentication function to the mindset.init() method:
mindset.init({
    appUid: 'YOUR-APP-UID', 
    fetchAuthentication: getAuthToken
});
Replace YOUR-APP-UID with your application UID.

Complete Migration Example

Here’s what your complete SDK 3.0 implementation should look like:
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="https://mindset-prod-eu-embedded-sdk-v3.web.app/mindset-sdk3.umd.js"></script>

        <script>
            async function getAuthToken() {
                const currentUserId = 'session123'
                const userAuthTokenServerUrl = `YOUR-BACKEND-API-RETURNING-AUTHTOKEN`
                
                try {
                    const headers = {
                        "accept": "application/json",
                        "Content-Type": "application/json"
                    };
                    const response = await fetch(userAuthTokenServerUrl, {
                        method: 'POST',
                        headers: headers,
                        body: JSON.stringify({"currentUserId": `${currentUserId}`})
                    });
                    if (!response.ok) {
                        throw new Error(`HTTP error! status: ${response.status}`);
                    }
                    const responseData = await response.json();
                    return responseData.authToken;
                } catch (error) {
                    console.log('Error fetching auth token:', error);
                    throw error;
                }
            }

            mindset.init({
                appUid: 'YOUR-APP-UID', 
                fetchAuthentication: getAuthToken
            });
        </script>   
    </head>

    <body>
        <div class="main-container">
            <h1>Mindset Embedded Agent</h1>
        
            <mindset-agent 
                agentUid='YOUR-AGENT-UID'
                style='width: 100%; height: 600px; display: block; background-color: rgb(255, 255, 255); overflow: hidden; border-radius: 12px;'>
            </mindset-agent>
        </div> 
    </body>
</html>

Need help with migration? Contact your customer success manager or reach out to [email protected].