class RubyLLM::AgUI::Run

Runs one RubyLLM 2.x chat turn as one AG-UI 1.0 run.

input = RubyLLM::AgUI::Input.parse(request_body)
chat  = host_chat_for(actor, input.thread_id)   # host-owned RubyLLM::Chat
RubyLLM::AgUI::Run.new(chat:, input:, scope: "tenant:#{actor.id}").stream(to: response.stream)

The host owns authentication, authorization, the chat, the tools a run may use and the transport. This class owns the run’s identity (reserved before any provider work), the ordering of the events, and the outcome: a cancelled run is never reported as success, a provider failure is a sanitized RUN_ERROR, a paused run is an interrupt rather than a success, and an identity that is already reserved is never executed a second time.

scope is the host’s tenant/actor boundary, built from authenticated identity. The gem takes it from the host rather than deriving it from the input, because a scope derived from anything the client sent would let one client attach to another’s run.