Skip to main content

Overview

The widget is a standard Web Component (<agent-chat>). Drop one script tag and one HTML element into any page — React, Angular, Vue, plain HTML — and it works. The host app doesn’t need to install React or any chat dependencies. Requires agent-manager running (not agentctl serve). See Quickstart — Path 2.

Basic embed


Modes

Floating (launcher button)

A circular button in the corner. Clicking it opens the chat panel.
position options: bottom-right (default), bottom-left

Inline

Renders as a fixed panel directly in the page — no launcher button.

All attributes

The element also exposes these hooks for host apps:
  • element.tokenProvider = async () => token — for a SPA holding its token in memory instead of exposing token-url.
  • element.refreshIdentity() — re-resolves the caller after a SPA signs a user in or switches user.
  • element.logout() — clears the stored identity and thread when the host signs a user out.
  • agent-chat:identity-error event — raised when a configured token-url cannot be used.
With neither configured, the widget asks the manager for a visitor pass, so a product with no login still gets one isolated conversation per browser.

Script-only embed (no HTML tag)

For apps where you can only inject a <script> — like a CMS or a platform that restricts HTML — the widget auto-mounts if you set window.agentChatConfig:
If no <agent-chat> element exists on the page, the widget creates one on <body> automatically.

Framework integration

React

Angular

Allow custom elements in your module:
Then use it in a template:

Vue / plain HTML

No setup needed — just the script tag and the element.

Listening to events

The widget emits a DOM event after each answer, with routing and tool metadata:
Only safe metadata is exposed — no internal reasoning, no prompt content.

Streaming

The widget connects to the streaming endpoint (POST /conversations/{id}/messages/stream) and renders tokens as they arrive. If streaming fails before a usable answer, it falls back to the standard endpoint automatically.

Tool approvals

When a tool requires human approval, the widget pauses the current run and shows the tool’s human-readable description and three actions:
  • Approve — allow only this tool invocation.
  • Deny — reject this invocation without running the tool.
  • Approve for this session — allow this invocation and stop asking for the same scoped tool during the current conversation.
The decision resumes the existing run through the conversation approval API; it does not resend the user’s message. Hosts must keep the same authenticated conversation identity for the decision. Afterward, the run either completes or shows the next approval request.

Session recovery

The widget stores the conversation_id in localStorage. If the backend restarts and no longer knows that conversation, the widget detects it, clears the stale id, and starts a fresh conversation automatically — no action needed from the user.