# XWUIAgentThread

AG-UI-driven agent conversation with streaming, tool calls, reasoning, citations, branching and HITL confirmations. Default autonomy is `suggest`. Model text is untrusted and never written into `html`.

## Basic Usage

Empty thread with a composer. Sending emits `send` from the headless core.

```example
file: examples/BasicUsage.ts
html: examples/BasicUsage.html
title: Basic Usage
description: Empty agent thread with composer and visible autonomy mode.
```

## Streaming Run

Host ingests TEXT_MESSAGE_* events; tokens append as text.

```example
file: examples/StreamingRun.ts
html: examples/StreamingRun.html
title: Streaming Run
description: Assistant message streams in from AG-UI text events.
```

## Tool Call HITL

A tool result is queued as a diff for accept/decline.

```example
file: examples/ToolCallHitl.ts
html: examples/ToolCallHitl.html
title: Tool Call HITL
description: Tool call waits for human approval at autonomy suggest.
```

## Branches And Citations

Switch branches and show inline citations composed from the BASIC primitive.

```example
file: examples/BranchesCitations.ts
html: examples/BranchesCitations.html
title: Branches And Citations
description: Branch switcher plus untrusted citation cards.
```

```api
```
