Generative UI Workspace š
January 13, 2026 Ā· View on GitHub
PROJECT OVERVIEW - ModifyMe Consulting Agent Workspaces UPDATED: 01/01/2025
Here is a high-level concept of what I want to achieve (please note - some key conceptual changes have been made to this plan, please ensure the Project Overview below is only considered as a direction/vision rather than a blueprint
Generative UI Workspace š
Agentic, multi-surface Generative UI for data & workflows ā built on Next.js, CopilotKit, and Material UI.
Build systems that build interfaces.
This workspace is a GenUI R&D and implementation lab: it combines CopilotKitās Generative UI patterns, a Next.js app, and an agentic backend to let AI generate dashboards, tools, and ādisposable UIsā from natural language ā safely, consistently, and with enterprise-grade guardrails.
šÆ What Is This?
A Generative UI workspace for designing, prototyping, and operationalizing AIāgenerated interfaces:
- Next.js + CopilotKit GenUI: Streaming, agentic chat + canvas with server-side orchestration
- Static + Declarative + OpenāEnded GenUI: From safe component routing to sandboxed HTML/JS
- MUIābacked Component Registry: Opinionated library of reusable āmoleculesā for charts, cards & tables
- Sandboxed HTML Canvas: Isolated iframe runtime for openāended UI experiments
- Architecture Blueprints: Deep architectural docs for AGāUI, Chat+, and multi-layer GenUI systems
This workspace is optimized for architecting and validating a GenUI stack, not just demoing a single app. Itās where you:
- Design agent ā UI protocols (AGāUI style)
- Build a component registry that AI can reliably use
- Experiment with safe openāended code generation in a sandbox
- Evaluate UX patterns like Chat+, AI Elements, and Ghost UI
š Documentation & Reference
Core Concepts & Architecture
-
Implementing Generative UI Architecture
Deep dive into GenUI layers: Cognitive, Orchestration, Presentation; Static vs Declarative vs OpenāEnded; AGāUI patterns. -
Generative UI Plan with CopilotKit
Endātoāend implementation plan: Next.js + CopilotKit + MUI, Chat+ canvas, sandboxing, AI Elements, evaluation strategy. -
GenUI Starter Plan (
GenUI_Plan.md)
Highālevel file map and external references:- Generative UI starter app structure
- CopilotKit Generative UI docs
- MUI / Toolpad / CRUD template references
- AgenticGenUI / AI Elements links
CopilotKit Prompts (GenUI āOSā)
Under prompts/copilot/ (from the starter):
01_molecules.mdā defines component vocabulary (cards, stats, tables)02_tools_and_routes.mdā tool calling and backend routing patterns03_canvas_and_state.mdā Chat+ canvas, state sync, agentic updates04_tests.mdā testing + evaluation prompts05_sandboxed_open_ended.mdā safe openāended HTML/JS generation06_refactoring.mdā iterative improvement and refactors
These prompts act as the Cognitive Layer specification ā the instruction āOSā that tells the model how to think about UI, state, tools, and safety.
š Project Structure (Conceptual)
This workspace is anchored around a GenUI starter with a Next.js app, CopilotKit integration, and a small but expressive set of generative components.
genui-starter/
āā README.md
āā app/
ā āā api/
ā ā āā chat/
ā ā āā route.ts # CopilotKit backend / Edge entry for LLM + tools
ā āā canvas/
ā āā GenerativeCanvas.tsx # Chat+ style persistent canvas for GenUI
āā components/
ā āā ai/
ā ā āā StreamingSkeleton.tsx # Generative streaming & AI Elements skeletons
ā āā registry/
ā ā āā StatCard.tsx # MUIāstyle metric cards (Static GenUI molecule)
ā ā āā DataTable.tsx # Data grid / table molecule
ā ā āā ChartCard.tsx # Chart wrapper (e.g., Recharts/Chart.js)
ā āā renderers/
ā ā āā DashboardRenderer.tsx # Declarative schema ā component layout renderer
ā āā sandbox/
ā āā SandboxedHTML.tsx # Iframe sandbox for OpenāEnded GenUI (HTML/JS)
āā lib/
ā āā copilotkit/
ā ā āā hooks.ts # useRenderTool, useCopilotReadable, etc.
ā āā schema/
ā āā dashboard.ts # Declarative dashboard / widget schemas (AGāUI-style)
āā prompts/
āā copilot/
āā 01_molecules.md
āā 02_tools_and_routes.md
āā 03_canvas_and_state.md
āā 04_tests.md
āā 05_sandboxed_open_ended.md
āā 06_refactoring.md
In addition, the broader repo (Ditto190/ag2) includes:
-
Devcontainer for Generative UI:
.devcontainer/generative-ui/devcontainer.jsonā Python 3.11 + Node 20 devcontainer tailored for GenUI + AG2 experiments (Next.js on 3000, FastAPI on 8000, multiāprovider LLM secrets). -
AG2 / Agentic Infrastructure (outside this docās scope) that you can integrate as backends or tools for GenUI.
š§ Architectural Approach
This workspace is built around a Hybrid Generative UI Architecture:
-
Static GenUI (Component Router)
- Safe, productionāgrade UI via a curated component registry (MUIāstyle cards, tables, charts).
- The agent selects components and populates props, not raw DOM.
- Ideal for dashboards, CRUD tools, reporting views.
-
Declarative GenUI (Schema ā Renderer)
- Agent outputs JSON schemas (layouts, widgets, data bindings).
DashboardRenderer+dashboard.tsturn schemas into React trees.- Balances flexibility with control; all layout passes through known primitives.
-
OpenāEnded GenUI (Sandboxed Canvas)
- For prompts that escape the registry / schema (games, fractal explorers, novel visualizations).
- HTML/CSS/JS generated into an isolated iframe (
SandboxedHTML), with:- sandbox + strict CSP
- limited, curated runtime (e.g., React, Tailwind, chart libs) preāloaded
- communication via
postMessagewith a narrow, typed protocol
- High freedom, but contained blast radius.
All three share a common state & event model (AGāUI style), enabling:
- Chatābased negotiation of intent (āChat surfaceā)
- A persistent generative canvas (āChat+ surfaceā)
- Headless hints and suggestions in existing apps (āChatless surfaceā) when integrated into other systems
š§© Key Features
| Area | Feature | Status |
|---|---|---|
| Core GenUI | Agentic chat endpoint (CopilotKit + Next.js API route) | š§Ŗ In progress |
Chat+ canvas (GenerativeCanvas) | š§Ŗ In progress | |
| Component Registry | MUIāstyle StatCard, DataTable, ChartCard | š§Ŗ Prototyping |
| Dashboard schema & renderer | š§Ŗ Prototyping | |
| OpenāEnded UI | Sandboxed HTML iframe with strict isolation | š§Ŗ Design phase |
| Prompting for Tailwindāstyle HTML/JS generation | š§Ŗ Design phase | |
| AI Orchestration | CopilotKit hooks for tools & readable state | ā Patterns defined (see docs) |
| AGāUI style event & state synchronization | š§Ŗ Design / spec phase | |
| UX / AI Elements | Streaming skeletons for generative slots | š§Ŗ Prototyping (StreamingSkeleton.tsx) |
| Ghost UI, suggestion chips for next actions | š§Ŗ Planned | |
| Evaluation | PAGENāstyle GenUI benchmark prompts | š§Ŗ Planned |
| Human / LLMājudge ELO scoring | š§Ŗ Planned |
š Quick Start (Conceptual)
Exact commands will depend on how you instantiate
genui-starter/, but the flow is:
-
Open Devcontainer (Optional but Recommended)
Use.devcontainer/generative-ui/devcontainer.jsoninDitto190/ag2to get:- Node 20
- VS Code extensions for TS/React/Tailwind
- Autoāforwarded ports: 3000 (Next.js), 8000 (backend/LLM if needed)
-
Install Frontend Dependencies
# From genui-starter root
pnpm install # or npm/yarn
- Configure LLM / CopilotKit Backend
- Point
app/api/chat/route.tsto your LLM provider(s) and CopilotKit runtime. - Wire in prompts from
prompts/copilot/*.md(molecules, tools, canvas, sandbox).
- Run the Dev Server
pnpm dev
# Next.js app at http://localhost:3000
- Try a GenUI Conversation
- Open the app.
- In chat, ask:
āCreate a sales KPI dashboard with three stat cards and a table of top customers.ā
- Watch the agent:
- Interpret intent
- Call registry tools (StatCard, DataTable)
- Render into chat and/or the
GenerativeCanvas
š Usage Patterns
1. Static GenUI (Component Registry)
Use when you want reliable, branded, testable UI.
- Tools map directly to registry components:
render_stat_cardrender_chart_cardrender_data_table
- Zod schemas + CopilotKit hooks enforce types and prevent hallucinated props.
- Good for:
- KPI dashboards
- CRUD views
- Standard reporting UIs
2. Declarative GenUI (Dashboard Schemas)
Use when you want flexible layouts from structured definitions.
- Agent emits a JSON schema defined in
lib/schema/dashboard.ts, e.g.:
{
"layout": "3-column",
"widgets": [
{ "type": "stat", "title": "MRR", "value": 120000 },
{ "type": "chart", "kind": "line", "metric": "Revenue" },
{ "type": "table", "source": "top_customers" },
],
}
DashboardRenderertranslates this to a MUI Grid of registry components.
3. OpenāEnded GenUI (SandboxedHTML)
Use when the user asks for something outside your registry/schema vocabulary.
-
Examples:
- āBuild a fractal explorer where I can zoom with the mouse wheel.ā
- āMake a small game to teach binary numbers.ā
-
Flow:
- Agent uses openāended HTML/JS generation prompt (see
05_sandboxed_open_ended.md). - Output is rendered inside
SandboxedHTML:- iframe with
sandbox+ CSP - no access to parent window or cookies
- only preāapproved libs available
- iframe with
postMessageused for controlled communication (resize, events, analytics).
- Agent uses openāended HTML/JS generation prompt (see
š Safety, Security & Control
Generative UI has real risks: broken UX, hallucinated data, XSS. This workspace is architected with layered defenses:
- Component Registry: Most UIs are built from audited, testable registry components.
- Schemas & Validation:
- Zod schemas define the contract between agent and UI.
- Invalid tool calls are rejected before rendering.
- Sandboxing:
- All openāended HTML/JS is isolated in an iframe with strict sandbox attributes and CSP.
- Only curated libraries and assets allowed in the sandbox.
- Communication limited to a typed
postMessageprotocol.
- Fact Verification & Metadata (planned):
- Agents instructed to fetch data via tools / RAG, not from stale training data.
- UIs can show āsource metadataā (e.g., URL, query) for critical numbers.
š§± Tech Stack
Frontend & Orchestration
- Next.js (App Router) ā Streaming, server components, edge runtimes.
- React 18+ ā Component model, Suspense, concurrent rendering.
- CopilotKit ā Agent orchestration, generative UI hooks, Chat+ integration.
- TypeScript ā Strong typing across tools, schemas, and components.
- MUI (Material UI) ā Accessible, themeable primitives for the component registry.
- (Optional) Tailwind CSS ā For openāended sandboxed UIs.
Agentic & Backend
- LLMs ā Gemini / OpenAI / Anthropic / others, wired via CopilotKit / AG2 style runtimes.
- Node / Edge Runtime ā For lowālatency orchestration and streaming.
š§ Current Status & Next Steps
ā Established
- Architecture for:
- Static vs Declarative vs OpenāEnded GenUI
- Chat+ surface (chat + canvas)
- Sandbox and security model
- Conceptual component registry design (StatCard, DataTable, ChartCard)
- Prompt sets for molecules, tools, routes, canvas, testing, sandboxing
š§Ŗ In Progress
- Implementing the initial GenUI starter (Next.js app + CopilotKit + registry)
- Wiring prompts into the CopilotKit runtime
- Implementing
StreamingSkeletonand streaming UX patterns
š Planned
-
Registry Expansion
- Add more molecules (filters, multiāstep wizards, timelines)
- Harden DataTable and ChartCard for real datasets
-
State & AGāUI Integration
- Implement
useCopilotReadableacross key components - Define a minimal AGāUI event/state protocol for canvas interactions
- Implement
-
OpenāEnded Engine
- Finalize sandbox runtime (curated libs, CSP, postMessage protocol)
- Add selfāhealing loop for runtime errors in generated code
-
Evaluation & Benchmarks
- Create a domaināspecific PAGENāstyle prompt suite
- Establish GenUI ELO scoring with human / LLM judges
š¤ Why This Workspace?
Traditional UI workspaces are about designing fixed screens.
This workspace is about designing the system that designs the screens.
Use it to:
- Prototype new GenUI patterns (Chat+, Ghost UI, AGāUI)
- Experiment with mixing safe static components and wild openāended canvases
- Build a reusable blueprint that you can transplant into consulting projects, internal tools, or data apps that need āonādemandā interfaces.
Next step:
Open the GenUI starter, wire up the chat route with your LLM, and implement the first endātoāend flow:
āGenerate a threeācard KPI summary and a table for my sample dataset.ā
From there, evolve the registry, schema, and sandbox ā youāre building the Agentic Interface layer for your future apps.