m4Mindset docs

Docs / Build / Embed an agent

View as Markdown

Embed an agent

Put an agent in your web app with one script and one tag.

Add the Mindset script, create a session on your server, and place the <mindset-agent> element where the agent should appear.

1. Create a session on your server

ts
const session = await mindset.sessions.create({ agentId: 'support', userId: user.id })

2. Add the element

html
<script src="https://cdn.mindset.ai/agent.js" async></script>
<mindset-agent session="SESSION_TOKEN"></mindset-agent>
AttributeWhat it does
sessionThe token from step 1
conversation-listLets users reopen earlier conversations