Skip to content

About

Framework-free <ag-ui-chat> Web Component over the AG-UI protocol.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

@artooi/agents-web-components

CI npm Docs License

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/

Install

npm install @artooi/agents-web-components

Bundle 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.

Quick start

<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.

The elements

  • <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.

Topics

Development

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.

License

MIT © Artur Veres

About

Framework-free <ag-ui-chat> Web Component over the AG-UI protocol.

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages