Open ended Generative UI example - #823
Merged
Merged
Conversation
Aditya-thesys
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new example,
examples/html-artifact, demonstrating open-ended generative UI with OpenUI: the model can generate a complete, self-contained HTML/CSS/JavaScript experience as the props of a single OpenUI component, rendered in a sandboxed iframe.This is the "Open-Ended component inside a Declarative catalog" pattern from the State of Generative UI report: the model chats normally with markdown and emits an
HtmlArtifactonly when the user asks it to build something interactive (an app, game, simulation, or visualization). The artifact streams its raw source into a detailed-view panel on the right and switches to a rendered sandboxed iframe when the stream completes — using the existing assistant response stream, with no extra endpoint or tool call.Changes
examples/html-artifact— new Next.js example (derived fromopenui-chat) with:HtmlArtifactcomponent: compact inline preview, plus aDetailedViewPanelwith Raw/Rendered tabs that auto-switches to Rendered (sandboxediframe srcDoc) when streaming completes.Responseroot,Markdown,HtmlArtifact) so emitting an artifact is a per-reply choice the model makes, not the only output shape./api/chatroute (no tools) and a checked-in generated system prompt.packages/react-ui— exportDetailedViewPanel/DetailedViewPortalTarget(and their prop types) from the package index so custom components can target the AgentInterface detailed view. No other library changes.docs/agent/guides/open-ended-html, cross-linked from the Generative UI core-concepts page, the generative UI report blog post, anddocs/public/AGENTS.md.skills/openui/references/open-ended-html.mdreference with a routing rule inSKILL.md, including an explicit warning not to make the artifact the library root.Test Plan
Ran the example end-to-end: plain messages (e.g. "hi") get a normal markdown reply; "build a sorting visualizer"-style prompts stream an
HtmlArtifactwith raw source in the panel, then render the completed document in the sandboxed iframe. Regenerated the checked-in system prompt viapnpm generate:prompt(which also validates the library through the CLI bundler). Lint and build pass for the example and