Move <ui_state> snapshot injection out of respond_with_llm into a cross-cutting on_before_process_frame handler on the UIWorker's LLM, so it appends the current snapshot to the context the request is built from, just before each inference. Injection is gated to the user-turn-initiating inference so a tool-calling turn never stacks duplicate <ui_state> blocks; respond_with_llm no longer injects manually. Also drop the bridged parameter from UIWorker: there is no viable way to bridge a UIWorker between workers — a shared, teed context would be polluted by the injection, and per-worker turn detection off teed frames isn't supported. Other workers keep their PipelineWorker bridging.
1.2 KiB
-
Added
pipecat.workers.ui.UIWorker, anLLMContextWorkerthat observes and drives a client GUI over the RTVI UI channel: it stores live accessibility snapshots, auto-injects<ui_state>into the LLM context before every inference (via the LLM'son_before_process_framehook), dispatches client events to@on_ui_eventhandlers, and sends UI commands (scroll_to,highlight,select_text,click,set_input_value) back to the client. The optionalReplyToolMixinexposes a bundledreplytool, anduser_job_group(...)surfaces fan-out work to the client as cancellable task cards. A native RTVI⇄bus UI bridge is built intoPipelineWorker(active whenever RTVI is enabled), so no decorator or manual wiring is needed: inbound UI messages are broadcast on the bus asBusUIEventMessage, and outboundBusUICommandMessage/BusUITask*carriers are translated into RTVI frames for the client. -
UIWorkerauto-injects the UI wire-format guide (UI_STATE_PROMPT_GUIDE) into its LLM's system instruction by default, via aprompt_guideparameter — pass your own string to override the guide, orNoneto disable. Apps no longer need to concatenateUI_STATE_PROMPT_GUIDEinto the LLM'ssystem_instructionby hand.