@generative-a11y/ag-ui
Turn public AG-UI callbacks into runtime events.
Connect your runtime
Pass your existing agent and core runtime. The binding observes public state
and callbacks; your app owns execution and browser delivery.
import { bindAgent } from "@generative-a11y/ag-ui";
const binding = bindAgent({ runtime, scopeId: "research-agent", agent });
// Call binding.dispose() when the owning scope ends.See bindAgent for options and the integration guide for setup and compatibility.
Public exports
AG-UI integration subscribes through agent.subscribe(AgentSubscriber).
| Export | Kind | Purpose |
|---|---|---|
| bindAgent | Function | Create one protocol subscription |
| adapterInfo | Frozen constant | List supported events and limits |
| BindAgentOptions | Interface | Options for the binding |
| AgentBinding | Interface | Cleanup method for the binding |
Events the adapter can report
AG-UI 0.0.59 reports exact run and delegated subagent identity. Step events expose labels but no stable IDs, making step and hierarchy support partial. Replay and reconnection are partial because there is no mandatory persistent cursor; retry support remains unavailable.
AG-UI integration never uses private observables or guesses events missing from the protocol.
Localized announcements
See catalogs and adapter copy for the typed
messages and copy options, language ownership, validation, construction
lifetime, and replay requirements. Existing lifecycle evidence and timing remain
unchanged.
Public declarations: @generative-a11y/ag-ui
All exported values and types for this entry point. Import these names from @generative-a11y/ag-ui; the signatures below are reference material, not a replacement for the ownership and lifecycle guidance above.
adapterInfo — value
declare const adapterInfo: AdapterInfo;AdapterInfo — type
interface AdapterInfo {
readonly name: "ag-ui";
readonly fidelity: Readonly<Omit<AdapterFidelity, "optionalEvents">> & {
readonly optionalEvents: readonly NonNullable<AdapterFidelity["optionalEvents"]>[number][];
};
readonly observation: "agent.subscribe(AgentSubscriber)";
readonly saturation: "suppress-after-capacity";
}AgentBinding — type
interface AgentBinding {
dispose(): void;
}AgentSource — type
type AgentSource = Pick<AbstractAgent, "subscribe">;bindAgent — value
/**
* Subscribes through AG-UI's documented AgentSubscriber callbacks. It does not
* subscribe to the replay-prone protocol observable or own agent/core lifetimes.
*/
declare function bindAgent(options: BindAgentOptions): AgentBinding;BindAgentOptions — type
interface BindAgentOptions {
/** Host-owned localized copy, captured and validated at construction. */
readonly copy?: AdapterCopy;
readonly runtime: Pick<Runtime, "dispatch">;
readonly scopeId: string;
readonly agent: AgentSource;
readonly maxTrackedEntities?: number;
}