# Class LittleGhost::AGUI::Adapter

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/AGUI/Adapter.html

Adapter turns a LittleGhost stream into AG-UI event hashes. It lets a Ruby
agent drive compatible chat interfaces without changing the agent itself.

    events = CustomerSupportAgent.stream_ask("Where is my order?")
    adapter = LittleGhost::AGUI::Adapter.new
    adapter.stream(events, thread_id: "thread-1", run_id: "run-1").each do |event|
      websocket.write(JSON.generate(event))
    end

The adapter has no state between #stream calls, so one instance can translate
independent runs.

### Choose what the interface receives

Provider plaintext reasoning becomes AG-UI reasoning events. Tool arguments
and results, invocation metadata, subagent events, trace context, and selected
error text also pass through without redaction. Authorize and filter the
complete stream before transport, and send it only to an interface intended to
display that data. Encrypted reasoning and provider continuity artifacts are
never exposed here.

## Inheritance

`LittleGhost::AGUI::Adapter < Object`

## Instance methods

<a id="method-i-stream"></a>
### `#stream`

```ruby
#stream(events, thread_id:, run_id:)
```

Lazily translates `events` for one AG-UI run.
