Workers

Widget

Embeddable Ultron chat widget. A single static surface that customers drop into their own websites. Frontend-only; every server-side concern (auth, agent routing, tool calls) is delegated to the agent runtime worker. Hosted as a Pages project, no functions required.

Updated today

Overview

At a glance
Surface
ultron-widget (Pages project)
Production URL
ultron-widget.pages.dev
Custom domain
widget.51ultron.com (planned)
Functions
None. Static assets only.
Backend
Delegates to ultron-agent-runtime

The widget is the public face of "talk to my AI". A workspace owner publishes an agent, copies a one-line script tag plus a data attribute, and pastes it into their site. The widget loads, mounts a chat bubble in the corner, and routes every message through the agent runtime against the configured agent.

Surface shape

wrangler.toml (Pages project)toml
1name = "ultron-widget"
2pages_build_output_dir = "public"
3
4# No Functions. Everything server-side lives in ultron-agent-runtime.

Embedding the widget

customer sitehtml
1<!-- Drop this single tag in the customer's site head or before </body> -->
2<script
3 src="https://widget.51ultron.com/embed.js"
4 data-ultron-agent="ag_<workspace>_<slug>"
5 data-ultron-position="bottom-right"
6 data-ultron-theme="dark"
7 defer
8></script>
data attributeRequiredValues
data-ultron-agentyesag_<workspace>_<slug>. Published agent reference.
data-ultron-positionnobottom-right | bottom-left | top-right | top-left
data-ultron-themenoauto | light | dark
data-ultron-accentnoHex color for the launcher dot
data-ultron-greetingnoOptional override of the agent's default greeting

Auth and isolation

The widget never sees workspace credentials. It carries only the public agent reference, which the agent runtime worker resolves to a published-config snapshot (tools allowed, scopes, model). Per-visitor session is identified by a cookie scoped to widget.51ultron.com; cross-site tracking is impossible by construction.

Note
Workspace owners can disable / pause / republish the agent at any time. The widget polls the runtime for the published-config snapshot at first message; subsequent messages reuse the cached config until the page reloads.

Event bus

window eventjs
1// Customer site can listen to widget events:
2window.addEventListener('ultron-message-sent', (e) => {
3 // e.detail = { agent, message, sessionId, ts }
4})
5window.addEventListener('ultron-message-received', (e) => {
6 // e.detail = { agent, response, sessionId, ts }
7})
8window.addEventListener('ultron-handoff', (e) => {
9 // Agent decided to hand off to a human. detail carries the contact form payload.
10})
11
12// Customer site can imperatively send messages:
13window.Ultron?.send('Hi, can you help me with...')

File map

cf-workers/ultron-widget
wrangler.toml
public
embed.jsloader, mounts the iframe
widget.htmliframe contents
widget.css
widget.jschat UI