# Getting started Add paced screen-reader announcements to your existing AI interface. Canonical: https://generativea11y.com/docs/getting-started Markdown: https://generativea11y.com/markdown/docs/getting-started Documentation channel: source checkout (may include unreleased APIs). Repository: https://github.com/bhaveshchow20/generative-a11y Build base revision: f7bcd7cee3f4381b23b5660942666a3dbe12f3e5 (modified checkout: false). Source package manifest versions (not release parity): @generative-a11y/ag-ui@0.3.0, @generative-a11y/ai-sdk@0.2.0, @generative-a11y/assistant-ui@0.2.0, @generative-a11y/core@0.4.0, @generative-a11y/devtools@0.2.1, @generative-a11y/dom@0.3.0, @generative-a11y/react@0.2.0. Compare your installed package version and its release tag before using these examples. Package manifest versions alone do not identify unreleased changes. See https://generativea11y.com/docs/stability. Choose the [integration that matches your app](#choose-an-integration). The React + AI SDK setup below is one starting point; other adapters connect the same runtime to the lifecycle events your framework exposes. ## Start with your existing React + AI SDK app ```shell title="Terminal" npm install @generative-a11y/react @generative-a11y/ai-sdk ``` ```shell title="Terminal" pnpm add @generative-a11y/react @generative-a11y/ai-sdk ``` ```shell title="Terminal" yarn add @generative-a11y/react @generative-a11y/ai-sdk ``` ```shell title="Terminal" bun add @generative-a11y/react @generative-a11y/ai-sdk ``` Use this with an existing React + AI SDK app. Check the [supported versions and peers](/docs/integrations/ai-sdk#compatibility) before installing. Follow the [AI SDK integration guide](/docs/integrations/ai-sdk) to add the provider and hooks to your chat. This adds paced live-region updates for supported lifecycle events without changing the visual UI or moving focus during ordinary streaming. Your host still owns semantic structure, keyboard controls, and accessible content. Retry detection is unavailable in the AI SDK adapter. Browser delivery does not prove what a real screen reader speaks. For React without AI SDK, install `@generative-a11y/react` and supply confirmed lifecycle events from your app. See the [React API](/api/react). For other frameworks, [choose an integration](#choose-an-integration). ## Advanced: custom browser integration Use core and DOM directly when your app owns lifecycle reporting: ```shell title="Terminal" npm install @generative-a11y/core @generative-a11y/dom ``` ### Connect the runtime Create one runtime and connect it to the browser. Send only the new text from each streaming update. Report when the response finishes, fails, or stops. Dispose both resources when the session ends. ```ts title="chat-accessibility.ts" import { createRuntime } from "@generative-a11y/core"; import { bindRuntime } from "@generative-a11y/dom"; const runtime = createRuntime(); const delivery = bindRuntime(runtime); // Send these events from your existing response lifecycle callbacks. runtime.dispatch({ type: "response.started", responseId: "response-1" }); runtime.dispatch({ type: "response.text.delta", responseId: "response-1", delta: "A complete sentence.", }); runtime.dispatch({ type: "response.completed", responseId: "response-1" }); // Call this when the chat is removed, not when a response finishes. export function disposeChat() { delivery.dispose(); runtime.dispose(); } ``` Keep the binding alive across responses. When the chat is removed, dispose browser delivery before the runtime. **Evidence and testing note** generative-a11y can confirm when it adds an announcement to the page. Test with real screen readers to confirm what people hear. ## Choose the package that matches your app Use a framework adapter when your app already uses that framework. For a custom app, send events directly to the core runtime. | Application | Package | What it reports | | --- | --- | --- | | Framework-neutral | @generative-a11y/core + /dom | All standard library events | | React | @generative-a11y/react | Provider, delivery, attention, preferences | | AI SDK useChat | @generative-a11y/react + @generative-a11y/ai-sdk | Streaming, terminals, tools, approvals, citations | | assistant-ui | @generative-a11y/assistant-ui | Messages, tools, approvals, sources | | AG-UI / CopilotKit v2 | @generative-a11y/ag-ui | Protocol text, tools, interrupts | | Development diagnostics | @generative-a11y/devtools | Redacted runtime and DOM delivery traces | | Deterministic tests | @generative-a11y/core/testing | Event recording, replay, and semantic assertions | For adapter setup, see [assistant-ui](/docs/integrations/assistant-ui), [AG-UI](/docs/integrations/ag-ui), or [CopilotKit](/docs/integrations/copilotkit). --- # Choose an integration Choose the adapter and delivery layer that connect your existing AI interface to generative-a11y. Canonical: https://generativea11y.com/docs/integrations Markdown: https://generativea11y.com/markdown/docs/integrations Documentation channel: source checkout (may include unreleased APIs). Repository: https://github.com/bhaveshchow20/generative-a11y Build base revision: f7bcd7cee3f4381b23b5660942666a3dbe12f3e5 (modified checkout: false). Source package manifest versions (not release parity): @generative-a11y/ag-ui@0.3.0, @generative-a11y/ai-sdk@0.2.0, @generative-a11y/assistant-ui@0.2.0, @generative-a11y/core@0.4.0, @generative-a11y/devtools@0.2.1, @generative-a11y/dom@0.3.0, @generative-a11y/react@0.2.0. Compare your installed package version and its release tag before using these examples. Package manifest versions alone do not identify unreleased changes. See https://generativea11y.com/docs/stability. ## Start with the framework your app uses Choose the guide that matches the public state or callbacks your app exposes. Each guide starts with installation and a minimal integration for your existing UI. | Your app | Guide | Accessibility packages for that example | | --------------------------- | ------------------------------------------------------------- | --------------------------------------- | | Custom JavaScript | [Dispatch your app's events](/docs/integrations/custom) | `core` + `dom` | | React with app-owned events | [Add a provider](/docs/getting-started) | `react` | | AI SDK `useChat` | [Connect chat state and callbacks](/docs/integrations/ai-sdk) | `react` + `ai-sdk` | | assistant-ui thread runtime | [Observe the public thread](/docs/integrations/assistant-ui) | `core` + `dom` + `assistant-ui` | | AG-UI agent | [Subscribe to protocol callbacks](/docs/integrations/ag-ui) | `core` + `dom` + `ag-ui` | | CopilotKit agent | [Connect the v2 agent hook](/docs/integrations/copilotkit) | `react` + `ag-ui` | Package names above use the `@generative-a11y/` prefix. Your app supplies its framework dependencies and backend. Check [compatibility](/docs/compatibility) before installing an adapter into an existing dependency tree. ## Install only the layers you use Core schedules events; DOM delivers them to browser live regions. React's `A11yProvider` owns both. Adapters translate host state into events and borrow the runtime you supply. Install each package your own code imports. Core and DOM are transitive dependencies of the React package, so a provider-based integration does not need to declare them unless it imports them directly. Framework-neutral examples import core and DOM themselves and therefore list both in their install command. Keep one delivery layer per runtime. Adapters preserve the host application's visible UI and do not supply message rendering, composer controls, or focus navigation. ## Check which events the adapter can see | Integration | Confirmed evidence | Limits to check | | ------------------ | -------------------------------------------------------------- | ------------------------------------------------------- | | Custom / React | Events your app dispatches | Your callbacks must confirm each event | | AI SDK | Response text, terminal callbacks, tools, approvals, sources | Retry and regenerate detection unavailable | | assistant-ui | Thread messages, known final states, tools, approvals, sources | Run hierarchy, retry, and connection events unavailable | | AG-UI / CopilotKit | Runs, subagents, text, tools, interrupts | Steps and hierarchy partial; retries unavailable | Adapters do not infer lifecycle from rendered text, elapsed time, or private framework fields. Use [explicit core events](/docs/integrations/custom) when your app has additional evidence, and keep IDs consistent with any adapter sharing that runtime. Each adapter reference describes its evidence levels, including [AG-UI fidelity](/api/ag-ui#fidelity). Browser transcripts verify delivery writes; real assistive-technology testing is still required to establish spoken behavior. --- # Why generative AI needs an accessibility runtime Learn why streaming responses, tool calls, approvals, retries, and failures need more than ordinary chat accessibility patterns. Canonical: https://generativea11y.com/docs/why-generative-a11y Markdown: https://generativea11y.com/markdown/docs/why-generative-a11y Documentation channel: source checkout (may include unreleased APIs). Repository: https://github.com/bhaveshchow20/generative-a11y Build base revision: f7bcd7cee3f4381b23b5660942666a3dbe12f3e5 (modified checkout: false). Source package manifest versions (not release parity): @generative-a11y/ag-ui@0.3.0, @generative-a11y/ai-sdk@0.2.0, @generative-a11y/assistant-ui@0.2.0, @generative-a11y/core@0.4.0, @generative-a11y/devtools@0.2.1, @generative-a11y/dom@0.3.0, @generative-a11y/react@0.2.0. Compare your installed package version and its release tag before using these examples. Package manifest versions alone do not identify unreleased changes. See https://generativea11y.com/docs/stability. ## AI interfaces change after the user acts An accessibility runtime is the behavior layer between confirmed AI lifecycle events and browser delivery. It decides which asynchronous changes deserve an announcement, groups noisy updates into useful units, prioritizes states that need attention, and cancels obsolete work without replacing the application’s visible interface or taking focus from the user. A conventional form usually has a short, predictable transition: submit, validate, and show a result. An AI interface can stream a response for many seconds, start tools, pause for approval, reconnect, retry, and finish long after focus has moved elsewhere. Semantic HTML, keyboard access, visible status, and sensible focus remain required. They do not by themselves decide which asynchronous changes deserve an announcement, how repeated changes should be grouped, or when lower-priority updates should wait. This complements, rather than replaces, the requirement in [WCAG 2.2 status messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) that important changes be programmatically determinable without receiving focus. The application still owns the semantic HTML and interaction design. ## Naive announcements create new barriers Putting a changing transcript in an ARIA live region can announce partial tokens, repeat the growing response, interrupt more important information, or leave stale work queued after a retry. Moving focus for routine streaming and status changes is more disruptive because it changes the user's reading position. * Partial words and token-sized updates are difficult to understand. * Re-announcing the full accumulated response repeats content. * Tool progress can overwhelm the response the user asked for. * Approval and failure states can arrive behind low-priority updates. * Retries can make announcements from an obsolete response misleading. ## Put policy between lifecycle state and browser delivery generative-a11y accepts confirmed lifecycle events from the application or a thin framework adapter. Core segments response text, prioritizes important states, removes duplicates, coalesces updates, bounds queued work, and produces announcement intents. The DOM package then performs browser delivery without altering the visible interface. This boundary keeps framework state, accessibility policy, and DOM behavior independently testable. It also makes fidelity explicit: when an adapter cannot observe a retry or connection event through a documented public API, it reports that limitation instead of guessing. **Evidence and testing note** Deterministic runtime transcripts and DOM tests show what the library prepared or added to the page. They do not prove what a particular screen reader spoke. ## Choose the smallest supported integration Start with the framework-neutral core and DOM packages when your application already owns lifecycle state. Use the React layer for provider and element bindings. Add the AI SDK, assistant-ui, or AG-UI adapter only when the application uses that framework's documented public lifecycle surface. | Need | Read next | | ---------------------------------------------- | ------------------------------------------------------------------------ | | Install a custom integration | [Getting started](/docs/getting-started) | | Understand streaming announcements | [Screen readers and streaming AI](/docs/screen-readers-and-streaming-ai) | | Choose a framework adapter | [Choose an integration](/docs/integrations) | | Test browser and assistive-technology behavior | [Testing](/docs/testing) | ## Sources and evidence * [WAI-ARIA 1.2 live-region roles and properties](https://www.w3.org/TR/wai-aria/) * [WCAG 2.2: Understanding Status Messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) * [generative-a11y testing boundaries](/docs/testing) --- # Accessible streaming AI for screen readers Make streaming AI responses understandable to screen-reader users by announcing meaningful text segments instead of tokens or repeated transcripts. Canonical: https://generativea11y.com/docs/screen-readers-and-streaming-ai Markdown: https://generativea11y.com/markdown/docs/screen-readers-and-streaming-ai Documentation channel: source checkout (may include unreleased APIs). Repository: https://github.com/bhaveshchow20/generative-a11y Build base revision: f7bcd7cee3f4381b23b5660942666a3dbe12f3e5 (modified checkout: false). Source package manifest versions (not release parity): @generative-a11y/ag-ui@0.3.0, @generative-a11y/ai-sdk@0.2.0, @generative-a11y/assistant-ui@0.2.0, @generative-a11y/core@0.4.0, @generative-a11y/devtools@0.2.1, @generative-a11y/dom@0.3.0, @generative-a11y/react@0.2.0. Compare your installed package version and its release tag before using these examples. Package manifest versions alone do not identify unreleased changes. See https://generativea11y.com/docs/stability. ## A visual stream and an audible stream need different pacing Token-by-token streaming is difficult for screen readers because each visual update can become a separate accessibility-tree change. Partial words, repeated accumulated text, and a long queue of low-value changes make the audible stream hard to follow. A better pattern keeps the visible transcript current while announcing only confirmed, meaningful phrases and lifecycle boundaries. The visible response should still update normally. The accessible announcement stream is a separate representation of the same confirmed lifecycle, optimized for useful listening rather than visual immediacy. [WAI-ARIA defines live-region semantics](https://www.w3.org/TR/wai-aria/), but those semantics are hints to user agents; they do not segment generative text or model response, retry, and tool lifecycles. That policy belongs in application logic or an accessibility runtime. ## Avoid announcing the growing transcript This pattern makes the live region contain the entire accumulated response after every token. Depending on the browser and assistive technology, users may hear fragments, repeated content, or inconsistent results. ```tsx title="Avoid: live region around accumulated text" function StreamingMessage({ text }: { text: string }) { return
{text}
; } ``` ## Send append-only deltas and an explicit terminal event Dispatch response.started once, send only newly arrived text in response.text.delta, and finish with the terminal event the application actually observed. Core buffers partial text and emits meaningful segments according to the selected policy. ```typescript title="Dispatch confirmed response events" runtime.dispatch({ type: "response.started", responseId: "r1" }); runtime.dispatch({ type: "response.text.delta", responseId: "r1", delta: "The migration completed successfully. ", }); runtime.dispatch({ type: "response.completed", responseId: "r1" }); ``` ## Expected behavior and test boundaries With the balanced policy, complete phrases can be announced without waiting for every token or repeating earlier text. Higher-priority failures and approval requests can take precedence over routine progress. Ordinary streaming never moves focus. Use deterministic tests to verify events, announcement intents, queue bounds, and DOM delivery. Then test the integrated application with representative browser and screen-reader combinations because spoken output is controlled by software outside the library. ## Sources and evidence * [WAI-ARIA 1.2 live-region roles and properties](https://www.w3.org/TR/wai-aria/) * [WCAG 2.2: Understanding Status Messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) * [Manual assistive-technology test plan](/docs/testing) --- # ARIA live regions for generative AI Understand what ARIA live regions provide, why streaming tokens are a poor announcement unit, and how generative-a11y separates policy from delivery. Canonical: https://generativea11y.com/docs/aria-live-and-generative-ai Markdown: https://generativea11y.com/markdown/docs/aria-live-and-generative-ai Documentation channel: source checkout (may include unreleased APIs). Repository: https://github.com/bhaveshchow20/generative-a11y Build base revision: f7bcd7cee3f4381b23b5660942666a3dbe12f3e5 (modified checkout: false). Source package manifest versions (not release parity): @generative-a11y/ag-ui@0.3.0, @generative-a11y/ai-sdk@0.2.0, @generative-a11y/assistant-ui@0.2.0, @generative-a11y/core@0.4.0, @generative-a11y/devtools@0.2.1, @generative-a11y/dom@0.3.0, @generative-a11y/react@0.2.0. Compare your installed package version and its release tag before using these examples. Package manifest versions alone do not identify unreleased changes. See https://generativea11y.com/docs/stability. ## Live regions expose changes without moving focus An ARIA live region marks dynamic content so user agents can present changes to assistive technology while keyboard focus stays where the user placed it. The `polite` and `assertive` values communicate urgency, while `aria-atomic` and `aria-relevant` describe which portion of a change is relevant. These semantics support delivery; they do not decide whether every generated token is useful. Use `polite` for routine updates and reserve `assertive` for information that warrants interruption. Browser and assistive-technology behavior determines when those updates are presented. The normative behavior and supported values come from [WAI-ARIA 1.2](https://www.w3.org/TR/wai-aria/). WCAG’s [status-message guidance](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) also emphasizes informing users about important changes without unnecessarily moving focus or interrupting their work. A live region is a delivery mechanism, not an announcement policy. It does not know whether a token is meaningful, whether a repeated update is obsolete, or whether a tool failure should outrank routine progress. ## Do not use each token as a live-region update Generative output changes far more frequently than ordinary status text. Sending every token can create partial-word announcements and a backlog of low-value mutations. Replacing the live region with the entire accumulated response can instead repeat content or produce inconsistent results across browser and screen-reader combinations. * Keep the visible transcript semantic and readable independently of announcements. * Choose meaningful phrases or sentences as announcement units. * Use assertive delivery sparingly for confirmed urgent states. * Cancel queued work when a response fails, stops, retries, or the runtime is disposed. ## generative-a11y separates scheduling from live-region delivery The core package turns lifecycle events into polite or assertive announcement intents after segmentation, prioritization, deduplication, and scheduling. The DOM package owns stable polite and assertive regions, replaces their text for live-region delivery, and can use the emerging ariaNotify API when the browser exposes it in the configured mode. The application still owns its visible messages, controls, headings, forms, error relationships, keyboard interactions, and focus behavior. The library's live regions are not a substitute for those fundamentals. **Evidence and testing note** Browser delivery confirms a DOM action, not audible output. Validate the complete experience with real assistive technology. ## Use ordinary semantics for stable content Do not announce information merely because it rendered. Stable assistant messages should remain ordinary document content that users can navigate. Use lifecycle announcements for changes that would otherwise be easy to miss: a response becoming available, a tool changing state, approval becoming required, a connection being lost, or work ending in failure. ## Sources and evidence * [WAI-ARIA 1.2](https://www.w3.org/TR/wai-aria/) * [WCAG 2.2: Understanding Status Messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) * [ARIA live-region implementation guidance](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Guides/Live_regions) --- # Accessible AI agents and tool execution Design screen-reader announcements for AI agent progress, tool calls, approvals, interruptions, failures, retries, and results. Canonical: https://generativea11y.com/docs/accessible-ai-agents Markdown: https://generativea11y.com/markdown/docs/accessible-ai-agents Documentation channel: source checkout (may include unreleased APIs). Repository: https://github.com/bhaveshchow20/generative-a11y Build base revision: f7bcd7cee3f4381b23b5660942666a3dbe12f3e5 (modified checkout: false). Source package manifest versions (not release parity): @generative-a11y/ag-ui@0.3.0, @generative-a11y/ai-sdk@0.2.0, @generative-a11y/assistant-ui@0.2.0, @generative-a11y/core@0.4.0, @generative-a11y/devtools@0.2.1, @generative-a11y/dom@0.3.0, @generative-a11y/react@0.2.0. Compare your installed package version and its release tag before using these examples. Package manifest versions alone do not identify unreleased changes. See https://generativea11y.com/docs/stability. ## Agent interfaces have more states than a chat transcript An agent can start a long-running tool, report progress, request a decision, lose its connection, retry, and finish with a result. Visual indicators may make these transitions obvious, while a screen-reader user remains on the composer, transcript, or another part of the page. Accessibility depends on communicating consequential state changes without narrating every internal operation. Announcements should describe the user-facing lifecycle, not expose raw tool payloads, backend errors, or chain-of-thought-like implementation detail. ## Map confirmed agent state to normalized events Choose events from confirmed application state. Tool argument streaming does not establish that execution started; a disappearing approval control does not establish that a decision was submitted. Keep stable IDs across each operation and attach an instance ID when work can retry. | Agent state | Normalized event | Announcement purpose | | -------------------- | -------------------------- | ------------------------------------------------- | | Tool begins | tool.started | Set context for a user-relevant operation | | Meaningful milestone | tool.progress | Report progress without flooding | | Approval needed | interaction.requested | Make a required decision discoverable | | Tool fails | tool.failed | Communicate the safe user-facing failure label | | Response retries | response.retrying | Cancel stale response work and identify the retry | | Connection changes | connection.lost / restored | Report confirmed availability changes | ## Prioritize decisions and failures without stealing focus An AI agent approval request should be announced as a confirmed request for input, while the approval control remains part of the host application’s normal keyboard and focus model. Routine progress can stay polite; required decisions and safe failure labels can receive higher priority. The event stream must keep each update attached to a stable response, tool, or approval identity so stale work can be cancelled after retries and interruptions. If an approval control needs focus, the host application makes that interaction decision through its accessible dialog, disclosure, or inline workflow. See [interactions and approvals](/docs/lifecycle/interactions) for the event contract. Bounded queues and terminal-event cleanup prevent outdated progress from being delivered after a retry, failure, interruption, or disposal. ## Choose an adapter by observable lifecycle fidelity The AI SDK, assistant-ui, and AG-UI adapters translate documented public framework state into the normalized event model. Their pages list what they can observe. When the host application knows about additional connection, retry, or approval states, it can dispatch those core events directly instead of asking an adapter to infer them from rendered UI. ## Sources and evidence * [WCAG 2.2: Understanding Status Messages](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html) * [WAI-ARIA 1.2](https://www.w3.org/TR/wai-aria/) * [generative-a11y architecture and evidence boundaries](/docs/architecture) --- # Accessibility model and architecture Follow an AI lifecycle event through the framework-independent runtime, scheduling policy, and DOM delivery that produce paced screen-reader updates. Canonical: https://generativea11y.com/docs/architecture Markdown: https://generativea11y.com/markdown/docs/architecture Documentation channel: source checkout (may include unreleased APIs). Repository: https://github.com/bhaveshchow20/generative-a11y Build base revision: f7bcd7cee3f4381b23b5660942666a3dbe12f3e5 (modified checkout: false). Source package manifest versions (not release parity): @generative-a11y/ag-ui@0.3.0, @generative-a11y/ai-sdk@0.2.0, @generative-a11y/assistant-ui@0.2.0, @generative-a11y/core@0.4.0, @generative-a11y/devtools@0.2.1, @generative-a11y/dom@0.3.0, @generative-a11y/react@0.2.0. Compare your installed package version and its release tag before using these examples. Package manifest versions alone do not identify unreleased changes. See https://generativea11y.com/docs/stability. ## From an app event to a screen-reader update AI framework → standard events → core runtime → browser delivery → screen reader. An adapter translates documented framework state into normalized events. Core segments text, removes repeats, and schedules announcement intents. DOM delivers those intents through browser APIs without changing your visible interface. | Layer | Owns | Integration boundary | | ---------------- | ----------------------------------------------- | ------------------------------------------------------- | | Host application | Visible content, controls, lifecycle evidence | Reports confirmed state and keeps content readable | | Adapter | Framework-to-event translation | Uses public state; declares missing evidence | | Core runtime | Text segmentation, policy, queues, cancellation | Emits announcement intents without browser dependencies | | DOM delivery | Live regions and browser notification calls | Reports browser delivery results | | React bindings | Provider lifetime and host element refs | Connects existing elements to runtime and DOM behavior | ### The standard event vocabulary Everything the runtime understands is expressed as a small set of typed, serializable events. Adapters translate framework-specific state into these events; the host app can also dispatch them directly. The categories are: * **Response events**: `response.started`, `response.text.delta`, `response.completed`, `response.interrupted`, `response.failed`, and `response.retrying`. These describe one assistant response from start to a terminal state. * **Tool events**: `tool.started`, `tool.progress`, `tool.completed`, and `tool.failed`. These describe tool calls the assistant makes on the way to an answer. * **Run and step events**: `run.started`, `run.completed`, `run.failed`, `run.interrupted`, `run.retrying`, and the matching `step.*` events. These describe agent workflows with explicit ownership: a stable logical run identity, plus an optional instance identity for each attempt, and the same for steps. * **Interaction and approval events**: `interaction.requested`, `interaction.resolved`, `approval.requested`, and `approval.resolved`. These describe moments where the app needs the user to decide something. * **Connection events**: `connection.lost` and `connection.restored`. * **Citations**: `citation.available`, for source references the app chooses to surface. * **Attention events**: `attention.changed` and `attention.override`, which feed the attention model described below. Every event carries a stable identity, such as a response id, tool id, or run id, plus optional instance ids that distinguish retries and replays. The runtime uses these identities to deduplicate and cancel correctly, so a retried response does not produce duplicate announcements. Because the events are serializable, they can be recorded, replayed, and asserted in deterministic tests. ### Package map The monorepo is organized so that each package owns one responsibility. Dependencies point in one direction: adapters and bindings depend on core, never the other way around. | Package | Responsibility | Key sources | | ------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | `@generative-a11y/core` | Framework-independent runtime: events, policy, segmentation, scheduling | `runtime.ts`, `scheduler.ts`, `policy.ts`, `segmenter.ts`, `messages.ts`, `attention.ts`, `clock.ts`, `recorder.ts`, `testing.ts`, `types.ts` | | `@generative-a11y/dom` | Browser delivery: live regions, focus utilities, preferences, attention binding | `index.ts` (`bindRuntime`), `focus.ts`, `composed-tree.ts`, `preferences.ts`, `attention-binding.ts` | | `@generative-a11y/react` | React bindings: provider lifetime, hooks, attention control | `index.tsx` | | `@generative-a11y/ai-sdk` | Adapter translating AI SDK `useChat` state into standard events | `react.tsx`, `index.ts` | | `@generative-a11y/assistant-ui` | Adapter translating assistant-ui lifecycle into standard events | `index.ts` | | `@generative-a11y/ag-ui` | Adapter translating the AG-UI protocol into standard events | `index.ts` | | `@generative-a11y/devtools` | Development diagnostics: redacted runtime and DOM delivery traces | `overlay.ts`, `inspector.tsx`, `store.ts` | Core has no browser dependencies at all: it never touches the DOM, timers run through an injected clock, and it emits plain announcement intents. DOM is independent of React and AI frameworks. Adapters are thin: they read documented public framework state and emit events. When a framework does not expose reliable evidence, the adapter declares reduced fidelity rather than guessing, as documented in [limitations](/docs/limitations). ### The runtime pipeline One dispatch travels through the runtime in stages: 1. **Dispatch.** The host or adapter calls `runtime.dispatch(event)` with a standard event. The runtime updates its internal model of active responses, tools, runs, and steps. 2. **Policy resolution.** The announcement policy decides what becomes an announcement. Policies are presets you can override: `minimal`, `balanced`, `verbose`, and `completion-only`. The text strategy selects the granularity: `silent`, `sentence`, `paragraph`, or `completion`. For example, the balanced preset announces text at sentence boundaries with a minimum of 24 characters and a maximum delay of 2,500 ms, announces tool starts after 1,500 ms, and announces completions, failures, interruptions, and retries. 3. **Segmentation and dedupe.** Streaming text is normalized and segmented into speakable units. Repeats within a dedupe window are removed, so a re-sent chunk does not get announced twice. 4. **Scheduling.** Intents are queued and paced: a minimum gap separates announcements, and the queue is bounded (200 intents) so a flood of events cannot grow memory without limit. Time is injected through a `SystemClock` abstraction, which is why tests can drive the scheduler deterministically with a manual clock. 5. **Intent emission.** The runtime emits announcement intents with a channel (`polite` or `assertive`) and a purpose (`response-text`, `routine-status`, or `notice`). Errors and failures use the assertive channel. Timers and subscriptions are owned resources: every timer the runtime creates is cancelled on terminal events and on `dispose()`. Queues and tracked identities stay bounded. These are not optimizations; they are correctness rules, because a leaked timer in an accessibility layer can announce stale text long after the user moved on. ### Browser delivery `bindRuntime(runtime)` from `@generative-a11y/dom` connects the runtime to the page. It subscribes to announcement intents and writes them through live regions and browser notification calls, without changing the visible interface. Each delivery reports a result, so the host can observe what was added to the page, while remembering the honesty rule: delivery confirmation is not proof of speech. Dispose in the right order: dispose browser delivery before the runtime, and keep the binding alive across responses. Streaming and status changes never move focus; focus utilities exist only for the cases where the host explicitly manages focus, such as dialogs the host itself opens. ### Attention and preferences The attention model keeps announcements appropriate to what the runtime can conservatively observe. The observed modes are `foreground`, `background`, `reading-history`, `away`, and `unknown`; the labels are deliberately conservative and never claim to prove reading or intent. An explicit override, `auto`, `normal`, or `quiet`, lets the host or the user take precedence over observed evidence. The effective state is either `normal` or `quiet`, and policies can quiet routine announcements when the user is away or in the background. Preferences follow the same principle: the host reports what the user chose, and the runtime honors it. Preference handling stays in the DOM layer, where browser storage and settings live, and is translated into core configuration rather than read directly by the runtime. ### Diagnostics without surveillance The runtime emits diagnostics alongside intents: what was prepared, when, and under which policy. The devtools package renders these as redacted traces, so developers can see the event-to-announcement pipeline without leaking message content or user data into logs. The same diagnostics power the recorder and replay fixtures used in tests. Diagnostics describe the library's own behavior. They are evidence about what the code did, not about what any person heard. Keep that boundary in every dashboard, log line, and test report. ## Report only what the app knows generative-a11y turns confirmed app events into screen-reader updates. It records each update added to the page. Test with real screen readers to confirm what they speak. * Core does not use the DOM. * Adapters do not run framework actions or control your interface. * Streaming and status changes do not move focus. * generative-a11y does not copy backend errors or tool results into announcements. The last point deserves emphasis: when a response fails or a tool errors, the announcement is a curated status message from the announcement catalog, not a paste of the backend error or tool result. Raw errors can contain secrets, stack traces, or confusing internals; the catalog keeps announcements safe, localizable, and honest about what is actually known. ### Messages and localization Announcement wording lives in a message catalog, not inline in the runtime. Each message has a key, parameters, and an optional locale, and `formatAnnouncement` renders the final text. Keeping wording in one place has three benefits: announcements stay consistent across events, they can be translated without touching scheduling logic, and failure messages can be curated rather than copied from backend errors. The catalog never invents information. A tool failure announcement says a tool failed; it does not include the tool's raw output. A retry announcement says a retry is happening; it does not speculate about why. This restraint is what makes the announcements safe to speak aloud in the first place. ### Example: one streaming chat turn Concretely, here is what happens when an assistant streams a two-sentence reply in a React + AI SDK app: 1. The AI SDK adapter observes the framework's public streaming state and dispatches `response.started` with a stable response id. 2. As text chunks arrive, the adapter dispatches `response.text.delta` events carrying only the new text. The runtime buffers the text and, under the balanced preset, waits for a sentence boundary with at least 24 characters before preparing an intent. 3. The scheduler emits a polite intent for the first sentence and queues the second behind the minimum gap. If the same chunk arrives twice, the dedupe window removes the repeat. 4. DOM delivery writes each intent into the live region and reports the delivery result. Focus never moves. 5. When the framework reports the stream finished, the adapter dispatches `response.completed`, and the policy prepares a completion announcement. If the user interrupts instead, `response.interrupted` cancels the pending queue first, so stale text is never announced after the fact. At every stage the library can confirm what its own layer did: which events arrived, which intents were prepared, and which updates reached the page. What the screen reader spoke remains a question for manual testing. --- # Attention-aware announcements Opt into attention policy and add host-owned Auto, Normal, and Quiet controls to an existing React interface. Canonical: https://generativea11y.com/docs/attention-aware-announcements Markdown: https://generativea11y.com/markdown/docs/attention-aware-announcements Documentation channel: source checkout (may include unreleased APIs). Repository: https://github.com/bhaveshchow20/generative-a11y Build base revision: f7bcd7cee3f4381b23b5660942666a3dbe12f3e5 (modified checkout: false). Source package manifest versions (not release parity): @generative-a11y/ag-ui@0.3.0, @generative-a11y/ai-sdk@0.2.0, @generative-a11y/assistant-ui@0.2.0, @generative-a11y/core@0.4.0, @generative-a11y/devtools@0.2.1, @generative-a11y/dom@0.3.0, @generative-a11y/react@0.2.0. Compare your installed package version and its release tag before using these examples. Package manifest versions alone do not identify unreleased changes. See https://generativea11y.com/docs/stability. ## Opt in at both layers Core attention filtering is disabled by default. Set `policy.attention.enabled: true` to enable it. Its default `quietWhen` is `["background"]`; add `"reading-history"` or `"away"` only when appropriate for your host interface. The React provider's separate `attentionPolicy` prop opts into forwarding browser observations to the runtime. It does not enable core filtering by itself. A runtime supplied through `runtime` must already have its policy configured; provider policy props do not reconfigure a borrowed runtime. The provider renders no visible controls. Connect your existing interface, then add an optional quiet toggle. With core attention disabled, the effective mode remains normal. ## Enable attention policy Follow the [React setup](/api/react), then import `A11yProvider` from `@generative-a11y/react` and wrap your existing interface. Keep the default system clock for production. ```tsx title="Provider configuration" ``` ## Connect your existing elements In your client module, import `useAttentionRefs` from `@generative-a11y/react`. Call it inside a component under the provider to obtain callback refs for the composer, conversation, and newest response. Attach those refs to your existing elements to observe focus and visibility; keep your content and styling. ```tsx title="Conversation element bindings" const { composerRef, conversationRef, newestResponseRef } = useAttentionRefs(); return ( <>
{response}