Framework-free Web Components over the AG-UI protocol. Drop
<ag-ui-chat> into any page, SPA or MPA, any framework or none, point it at an AG-UI
endpoint, and you get a streaming chat sidebar that can call tools you register in the
browser. It wraps @ag-ui/client's
HttpAgent; no framework, no Django, no admin specifics live here.
Documentation: https://artui.github.io/agents-web-components/
npm install @artooi/agents-web-componentsBundle it yourself from the bare entries, or vendor the self-contained
@artooi/agents-web-components/bundle file with no build step. The entries and the
vendored-bundle story are in Install.
<script type="module">
import { X_DESTRUCTIVE_KEY, clickElement } from "@artooi/agents-web-components";
import { defineChat } from "@artooi/agents-web-components/chat";
// Register <ag-ui-chat>. An explicit call: importing the package defines nothing.
defineChat();
const chat = document.querySelector("ag-ui-chat");
chat.registerTool({
name: "save_article",
description: "Save the article. Destructive, asks for confirmation.",
parameters: { type: "object", properties: {}, [X_DESTRUCTIVE_KEY]: true },
handler: async () => {
await clickElement(document.getElementById("save"));
return "saved";
},
});
</script>
<ag-ui-chat endpoint="/agent/" title-text="Assistant"></ag-ui-chat>Important
If nothing appears, check that defineChat() ran. Forgetting it looks
like nothing at all. <ag-ui-chat> is then an unknown element, which every
browser renders as an inline 0x0 box, in flow, with no console warning and no
error, so the page looks finished and the chat is simply absent.
customElements.get("ag-ui-chat") in a console answers it in one line.
undefined means the call did not run.
The full walkthrough, with headers, attributes and sending from your own UI, is the Quickstart. A cross-origin API needs Authenticating requests.
<ag-ui-chat>(./chat): the chat panel, its transcript, composer, tools and inline confirmation. Core concepts.<ag-ui-threads>(./threads): a chat's conversation list, as rows or pills in your own chrome. The conversation list.<ag-ui-agents>(root entry): a headless provider that puts one chat in front of several agents. Agents.<ag-ui-inbox>(./inbox): what waits on the user across agents, as a navbar badge or a list. The inbox.<ag-ui-routines>(./routines): the routines editor on a page, rail or dialog of its own, with pluggable time and timezone fields. The editors.<ag-ui-skills>(./skills): the stored-skill editor as an element of its own. The editors.data-editors="external"on the chat hands its editor buttons to these two elements.
- Authenticating requests: headers (a sync or async
getHeaders), cookies, trusted origins. - Core concepts: the run loop, stopping, tools, confirmation, DOM drivers.
- Header, collapse and resizing: the header, launcher, bottom bar, resizing.
- Messages: markdown, follow-ups, timestamps, message actions, quoting.
- Tool calls and sub-agents: display modes, delegation, editing a gated call.
- What the server draws: charts, custom renderers, A2UI, MCP Apps.
- Skills and run notices: prompt chips, the slash palette, the skill editor, routines and their time fields.
- The editors on a page of their own:
<ag-ui-routines>,<ag-ui-skills>, binding, requests,ag-ui-open-editor. - File uploads: attachments and pasting.
- Host seams: the SPA route map, page state, the page-map walker, the place chip.
- Durability and resuming: surviving full page reloads, resuming a run.
- Theming, density and placement: themes, tokens, parts, slots, placement.
- Internationalization: the UI strings table.
- Public API surface: every export, by area.
- Building and compatibility: the build outputs and the supported versions.
- Moving from
@artooi/ag-ui-web-component.
make init, make test (100% coverage gate), make lint, make build, make demo
(every feature in a scenario on port 5173) and make docs (the site, strict).
CHANGELOG.
MIT © Artur Veres