CopilotKit and A2UI: generative UI tutorial

Learn how CopilotKit, AG-UI and Pydantic AI turn research markdown into dashboards using A2UI JSON and a predefined React component library.

Player not loading? Watch on YouTube

This tutorial explains a research dashboard that lets an AI agent choose a layout and components from pasted markdown. The speaker walks through the architecture and a small portion of the code, showing how prompts guide the selection of components and the data they display.

Pydantic AI runs the backend agent. A2UI describes its component requests as JSON, with identifiers, component names, children and props. AG-UI carries events between the backend and frontend, while CopilotKit connects the agent to the React interface. The backend prompt and frontend component definitions share a contract so the interface can render the agent's choices.

The speaker distinguishes static interfaces, where an agent supplies data, from declarative interfaces that let it select predefined components. He also discusses open-ended generation of HTML, CSS or JSX, raising security and performance concerns about arbitrary generated content. His example uses the declarative approach to limit the agent's choices.

The demo reports generation progress but waits for the complete dashboard before displaying it. Streaming individual components is described as a possibility, not an implemented feature. The speaker acknowledges imperfect spacing and presents the project as a demonstration. The walkthrough does not establish local model execution or offline support.