Add an AI Agent (Mastra) to the CometChat Chat Widget using the no‑code builder and a simple embed.
chef
) and any required API key(s).Minimal example (tools + agent)
Local run & test
chef
)http://localhost:4111/api
or public tunnel)Option A: Quick tunnel (development)
https://abc123.ngrok.io
) – this becomes your Deployment URL.Option B: Vercel serverless (Edge/Node)
https://your-app.vercel.app/api
).Option C: Docker container
Optional: Security hardening
Open Dashboard
Navigate
Add agent
chef
, Deployment URL=public base URL from Step 2.(Optional) Enhancements
Enable
Open Chat Builder
Select or create variant
Enable agent
(Optional) Identity
Save variant
Define actions
Map to tools
id
matches the action name for invocation context.Handle on frontend (optional)
Open variant
Customize & Deploy
Adjust settings
Preview & Save
Include script (<head>)
Initialize (<body> end)
Replace placeholders (<YOUR_APP_ID>
, etc.) with real values.
Check | How |
---|---|
Agent appears | Open widget → new conversation / agent entry available |
Basic reply | Send a prompt → response under a few seconds |
Tool logic works | Ask for ingredient substitution / recipe (Chef example) |
Error free | Browser console + Mastra logs have no unhandled errors |
Issue | Fix |
---|---|
Agent not listed | Confirm it’s enabled in Dashboard + variant saved |
404 from Mastra | Endpoint path or agent key mismatch |
Timeout | Expose via a tunnel or deploy to a public host |
Tool not invoked | Ensure tool ID referenced in agent instructions & code |
Auth error | Re-check Auth Key / App credentials in embed snippet |