Connect a Mastra agent to CometChat, customize it with Chat Builder, and ship it as React UI Kit code or a Chat Widget.
Create or open an app
Copy credentials
Choose provider
Basic details
Mastra configuration
Save & enable
Tip: If you update your Mastra agent later (prompts, tools, routing), you won’t need to re-connect it in CometChat—just keep the Agent ID and Deployment URL the same.
Add an action
Define fields
open_product
).Validate inputs (schema)
Handle in your UI
Open variant
Customize & Deploy
Adjust settings
Preview
The Mastra agent from Step 2 is included automatically in exported variants—no extra code needed for basic conversations.
Decide delivery mode
Widget path
React UI Kit path
Verify agent inclusion
Define an agent with tools
Expose a public HTTP endpoint
Run & Deploy Your Mastra Agent
npx mastra dev
starts local API (commonly http://localhost:4111/api
).Quick test (replace AGENT_ID
):
Append route (e.g. /api/agents/chef/generate
) to the forwarded HTTPS URL.
Use the final HTTPS URL + path for Deployment URL and the agent key (e.g. chef
) for Mastra Agent ID.
Deploy & copy IDs
Enable the agent
Preview in Chat Builder
Validate conversation
Test actions
Agent not responding
Tool call not executed
Auth issues in exports
authKey
only for development. For production, implement a secure token flow for user login.Add more Actions
Localize & theme
Analytics & observability