Getting Started

From zero to agent in 5 minutes.

No backend changes required for basic setup. Paste two lines and you're live.

01

Create a product

Sign up at app.widgent.app, create a product, and add your LLM API key. You'll get a Product ID.

02

Add the script tag

html
<script src="https://cdn.widgent.app/index.global.js"></script>
03

Initialize the widget

js
window.widgent.init({
  productId: 'YOUR_PRODUCT_ID',
  serviceKey: 'YOUR_SERVICE_KEY', // Dashboard > Security tab
  type: 'bubble', // bubble | sidebar | popup | inline | headless
});
04

Identify your user (optional but recommended)

Tell the agent who's talking. Call your backend to get a signed identity token.

js
// Server-side (Node.js)
import jwt from 'jsonwebtoken';
const token = jwt.sign(
  { sub: user.id, name: user.name, email: user.email },
  process.env.WIDGENT_SECRET,
  { expiresIn: '1h' }
);

// Client-side � after widgent:ready
window.widgent('setIdentityTokenFetcher', async () => {
  const res = await fetch('/api/widgent-token');
  const { token } = await res.json();
  return token;
});
05

Register tools (optional)

Give the agent the ability to take real actions in your app.

js
window.widgent('registerTools', {
  navigateTo: async ({ path }) => {
    router.push(path);
    return { status: 'ok', path };
  },

  getOrderStatus: async ({ orderId }) => {
    const res = await fetch(`/api/orders/${orderId}`);
    return res.json();
  },
});