Creating a Chat Agent

This guide covers the main steps for setting up a new chat agent for your website.

Basic Settings

Instructions

Use the instructions field to define how the chat agent should behave. A strong prompt usually covers:

Writing Effective Instructions

Appearance

Customize the widget experience to better match your site:

Tools

Enable the tools the agent should be allowed to use:

Embedding the Widget

After saving, use the embed code snippet to place the widget on your website:

  1. Open the chat agent detail page
  2. Copy the embed code
  3. Paste it into your website's HTML, typically just before the closing </body> tag
  4. The widget will appear as a chat bubble in the corner of your site

The widget can be embedded on many kinds of websites, including static sites, WordPress, Shopify, and React applications.

Content Security Policy (CSP)

If your website uses a Content-Security-Policy header, you'll need to allow the widget's domain. Add these two directives:

Directive Value
script-src https://chat.karmaflow.ai
frame-src https://chat.karmaflow.ai

Example:

Content-Security-Policy: script-src 'self' https://chat.karmaflow.ai; frame-src https://chat.karmaflow.ai;

No additional connect-src, img-src, or style-src entries are needed — the chat UI runs inside an iframe with its own security policy. If your site does not set a CSP header, no action is needed.

Testing

You can test the widget directly from the chat agent detail page before embedding it on your site.