Embeddable GenAI-powered web chat widget with client-side agent loop, tool calling, WebMCP support, and Cloudflare Workers backend.
- π€ Client-side AI agent loop (Vercel AI SDK)
- π§ 5 built-in tools: web_fetch, skill, todo, send_email, escalate_to_human
- π TF-IDF knowledge base search
- πΎ Session persistence (IndexedDB / localStorage)
- π WebMCP support (Chrome 146+) β provider + consumer
- π¨ Shadow DOM isolation β works on any website
- βοΈ Cloudflare Workers backend (D1, KV, Queues; R2 optional)
- π Hybrid API keys: BYOK + managed
<script src="https://unpkg.com/@vibetechnologies/webagent/dist/webagent.min.js"></script>
<script>
WebAgent.init({
apiBase: 'https://your-worker.workers.dev',
apiKey: 'wa_your_managed_key',
welcomeMessage: 'Hi! How can I help you today?',
});
</script>npm install @vibetechnologies/webagentimport { WebAgent } from '@vibetechnologies/webagent';
const agent = WebAgent.init({
apiBase: 'https://your-worker.workers.dev',
apiKey: 'wa_your_managed_key',
welcomeMessage: 'Hi! How can I help?',
theme: 'dark',
position: 'bottom-right',
persistence: 'indexeddb',
sessionTtlDays: 7,
});
// Later: agent.destroy();| Option | Type | Default | Description |
|---|---|---|---|
apiBase |
string |
required | Backend worker URL |
apiKey |
string |
undefined |
API key (BYOK sk-... or managed wa_...) |
systemPrompt |
string |
'You are a helpful support agent.' |
System prompt |
skills |
Skill[] |
[] |
API skills for tool calling |
knowledgeBaseUrl |
string |
undefined |
URL to knowledge base JSON |
theme |
'light' | 'dark' | 'auto' | ThemeConfig |
'light' |
Theme |
position |
'bottom-right' | 'bottom-left' |
'bottom-right' |
FAB position |
welcomeMessage |
string |
undefined |
Initial greeting |
persistence |
'indexeddb' | 'localStorage' | 'none' |
'indexeddb' |
Session storage |
maxSteps |
number |
10 |
Max tool-calling steps |
model |
string |
'gpt-4o-mini' |
LLM model name |
supportEmail |
string |
'support@example.com' |
Escalation recipient |
sessionTtlDays |
number |
7 |
Session TTL in days |
onEscalation |
(ticket) => void |
undefined |
Escalation callback |
onMessage |
(message) => void |
undefined |
Message callback |
See the Skill Authoring Guide for full documentation on creating and registering API skills.
βββββββββββββββββββββββββββββββ
β Host Website β
β ββββββββββββββββββββββββββ β
β β Shadow DOM β β
β β ββββββββββββββββββββ β β
β β β Chat Widget UI β β β
β β β (Preact) β β β
β β ββββββββββ¬ββββββββββ β β
β β β β β
β β ββββββββββΌββββββββββ β β
β β β Agent Loop β β β
β β β (Vercel AI SDK) β β β
β β β βββββββββββββββ β β β
β β β β Tools β β β β
β β β β β’ web_fetch β β β β
β β β β β’ skill β β β β
β β β β β’ todo β β β β
β β β β β’ send_email β β β β
β β β β β’ escalate β β β β
β β β βββββββββββββββ β β β
β β ββββββββββ¬ββββββββββ β β
β βββββββββββββΌβββββββββββββ β
ββββββββββββββββΌβββββββββββββββ
β HTTPS
ββββββββββββββββΌβββββββββββββββ
β Cloudflare Workers β
β βββββββββββ βββββββββββββ β
β β LLM β β Fetch β β
β β Proxy β β Proxy β β
β βββββββββββ βββββββββββββ β
β βββββββββββ βββββββββββββ β
β β Email β β Escalate β β
β β Queue β β Tickets β β
β βββββββββββ βββββββββββββ β
β βββββββββββ βββββββββββββ β
β β KB (KV/R2)β β Admin β β
β βββββββββββ βββββββββββββ β
β D1 Β· KV Β· Queues (R2 opt.) β
ββββββββββββββββββββββββββββββββ
The widget supports the WebMCP standard (Chrome 146+):
Skills registered with the widget are automatically exposed via navigator.modelContext.registerTool(), making them available to browser-level AI agents.
The widget can discover and use tools registered by the host page or other extensions via the WebMCP API.
<form toolname="search-products" tooldescription="Search the product catalog">
<input name="query" toolparamdescription="Search query" />
<button type="submit">Search</button>
</form>| Package | Description |
|---|---|
@vibetechnologies/webagent |
Client-side chat widget |
@vibetechnologies/webagent-backend |
Cloudflare Workers backend |
examples/basic/index.htmlβ minimal static embed exampleexamples/ecommerce/index.htmlβ e-commerce flavored static demoexamples/docs-site/index.htmlβ docs-focused static demoexamples/config-assistant/index.htmlβ Cloudflare-hostable widget configuration assistant with live preview and copy-paste embed generation
pnpm install
pnpm typecheck # Type-check all packages
pnpm build # Build all packages
pnpm test # Run tests
pnpm dev # Dev mode (all packages)
pnpm --filter @vibetechnologies/webagent-backend dev:azure # Backend with ~/.env.d/azure-dev.envMIT