Skip to content

Web Widget

Embed a chat widget on any website. Visitors can talk to your agent directly from your site — no account required on their end.


  1. Go to Console → Integrations → Web Chat Widget and create a widget connection
  2. Copy the allowed domains and embed code from the connection setup
  3. Open your customer-facing agentChannels tab and bind the widget connection (creates an event Flow)
  4. Paste the embed code on your site before </body>

The Console generates embed code when you create the widget connection. It looks like this:

<script>
window.AgentForgeConfig = {
apiKey: 'wk_pub_xxxxxxxx'
};
</script>
<script src="https://unpkg.com/@agentforgelab/chat-widget@1.0.0/dist/index.global.js" async></script>

Always copy the exact snippet the Console generates — it carries your widget’s public key. The agent is bound via the Channels Flow, so you do not pass agentId in the embed config.


Appearance (primary color, greeting, position, agent name) is configured when you create the widget connection in Integrations → Web Chat Widget, not in the embed snippet.


The widget only loads on domains you whitelist on the widget connection. Requests from unlisted domains are rejected — this makes it safe to include your public widget key (wk_pub_...) in client-side code.


Widget conversation volume and credit usage appear in the Console under your widget connection and agent run history.