# Generative UI... in Python? — Jeremiah Lowin, Prefect

Jeremiah Lowin, Prefect

[Talk page](https://ai.engineer/talks/Krzs8GeiWTc-generative-ui-in-python) · [Video](https://www.youtube.com/watch?v=Krzs8GeiWTc)

## Generative UI… in Python?

Jeremiah Lowin explains how Prefab turns Python component trees into interactive MCP apps, then uses the same serializable representation to let agents generate interfaces. The useful constraint is a familiar enterprise job: sharing and collecting information through tables, forms, and charts.

### MCP Apps open a human interaction path

[0:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=12s)

An ordinary MCP tool call puts the agent between the user and the server. The user makes a request, the agent chooses a tool, and the server returns its result into the agent’s context window. The agent then decides what to tell the user. Jeremiah Lowin, Prefect’s founder and CEO and the creator of FastMCP, begins with this routing problem: adding business logic to an agent does not by itself give a person an interface to that logic.

MCP Apps add a user-facing path. A tool can deliver an interface made of HTML, CSS, and JavaScript, which the person can click and use. The agent still initiates the experience, but subsequent interactions can communicate with the application’s backend. Booking a restaurant table, choosing an airline seat, or exploring a conference schedule can become an ordinary human interaction rather than a sequence of instructions the model must translate into tool calls.

Lowin also anticipates an extension allowing the agent to interact with the app alongside the user. His hypothetical example is visual chess: the person makes a move, then the agent acts through the same application. That is a proposed direction in this recording; the interfaces developed here focus on giving the human a direct way to act.

### Scope the problem to tables, forms, and charts

[2:59](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=179s)

[**FastMCP**](https://github.com/PrefectHQ/fastmcp) serves a largely Python engineering audience. MCP Apps, meanwhile, run conventional frontend technology. Bridging those worlds creates a tempting but sprawling assignment: reproduce frontend development inside Python. Lowin’s refusal is blunt: “I can’t pretend we’re gonna ship React in Python.”

The way forward begins with what these developers actually do. Enterprise Python engineers often need to share information across an organization or collect it from colleagues. That job supplies a smaller vocabulary:

- **Tables:** Present records that people can inspect.
- **Forms:** Collect structured information.
- **Charts:** Communicate patterns in data.

Fully branded consumer experiences require a different degree of freedom. Restricting the initial problem makes it possible to offer useful interfaces without importing the entire frontend ecosystem into Python.

**Prefab** is the resulting framework. Its introductory card behaves like a familiar frontend example: type a name and the displayed text updates live. The strange part is that Python declares the interface. The nesting makes its structure recognizable even while the language feels out of place.

Prefab makes this manageable by composing existing, well-designed components. The Python author arranges and configures them rather than implementing every browser primitive. The component vocabulary supplies both the capability and the guardrails: it suits structured information work, while arbitrary frontend design remains outside the problem Lowin set out to solve.

### Python describes the tree; JSON makes it portable

[6:22](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=382s)

The Python domain-specific language uses context managers to express containment. Nesting components inside a context manager builds the corresponding nesting in the interface. Each component is a class that the author instantiates and parameterizes, including passing CSS classes for styling. Reading the Python therefore reveals the layout hierarchy.

Reactive variables describe relationships between components. A value can be bound to controls and displayed elsewhere, allowing changes to propagate inside the client without the author writing JavaScript. The framework supplies the browser implementation for those bindings; Python supplies their declaration.

What actually crosses from Python into the browser? The pipeline below separates the authoring language from the representation and renderer. Python builds a declarative UI, that UI is serialized into a JSON protocol, and a React application renders the protocol as the MCP App. React still does the frontend work.

The consequential step is serialization. Once an interface has a portable representation, an agent can generate it, receive it, or modify something a human created. The renderer can consume the same protocol regardless of who authored the interface. Lowin calls the Python DSL an accident discovered afterward: the original question was whether a UI could become serializable data, and the pleasant Python syntax emerged from that design.

From Python composition to a browser interface
The JSON protocol separates interface authorship from React rendering. Humans and agents can work with the representation without building a new frontend for each interface.
- Python DSL — Nested context managers and component instances describe the UI.
- Declarative UI — The composed interface becomes a representation that can be serialized.
- JSON protocol — A portable UI representation that agents can generate, receive, or edit.
- React MCP App — Renders the protocol as an interactive browser interface.
- Python DSL → Declarative UI (Builds)
- Declarative UI → JSON protocol (Serializes)
- JSON protocol → React MCP App (Renders)

### Documentation that runs its own examples

[8:22](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=502s)

The [Prefab documentation](https://prefab.prefect.io) applies another useful constraint: it is entirely rendered in Prefab. The data-table page contains a live table generated from its Python example. An example can be opened in the playground, edited as Python, and watched as the rendered interface changes.

![Recording frame at 551 seconds](https://ai.engineer/api/talk-essay-media/949c42c31f75204e48ea7077b88a2aea675f988dcab080f75d5ee7cd4c1d92ee)

Recording frame at 551 seconds

That creates a tight learning loop. The example is an interface the reader can use; changing its declaration changes the thing being explained. It also exercises the composition model on the documentation itself, beyond a single greeting card.

The team has used Prefab for small interactive data apps and presentations, including a dark theme intended for slides. Those experiments broaden its uses, but MCP servers remain the reason it was built. The next examples move through three increasingly involved integrations: interactive tool results, applications with backends, and agent-generated interfaces.

### A team directory becomes an interactive tool

[9:52](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=592s)

Start with a decorated FastMCP function that returns a Python dictionary. Its information goes to the agent. The first integration changes the function’s return value to a Prefab data-table component. FastMCP detects the component and prepares the MCP App machinery: the renderer, HTML, JavaScript, and CSS needed to display it.

![Recording frame at 701 seconds](https://ai.engineer/api/talk-essay-media/470c23c8cb6c0b97c3c9b0b2cce33449d8ea837173bd2495bc6ddfe0c7047354)

Recording frame at 701 seconds

The observable result is a team directory in the Goose client. A request to show the directory brings up a table with searching, filtering, sorting, and pagination. Those behaviors come from the component and renderer. The author’s change is small, but the person receiving the result gains a way to inspect the directory directly rather than asking the agent to restate each view.

The same example then grows. Import a grid and a pie chart, place the chart and table inside the grid’s context manager, and the directory now appears beside a chart showing its breakdown. The progression is causal and visible: returning a component opens the interactive result; nesting two components adds a coordinated layout. The table provides individual records while the chart provides an aggregate view.

Lowin’s framework preference is “one line of code, one big noticeable change.” That is a design goal for incremental complexity, rather than a literal promise that every feature takes one line. The directory example illustrates it: each added component contributes recognizable behavior without requiring the author to construct the frontend infrastructure.

A separate demonstration connects several controls through shared reactive attributes. Text and values update together entirely on the client. The `Rx` class supplies reactive variables that can be referenced and formatted throughout the Python declaration; Prefab compiles those references into JavaScript. This is a distinct capability from placing the chart beside the table: shared bindings describe how components change together.

### A backend makes direct uploads possible

[12:22](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=742s)

The second integration adds a backend to the interface. A FastMCP app class has a UI entry point, decorated with `app.ui`, that returns its initial Prefab components. Optional decorated backend tools can then be called from the UI. A form button, for example, can submit the person’s input to a method that writes it to a database.

File upload exposes why this matters. In the ordinary agent-mediated setup, adding an upload tool to the MCP server does not give the user a file-transfer channel. The agent must call the tool with the contents. Lowin’s example gives it a megabyte of text to reproduce character by character—the “world’s most expensive copy-paste operation.” The file arrives, but its transfer consumes model work unnecessarily.

FastMCP’s upload component changes the route. Ask the agent to open the upload interface, drag a file into it, and the app sends the file directly to the server. In the demonstration, the agent subsequently works with the uploaded file. Its involvement is still useful; reproducing the payload during transfer is the avoidable part. The client must support MCP Apps for this user-facing channel to work.

Which bytes need to pass through the agent? The comparison below separates the request to open an upload capability from the file payload. In the app path, the agent initiates the experience while the file takes a direct route to the server. That routing change explains the saving.

The file takes a different route
The naive upload passes file contents through an agent-generated tool call. The MCP App lets the person transfer the file directly, after the agent opens the interface.
- User supplies file — The example supplies a megabyte of text to the agent.
- Agent reproduces contents — The payload must be included in the tool call.
- MCP server receives file — The transfer succeeds through the agent-mediated route.
- Agent opens upload app — The user asks for an upload capability.
- User drags file into app — The upload component accepts the file directly.
- Server receives file — The payload bypasses the agent; the agent can work with it afterward.
- User supplies file → Agent reproduces contents (File enters agent context)
- Agent reproduces contents → MCP server receives file (Contents become tool input)
- Agent opens upload app → User drags file into app (Makes upload interface available)
- User drags file into app → Server receives file (Direct file transfer)

### Generative UI—and Python beating JSON on the wire

[14:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=891s)

The third integration lets **Claude** generate the interface itself. In the recorded demo, a tool accepts Prefab’s serialized JSON protocol. As the agent streams the representation, the renderer displays what has arrived, attempting to repair incomplete JSON along the way. The UI grows progressively instead of waiting for a complete response.

![Recording frame at 1026 seconds](https://ai.engineer/api/talk-essay-media/e4e5bc018c53b9340aece0ecfbb1b16033b9cd96f2d1da6181d04efb0f028de6)

Recording frame at 1026 seconds

Prefab ships a skill that teaches the agent how to write these interfaces. This makes the component vocabulary available to another author: the model. Builders can choose a custom approach or restrict the available components to their needs. Lowin also leaves room for client-native implementations; when a client already offers the desired generative UI, using that may be preferable.

Then the team discovered a surprising representation tradeoff. Lowin reports that the Python form of a UI was about 70% smaller than its JSON form in their comparison. The recording does not specify the size measure or comparison workload, so this is an implementation observation rather than a universal compression ratio. It was enough to change what Prefab sends over the wire.

The newer path streams Python, executes it in a sandbox, converts it to JSON on the server, and renders that JSON. The intermediate protocol remains intact; only the agent’s transmitted representation changes. Lowin reports token, cost, and latency benefits from the more compact input. The tradeoff is that this path now requires sandboxed code execution, whose isolation mechanisms are not developed in the talk.

Python therefore ends up doing two jobs: giving humans a readable composition language and giving agents a compact way to transmit the same interface. JSON retains the architectural job that motivated the project—a serializable representation consumed by the React renderer. To try the integration described in the recording, Lowin points to the Prefab documentation and the optional FastMCP installation: import components, return them from tools, and let the framework deliver the app.

## Key takeaways

- MCP Apps let the agent initiate an experience while the person interacts with a real interface and its backend.
- Prefab’s scope makes Python UI composition practical: component trees, parameters, and reactive bindings cover structured information work without recreating the frontend ecosystem.
- The JSON protocol is the central architectural mechanism. A serializable UI can be created by a human, generated by an agent, or passed between them for modification.
- Changing a tool’s return value to a Prefab component produces an interactive result. Adding a grid and chart extends the team directory without replacing that working table.
- Direct upload separates capability selection from payload transfer: the agent opens the app, and the file reaches the server without being reproduced in model-generated tool arguments.
- Prefab changed generated-UI transport from JSON to a smaller Python representation, then converts it back to JSON after sandbox execution. Compact authoring and a serializable rendering protocol serve different jobs.

## Resources

- [FastMCP repository](https://github.com/PrefectHQ/fastmcp) — The MCP framework that detects returned Prefab components and delivers interactive apps; useful for framework installation and integration examples.

## Related talks

- [MCP Apps: Extending the Frontier — Ido Salomon & Liad Yosef](https://ai.engineer/talks/-jY2T2PiJBE-mcp-apps-extending-frontier) — The MCP Apps talk Lowin mentions at the opening provides a companion to the protocol-level part of this recording.
- [Building Interactive UIs in VS Code with MCP Apps — Marlene Mhangami & Liam Hampton, GitHub](https://ai.engineer/talks/_xIwFcnHqp4-building-interactive-uis-in-vs-code-mcp) — Follow the same subject into a specific host environment: interactive MCP interfaces in VS Code.
- [Your MCP Server is Bad and You Should Feel Bad](https://ai.engineer/talks/96G7FLab8xc-your-mcp-server-is-bad-you-should) — Lowin’s longer treatment of workflow design and context costs explains why agent-facing tools also need deliberate interface design.

## Slides

### Generative UI... in Python?

Jeremiah Lowin introduces his talk on generative UI in Python, calling it one of the weirdest pieces of software he has written.

[0:13](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=13s) [Title slide for Jeremiah Lowin’s talk, Generative UI... in Python?](https://assets.ai.engineer/sites/aiecode2025/sha256/dd454bbe8bc3ccbc3e2884ab458b370c528926e8cd88445307c86051dab8d547.webp)

Generative UI... in Python?

Jeremiah Lowin | AI Engineer World's Fair | 07.01.2026

### MCP Apps

Lowin introduces MCP Apps as an extension of the MCP protocol.

[0:31](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=31s) [MCP Apps section title.](https://assets.ai.engineer/sites/aiecode2025/sha256/dcffd0228dcd694784d9d97351fe6ae27ecbea201d58d50d749cb2b566d23f55.webp)

MCP Apps

### MCP request-response cycle

The user asks the agent, which calls a tool on the MCP server. The result returns to the agent’s context, and the agent forms a response for the user.

[1:01](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=61s) [Sequence diagram showing a user request to an agent, a tool request and result between the agent and server, and the agent’s response to the user.](https://assets.ai.engineer/sites/aiecode2025/sha256/499414455017c904dcaccb1503620abf17353da088e1aa48d473c515ddcdc7e4.webp)

user
agent
server

user request
tool request
tool result
response

### MCP app flow

The server returns an app UI that lets the user exchange tool requests and results directly. Lowin describes a coming extension that would let the agent interact with the app too.

[2:34](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=154s) [Sequence diagram showing the user, agent and server exchanging requests, an app UI and a tool result, with an added arrow labeled agent interacts with app.](https://assets.ai.engineer/sites/aiecode2025/sha256/557009fd54006a4ac405dae9982614b267af6ab9e29285d5c7e24279ec6ad38b.webp)

user    agent    server

user request
tool request
app UI
tool request
tool result
agent interacts with app

### FastMCP

Lowin created FastMCP, a framework for building MCP servers. Its mostly Python user base raises a challenge: how to build interactive UIs without recreating the frontend ecosystem in Python.

[2:58](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=178s) [FastMCP name and logo.](https://assets.ai.engineer/sites/aiecode2025/sha256/ea6566aec1c3be14d55d639f35686019cba35a66b72c93171f912cf16defbd73.webp)

FastMCP

### Known Planets

This example information-sharing table contrasts Earth, rated Mostly Harmless and demolished for a bypass, with Vogsphere, rated Extreme and described as a bureaucratic hellscape.

[4:47](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=287s) [Table of fictional planets, sectors, danger levels, and notes.](https://assets.ai.engineer/sites/aiecode2025/sha256/3f049f761235bb6681a154f484f64deea208b03ddec48be7e205997798fb4342.webp)

THE HITCHHIKER'S GUIDE TO THE GALAXY
Known Planets

Planet | SECTOR | DANGER LEVEL | NOTE
Earth | ZZ9 Plural Z Alpha | Mostly Harmless | Demolished for bypass
Magrathea | Horse Head Nebula | Low | Custom luxury planets
Vogsphere | Vogsol | Extreme | Bureaucratic hellscape
Betelgeuse V | Orion Arm | Moderate | Zaphod's home world
Krikkit | Dust Cloud | High | Isolated; hostile to outsiders

### Galactic Beverage Rankings

The chart compares beverage ratings and lethality. Pan Galactic Gargle Blaster leads both measures; Tea has only a rating bar.

[4:53](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=293s) [Bar chart comparing ratings and lethality for six fictional beverages.](https://assets.ai.engineer/sites/aiecode2025/sha256/606070745103bac2fc1dab64cd55d4a48d5e8577d14453f57804f0d708e1925b.webp)

THE HITCHHIKER'S GUIDE TO THE GALAXY
Galactic Beverage Rankings

Y-axis ticks: 0, 25, 50, 75, 100
Beverages: Pan Galactic Gargle Blaster; Ol' Janx Spirit; Arcturan Mega-Gin; Echirian Brandy; Jinond-o-Nicks; Tea
Legend: Rating; Lethality

### Prefab

Prefab is a scoped UI framework for delivering interfaces through an agent, including tables, forms, and charts.

[4:58](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=298s) [Prefab wordmark in a blue-to-orange gradient.](https://assets.ai.engineer/sites/aiecode2025/sha256/6b0cf6c87dd3b51a749dadced54ab22094d97a34e5ad89230406ea52dab16151.webp)

Prefab

### Hello World Card and Python Code

Python nests the card’s content and footer to match the rendered UI. A shared name value appears in the greeting and badge, with an input for real-time updates.

[5:48](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=348s) [A Hello, world card beside Python code defining its input, text, and badges.](https://assets.ai.engineer/sites/aiecode2025/sha256/de84b255fe6c77a66ff9519e7fa8d178029cd24459a4b0627f55a2e69610847f.webp)

Hello, world!
Type below and watch this update in real time.
world
Name: world
Prefab

from prefab_ui.components import *
from prefab_ui.rx import Rx

name = Rx("name").default("world")

with Card():
    with CardContent():
        with Column(gap=3):
            H3(f"Hello, {name}!")
            Muted("Type below and watch this update in real time.")
            Input(name="name", placeholder="Your name...")

    with CardFooter():
        with Row(gap=2):
            Badge(f"Name: {name}", variant="default")
            Badge("Prefab", variant="success")

### Composing frontends in Python

Lowin calls composing frontends in Python surprisingly natural when the task is assembling well-designed components. The slide crosses out “blasphemous” to capture the initial sense that the code looks odd.

[5:59](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=359s) [The slide says composing frontends in Python is surprisingly natural, with an earlier word crossed out.](https://assets.ai.engineer/sites/aiecode2025/sha256/c8024d8b062cdadd711c0a2ba9208cc3500ea32d1069b017f12264287ace5f42.webp)

Composing frontends in Python is
blasphemous surprisingly natural

### Prefab components, layout, and state

The example nests a card’s content and footer with context managers. An Rx variable supplies the greeting and badge and binds to the input.

[6:28](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=388s) [Python code for a card appears beside labels identifying components as classes, layout as context managers, and state as Rx variables.](https://assets.ai.engineer/sites/aiecode2025/sha256/ea529b1d1a5ae5d3fd5406aa633f71e62b94610ab1eb127692f727bdbdb89d3e.webp)

from prefab_ui.rx import Rx

name = Rx("name").default("world")

with Card():
    with CardContent():
        with Column(gap=3):
            H3(f"Hello, {name}!")
            Input(name="name")

    with CardFooter():
        Badge(f"Name: {name}")

Components: classes
Layout: context managers
State: Rx variables

### Python to JSON to React

Prefab’s Python DSL builds a UI representation serialized as JSON, which a React app renders. Agents can generate or modify the intermediate JSON.

[7:37](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=457s) [Three connected cards show Python authoring, a JSON protocol, and a React runtime.](https://assets.ai.engineer/sites/aiecode2025/sha256/50fbeca6b3000495f2a6afaedbb8a230cfe88c2b932b16bd4a1c43be1584e61e.webp)

AUTHORING
Python
Compose existing components with normal Python ergonomics.

PROTOCOL
JSON
Streamable, serializable, and friendly to agents.

RUNTIME
React
Render real interactive apps in the browser.

### Prefab DataTable documentation

Prefab’s docs are rendered in Prefab: the Python example produces the live DataTable, and users can edit examples in the playground to see the UI update.

[8:34](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=514s) [Prefab documentation displays a DataTable example with sample rows and a component navigation sidebar.](https://assets.ai.engineer/sites/aiecode2025/sha256/15359fe981b4b19a0b6a7d521c931f98dae33b27c5993b03d7b69a55a74bdf75.webp)

Components
DataTable
High-level data table with sorting, filtering, and pagination.

DataTable wraps tanstack/react-table with a flat Python API. Hand it columns and rows, and it handles sorting, filtering, pagination, and formatting — no manual <TableRow> assembly required. For static display tables without interactivity, use Table instead.

Basic Usage

Name | EMAIL | Role
Alice Johnson | alice@example.com | Admin
Bob Smith | bob@example.com | Editor
Carol White | carol@example.com | Viewer

Python
from prefab_ui.components import DataTable, DataTableColumn

Interface text:
Prefab
PrefectHQ/prefab  557
Search the docs... ⌘K
Examples
Interactivity
Data & Visualization
Apps
Reference
Layout
Components
Accordion
Alert
Audio
Badge
Button
Button Group
Card
Code
DataTable
Dialog
Dot
Embed
HoverCard
Icon
Image
Kbd
Copy page
On this page
Basic Usage
Pagination
Search
Columns
Sorting
Widths
Alignment
Styling
Rows
Click
Expandable
Cells
Formatting
Components
From DataFrame
API Reference
Protocol Reference
Edit in Playground
Python
Protocol
Ask a question...

### Using Prefab with MCP servers

Lowin introduces interactive tools as the first of three MCP approaches: return UI from a tool so users can interact with its output. He labels this 90% of use cases.

[9:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=563s) [A slide introduces interactive tools that return UI from an MCP tool.](https://assets.ai.engineer/sites/aiecode2025/sha256/2b910bb656806aca03f0c24bf3d6e929bd7a2c97dfc9654b4a923980a2ce6bad.webp)

Using Prefab with MCP servers

01
Interactive tools

Return UI from an MCP tool. 90% of use cases.

### MCP tool returning directory data

The decorated team_directory function queries the team table and returns the rows in a dictionary for the agent.

[10:14](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=614s) [Python code queries a team table and returns the rows in a dictionary.](https://assets.ai.engineer/sites/aiecode2025/sha256/80add0e570f01493d68163aa752523d6fb954143b2e119e0c6927848ef54bd77.webp)

@mcp.tool
def team_directory():
    """Return the team directory."""
    rows = db.query("SELECT * FROM team")
    return {"rows": rows}

### Return a data table

The tool returns a Prefab DataTable with name and role columns. FastMCP prepares the app so the user sees a table.

[10:29](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=629s) [Python code returns a Prefab data table with name and role columns.](https://assets.ai.engineer/sites/aiecode2025/sha256/6a9b0e35851b17bc539fc0297c546d0be5090ac0b2fdaf21af1cffe707700045.webp)

from prefab_ui.components import DataTable, DataTableColumn

@mcp.tool(app=True)
def team_directory():
    """Return the team directory."""
    rows = db.query("SELECT * FROM team")
    return DataTable(
        columns=[
            DataTableColumn(key="name", header="Name"),
            DataTableColumn(key="role", header="Role"),
        ],
        rows=rows,
    )

### Team directory in Goose

In Goose, asking for the team directory displays a data table. Lowin says the table supports searching, filtering, sorting and pagination.

[10:57](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=657s) [A Goose client displays a team directory with a filter and sortable columns.](https://assets.ai.engineer/sites/aiecode2025/sha256/1c7385f71489eff49f44fe317148d1e5b9a652dcd08839a4ca5600bac6b8c748.webp)

Team Directory
8 people
Filter...

Name | Department | Level | Location
Alice Chen | Engineering | Senior | San Francisco
Bob Martinez | Design | Lead | New York
Carol Johnson | Engineering | Staff | London
David Kim | Product | Senior | San Francisco
Eva Müller | Engineering | Mid | Berlin
Frank Okafor | Data Science | Senior | Lagos

Interface text:
show me the team directory?
6:39 AM
Team Directory
Home
Chat
Start New Chat
Team Directory Re...
Team Directory Requ...
Team Directory Requ...
Sales chart request
Sales chart request
Show All
Recipes
Apps
Scheduler
Extensions
Settings
goose
Send

### Compose a table and chart

A Python context manager places a data table and pie chart in a two-column grid, using the same query results for both.

[11:22](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=682s) [Python code places a data table and pie chart in a two-column grid.](https://assets.ai.engineer/sites/aiecode2025/sha256/6709b983178b24ef6d0fe870eed9fd5f9c3f388871f0deffc9358b33fde06e7a.webp)

from prefab_ui.components import DataTable, DataTableColumn, Grid
from prefab_ui.components.charts import PieChart, ChartSeries

@mcp.tool(app=True)
def team_directory():
    rows = db.query("SELECT * FROM team")
    columns = ["name", "role", "location"]
    with Grid(columns=2, gap=4):
        DataTable(columns=columns, rows=rows)
        PieChart(
            data=rows,
            x_axis="role",
            series=[ChartSeries(data_key="count")],
        )

### Crew directory with chart

The crew directory now places a pie chart beside the data table. Lowin presents the grid as an incremental change to the original table.

[11:44](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=704s) [A crew directory displays a donut chart beside a table of fictional characters.](https://assets.ai.engineer/sites/aiecode2025/sha256/18ca795a18acebc04b7bf806e4b4f4d3b717e1270beafe522f85473312e08633.webp)

Heart of Gold — Crew Directory
8 crew members

Legend: Human, Betelgeusian, Android, Magrathean

Name | Role | Species
Arthur Dent | Accidental Hitchhiker | Human
Ford Prefect | Researcher | Betelgeu[illegible]
Zaphod Beeblebrox | President of the Galaxy | Betelgeu[illegible]
Trillian | Astrophysicist | Human
Marvin | Ship's Robot | Android
Slartibartfast | Planet Designer | Magrath[illegible]

Interface text:
goose
Show me the team directory
2:07 PM
Crew Directory
⌘↑/⌘↓ to navigate messages
Send
0.1281
claude-sonnet-4-6
autonomous
11

### Improbability Drive dashboard

Lowin demonstrates linked dashboard controls that update text and values on the client. He says the example uses classes assigned the same attribute, with no JavaScript written.

[12:00](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=720s) [A dashboard shows a drive-power slider, three circular gauges, and a button.](https://assets.ai.engineer/sites/aiecode2025/sha256/551eed399c684f57e90770c19143f6e699533b2d766158ba1a6183784f0817a2.webp)

THE HITCHHIKER'S GUIDE TO THE GALAXY
Improbability Drive

Drive power: 42%

42
Heart of Gold

62
Bistromath

22
Vogon Cruiser

Don't Panic (0)

### Reactive variables

An input and badge share a reactive name, which defaults to world. Reactive references compile into JavaScript.

[12:22](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=742s) [Python code binds an input and badge to a reactive name variable.](https://assets.ai.engineer/sites/aiecode2025/sha256/fdfa6569e45826a9571a34788c7a70c283e5f918b2652d50fb3a8955b4696c96.webp)

from prefab_ui.components import Badge, Input
from prefab_ui.rx import Rx

name = Rx("name").default("world")

Input(name="name")
Badge(f"Name: {name}")

### Using Prefab with MCP servers

Interactive tools return a one-shot UI from an MCP tool; FastMCP Apps use the MCP server as a full application’s backend. The slide assigns 90% of use cases to interactive tools.

[12:39](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=759s) [Two cards compare interactive tools with FastMCP Apps.](https://assets.ai.engineer/sites/aiecode2025/sha256/a4e8d789bf6e4b7e8fd879d9f1ef06a10bce89c64b2d4e099a9aba570625defd.webp)

Using Prefab with MCP servers

01
Interactive tools
Return UI from an MCP tool. 90% of use cases.

02
FastMCP Apps
Use the MCP server as an app backend.

### FastMCP app example

A Contacts app returns a data table as its UI and defines a tool to save contacts. The example registers the app with the CRM MCP server.

[12:56](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=776s) [Python code defines a contacts app with a data table and a save tool, then registers it with an MCP server.](https://assets.ai.engineer/sites/aiecode2025/sha256/1542a40345e99040a9a4ba5e5222f3068799712e4f124b105375f82d84037151.webp)

from fastmcp import FastMCP, FastMCPApp
from prefab_ui.components import DataTable

mcp = FastMCP("CRM")
app = FastMCPApp("Contacts")

@app.ui()
def contacts_ui():
    return DataTable(rows=db.contacts())

@app.tool()
def save_contact(name: str, email: str):
    db.save_contact(name, email)

mcp.add_provider(app)

### File upload provider

Register FileUpload as a provider so an agent can open an upload interface. A file dragged into the app goes directly to the server, avoiding expensive agent transcription.

[13:40](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=820s) [Python code imports a file upload app and adds it as a FastMCP provider.](https://assets.ai.engineer/sites/aiecode2025/sha256/ee1048b3b23a1a18b083abf5963f8c2d7008e85c2bf0dc99875cca9a52b080e3.webp)

from fastmcp import FastMCP
from prefab_ui.apps import FileUpload

mcp = FastMCP("My Server")
mcp.add_provider(FileUpload())

## Full transcript

[0:01](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1s) [music]

[0:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=12s) Good. Um, thank you all for for coming

[0:15](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=15s) out. Um, I'm going to talk today about

[0:16](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=16s) one of the weirdest pieces of software

[0:18](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=18s) I've ever written. It's sort of on the

[0:20](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=20s) edge of a whole lot of stuff I've been

[0:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=21s) putting putting forward into the world.

[0:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=23s) Um, so join me if you will. We're going

[0:25](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=25s) to try and have the most reasoned

[0:27](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=27s) approach to to a very strange thing that

[0:29](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=29s) agents and MCP and other things have

[0:31](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=31s) enabled. And so to begin, I want to talk

[0:35](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=35s) about MCP apps. I don't know if any of

[0:36](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=36s) you were able to join any of the other

[0:38](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=38s) talks earlier today. Maybe the one that

[0:40](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=40s) um Edo and Lead just gave maybe an hour

[0:43](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=43s) ago. Just a show of hands. MCP apps

[0:46](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=46s) familiarity.

[0:49](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=49s) Okay, this is probably the best crowd

[0:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=51s) I've ever given this talk to actually.

[0:52](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=52s) So that's that's fantastic. Um, for

[0:54](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=54s) those that didn't put their hands up,

[0:56](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=56s) MCP apps is an extension of the MCP

[0:58](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=58s) protocol that was introduced I think in

[0:59](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=59s) January of this year. And the idea is

[1:02](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=62s) this is a typical request response cycle

[1:05](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=65s) for an MCP um tool. The user makes a

[1:08](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=68s) request to the agent. The agent in turn

[1:11](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=71s) decides to use an MCP tool that's hosted

[1:14](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=74s) on an MCP server. A tool result comes

[1:16](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=76s) back into the agent's context and the

[1:18](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=78s) agent chooses to form some response and

[1:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=81s) send it out to the user. And so

[1:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=83s) fundamentally MCP servers are these

[1:25](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=85s) fantastic ways of adding uh functions

[1:27](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=87s) and business logic to your agents but

[1:29](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=89s) never a direct connection between a user

[1:32](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=92s) and the MCP server. It always goes

[1:33](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=93s) through the brain of the agent and more

[1:35](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=95s) importantly through the context window

[1:36](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=96s) of the agent. So MCP apps are an

[1:39](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=99s) extension of this which allow us

[1:41](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=101s) actually to bypass the agent and instead

[1:43](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=103s) what happens is the following. The user

[1:45](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=105s) requests something from the agent. The

[1:47](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=107s) agent uses a tool, but instead of that

[1:49](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=109s) tool request going back to the agent, it

[1:50](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=110s) is sent out to the user and it's sent

[1:52](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=112s) out as HTML, CSS, JavaScript. It's a

[1:55](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=115s) full UI and it can be whatever you want

[1:57](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=117s) it to be. And so the idea is you have

[1:59](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=119s) this way to make to basically put the

[2:02](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=122s) internet into your agent, so to speak.

[2:03](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=123s) You can ship any custom branded useful

[2:06](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=126s) UI that you want. You can let the user

[2:08](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=128s) have any interactive experience that

[2:10](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=130s) they want. And then the user, as you can

[2:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=132s) see in the diagram, the user now can

[2:14](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=134s) interact with the application. they can

[2:16](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=136s) use the tools, they can send information

[2:18](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=138s) back into a backend host on that app and

[2:20](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=140s) really get a full experience. You can

[2:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=141s) imagine booking a table at a restaurant

[2:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=143s) or um changing your seat on a plane or

[2:27](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=147s) interacting with a schedule for AI

[2:29](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=149s) engineer. There's a lot of things that

[2:30](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=150s) you can do as a user now where the agent

[2:32](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=152s) facilitated it, but you are going to

[2:34](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=154s) interact as a human. And there's an

[2:35](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=155s) extension coming now. This is going to

[2:37](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=157s) come out in um in the July MCP release

[2:40](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=160s) where the agent can actually interact

[2:42](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=162s) with the app as well. And this will tee

[2:44](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=164s) up some really interesting use cases

[2:45](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=165s) we're not going to talk about today, but

[2:47](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=167s) you could hypothetically play a game of

[2:48](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=168s) chess against the agent now in a visual

[2:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=171s) app where you make a move and then the

[2:52](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=172s) agent interacts with the app as well.

[2:54](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=174s) And so I think that's going to open up a

[2:55](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=175s) whole new world of possibilities.

[2:59](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=179s) Now um some of you may know a framework

[3:02](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=182s) that that I'm the author of and my

[3:03](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=183s) company maintains called FastMPP. Um

[3:05](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=185s) fast MCP is one of the most popular ways

[3:07](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=187s) of building MCP servers. And so whenever

[3:09](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=189s) new cool things come to the world of

[3:11](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=191s) MCP, the first thing I wonder is how can

[3:14](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=194s) I deliver this to our users? And one of

[3:17](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=197s) the most important things I have to

[3:18](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=198s) share with you about our user base is

[3:20](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=200s) that they're mostly Python engineers.

[3:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=203s) And so and so this is a little bit of a

[3:26](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=206s) problem when we want to deliver

[3:27](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=207s) frontends and UIs because how are we

[3:30](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=210s) actually going to do that? And this is

[3:31](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=211s) the point in the talk where I reveal

[3:32](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=212s) that I don't remember what the next

[3:33](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=213s) slide exactly is. So we're going to take

[3:34](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=214s) a peek at it. Nope, we're going to come

[3:36](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=216s) back. Um, we we have we have a challenge

[3:39](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=219s) now. Uh, how are we going to have have

[3:41](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=221s) Python engineers build UIs that are best

[3:45](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=225s) practice, that are interactive, that are

[3:48](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=228s) beautiful, that are useful without

[3:50](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=230s) pretending that we're going to do

[3:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=231s) something silly, something that's been

[3:53](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=233s) tried, and jam all of the front end, all

[3:55](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=235s) of the ecosystem, everything into Python

[3:57](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=237s) in some sort of like weird compromised

[4:00](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=240s) haphazard Frankenstein of a system. And

[4:02](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=242s) so I really struggled with this. I need

[4:04](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=244s) I really need I feel an obligation to

[4:06](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=246s) find a way to deliver this, but I I

[4:09](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=249s) can't I can't pretend we're going to

[4:10](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=250s) ship React and Python. It's not going to

[4:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=252s) work. And so we thought pretty hard

[4:14](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=254s) about who are our users in the fastmcp

[4:16](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=256s) ecosystem. Who are these Python

[4:18](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=258s) developers who tend to be in

[4:19](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=259s) enterprises? What are they doing and

[4:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=261s) what do they need these UIs for? What do

[4:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=263s) they need these MCP apps for? Um what

[4:25](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=265s) they don't need is consumer-grade custom

[4:28](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=268s) UIs that are fully branded. That that's

[4:31](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=271s) not what these folks are doing. what

[4:33](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=273s) they are uh primarily charged with is

[4:34](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=274s) sharing information throughout their

[4:36](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=276s) throughout their organization for

[4:38](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=278s) collecting information throughout their

[4:39](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=279s) organization and so it changed the

[4:41](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=281s) nature of what we expect them to do

[4:43](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=283s) within MCP apps framework and that

[4:45](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=285s) constraint became really useful so

[4:47](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=287s) fundamentally we expect that they're

[4:48](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=288s) going to do things like build tables

[4:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=291s) they're going to collect information

[4:53](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=293s) through forms and they're going to want

[4:54](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=294s) to share charts and so fundamentally

[4:57](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=297s) with this constraint we can introduce a

[5:00](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=300s) piece of software that we open sourced a

[5:02](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=302s) few months ago and has been surprisingly

[5:04](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=304s) popular among this crowd called prefab

[5:06](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=306s) and it's a scoped UI building framework

[5:10](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=310s) for the purpose of delivering UIs

[5:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=312s) through an agent for the set of purposes

[5:14](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=314s) that I mentioned a moment ago. So this

[5:16](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=316s) is a hello world card. You might see

[5:19](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=319s) this in any front-end framework,

[5:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=321s) literally anyone. It'll have something

[5:22](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=322s) that looks like this and it's on their

[5:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=323s) website and you you type your name in

[5:25](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=325s) and it it updates live. But of course,

[5:28](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=328s) the weird thing about this one is that

[5:29](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=329s) the code that generated it is entirely

[5:31](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=331s) written in Python. And so I hope that

[5:35](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=335s) you're feeling what I feel when I look

[5:37](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=337s) at this, which is a really weird

[5:39](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=339s) combination of like, yes, that's cool,

[5:40](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=340s) and this really freaks me out. The yes,

[5:43](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=343s) that's cool, comes from the fact that I

[5:45](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=345s) think there's something about this code,

[5:46](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=346s) even if you can't see it up close, I can

[5:48](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=348s) make it a little bigger. There's

[5:49](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=349s) something about this that like kind of

[5:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=351s) makes sense. You can see the structure

[5:53](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=353s) of the of the of the UI in the code, but

[5:55](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=355s) there's also something about it that's

[5:57](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=357s) obviously alien and a little bit a

[5:59](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=359s) little bit odd. And we come to this

[6:01](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=361s) conclusion when you when you feel that

[6:03](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=363s) when you look at it, which is that when

[6:04](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=364s) you compose a front end in Python, it's

[6:06](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=366s) actually starts to feel good as long as

[6:09](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=369s) we scope the challenge right. We are not

[6:11](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=371s) trying to build a front end from

[6:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=372s) scratch. We are trying to compose a

[6:14](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=374s) front end from a bunch of worldclass

[6:17](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=377s) well-designed components. And that's how

[6:19](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=379s) we keep the guardrails and that's how we

[6:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=381s) keep the user in mind. The user here is

[6:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=383s) not trying to do something arbitrary.

[6:24](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=384s) They're trying to take a well structured

[6:27](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=387s) front end and put it in front of um

[6:28](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=388s) whomever they're delivering it to. And

[6:30](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=390s) so here's a little quick tour of that

[6:31](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=391s) DSL. Um primarily we're using context

[6:33](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=393s) managers. For those of you who do know

[6:35](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=395s) fastmcp, you know that arguably you

[6:37](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=397s) could reduce fastmc down and say the

[6:39](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=399s) core innovation of fastmcp is that we

[6:41](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=401s) used a python decorator to build an

[6:43](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=403s) entire MCP server. So if you want to

[6:45](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=405s) take the same reductive approach to

[6:46](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=406s) prefab, you could say we use a context

[6:47](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=407s) manager to build an entire UI. And by

[6:50](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=410s) nesting components with as context

[6:52](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=412s) managers as you see here, we are

[6:54](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=414s) building up the exact same structure in

[6:57](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=417s) the UI. It feels very natural when you

[7:00](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=420s) read it. You can see how things are

[7:01](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=421s) structured. Um each element of the UI,

[7:04](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=424s) each component, which is a beautiful

[7:05](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=425s) shaden component when it's rendered, as

[7:07](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=427s) you can see here, is a class that you

[7:09](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=429s) instantiate. You can parameterize it.

[7:11](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=431s) you can pass it stuff like CSS classes

[7:13](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=433s) and and make it look however you want.

[7:16](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=436s) And then the last thing which we're not

[7:17](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=437s) going to have enough time to really

[7:18](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=438s) explore today is these reactive

[7:20](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=440s) variables. Um I'll show you a demo of

[7:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=441s) those in a moment, but essentially we

[7:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=443s) have a full way to um create client side

[7:26](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=446s) interactivity and bind data between

[7:28](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=448s) components that allows you to build

[7:29](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=449s) these really rich experiences again

[7:31](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=451s) without having to go fully into the

[7:33](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=453s) JavaScript world and leave an ecosystem

[7:35](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=455s) that my user base at least is extremely

[7:37](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=457s) comfortable with. Um, and this is the

[7:40](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=460s) pipeline that prefab is essentially

[7:41](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=461s) exposing. We use a Python DSL that I

[7:43](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=463s) just shared with you. We use that to

[7:45](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=465s) build a declarative representation of a

[7:47](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=467s) UI that then gets serialized into a JSON

[7:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=471s) protocol. And that JSON protocol is

[7:53](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=473s) ultimately rendered by a React app which

[7:56](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=476s) is hosted as the actual MCP app. And so

[7:58](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=478s) this is going to open up a whole lot of

[7:59](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=479s) possibilities for us that again I'm

[8:01](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=481s) going to show you in just a second. But

[8:02](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=482s) the key to this whole thing is the JSON

[8:04](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=484s) in the middle. The Python is actually an

[8:06](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=486s) accident that I discovered after the

[8:07](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=487s) fact because it was a weird

[8:08](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=488s) idiosyncratic thing that I wanted. The

[8:10](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=490s) point of this was can we create a

[8:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=492s) serializable representation of a UI and

[8:15](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=495s) that's the JSON protocol again. And

[8:17](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=497s) because it's serializable, I can

[8:19](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=499s) generate it from an agent. I can send it

[8:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=501s) to an agent. I can generate it as a

[8:22](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=502s) human and ask an agent to modify.

[8:24](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=504s) There's all this cool stuff that happens

[8:25](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=505s) because of that intermediate

[8:27](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=507s) representation in JSON. And then when

[8:29](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=509s) the when the Python DSL just fell out of

[8:31](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=511s) this and was really beautiful and easy

[8:32](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=512s) to use, I kind of felt like we had

[8:33](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=513s) something

[8:34](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=514s) So uh we have these docs and sort of to

[8:38](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=518s) prove the point this was another

[8:39](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=519s) constraint we took on this is I don't

[8:41](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=521s) even know what this is this is a doc

[8:42](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=522s) these are the docs for the data table

[8:43](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=523s) component in prefab I think there's 130

[8:46](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=526s) or 140 components that we ship that you

[8:48](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=528s) can compose into an arbitrary form the

[8:50](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=530s) docs for prefab are 100% rendered in

[8:54](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=534s) prefab so the data table that's here in

[8:56](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=536s) the basic usage it is live rendered in

[8:58](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=538s) prefab the Python code you can see it

[9:00](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=540s) sneaking in at the bottom of the screen

[9:02](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=542s) that Python code is being rendered live

[9:03](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=543s) by the renderer to generate that. If you

[9:06](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=546s) want, you can take any example in the

[9:07](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=547s) prefab docs, you can click a link, pop

[9:09](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=549s) them into the playground, and you can

[9:10](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=550s) edit the code live, the Python code

[9:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=552s) live, and you will see the UI update.

[9:15](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=555s) And again, this is super weird. If

[9:17](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=557s) you're feeling a little uncomfortable

[9:18](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=558s) about this, that is that is okay. It

[9:20](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=560s) makes a lot more sense when we constrain

[9:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=561s) the problem. And remember that we're

[9:22](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=562s) composing a UI rather than building it.

[9:25](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=565s) So, I want to bring this back to the

[9:27](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=567s) thing I opened with now, which is MCP

[9:28](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=568s) servers and more specifically MCP apps.

[9:31](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=571s) You are welcome to use prefab for any

[9:33](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=573s) kind of front-end problem you have. My

[9:35](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=575s) team has started using it for small

[9:36](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=576s) interactive data apps and things to

[9:38](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=578s) explore. They've been building

[9:39](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=579s) presentations with it. We ship a a dark

[9:41](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=581s) mode theme that honestly looks kind of

[9:43](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=583s) like the one I'm showing you right now

[9:44](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=584s) to make slides and presentations. You

[9:47](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=587s) can do a lot of stuff with it. But the

[9:48](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=588s) reason we built it, the use case that it

[9:50](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=590s) is satisfying is for MCP servers. And so

[9:53](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=593s) um I want to give you a quick tour of

[9:55](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=595s) three ways that you can use it, three

[9:56](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=596s) increasingly sophisticated ways that you

[9:58](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=598s) can use it in your MCP server. The first

[10:00](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=600s) is to build an interactive tool. As I

[10:03](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=603s) showed you at the beginning of the talk,

[10:04](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=604s) typically an MCP tool is something your

[10:06](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=606s) agent calls and the agent gets the

[10:08](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=608s) result and you don't get to interact

[10:09](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=609s) with it at all. So what's the easiest

[10:11](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=611s) way that we can advance that that

[10:13](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=613s) interactive functionality?

[10:15](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=615s) I'm going to show you here. This is a

[10:17](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=617s) fastm tool. It's been decorated with a

[10:19](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=619s) tool decorator as you can see and it's

[10:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=621s) just a Python function that returns some

[10:22](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=622s) information. Bearing in mind this

[10:24](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=624s) information will go to the agent, not

[10:25](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=625s) the user. If we want to turn this into a

[10:27](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=627s) fully interactive tool with prefab,

[10:31](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=631s) we're going to make one change. Instead

[10:33](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=633s) of returning a Python dictionary at the

[10:34](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=634s) end, which will go to the agent, we're

[10:36](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=636s) going to return a prefab component. In

[10:38](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=638s) this case, it's the data table. These

[10:39](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=639s) are the this is what I just showed you

[10:40](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=640s) the docs for a moment ago. And when we

[10:42](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=642s) return this prefab component, FastMPP

[10:46](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=646s) will automatically detect that. It will

[10:47](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=647s) automatically infer that you in fact

[10:49](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=649s) want to return an MCP app. and it will

[10:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=651s) spin up all the machinery to get the

[10:52](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=652s) HTML, the JavaScript, the CSS, the

[10:54](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=654s) render, everything in place so that your

[10:55](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=655s) user will see a data table. Here's what

[10:58](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=658s) this looks like in practice. This is

[10:59](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=659s) using the goose client, which is an

[11:01](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=661s) excellent one. Um, I asked a server that

[11:04](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=664s) had the function I just uh showed you,

[11:05](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=665s) show me the team directory. And what

[11:07](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=667s) pops up uh this would be better as a

[11:09](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=669s) GIF. I apologize, but what pops up is a

[11:10](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=670s) fully interactive data table component.

[11:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=672s) It supports um searching and filtering

[11:15](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=675s) and sorting and pagionation and all this

[11:17](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=677s) stuff. And all it is is what I showed

[11:19](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=679s) you a moment ago. Just return the data

[11:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=681s) table class and all this will be taken

[11:22](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=682s) care of. We can go a step further. What

[11:25](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=685s) if in addition to the data table, we

[11:26](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=686s) want to show a pie chart right next to

[11:28](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=688s) the data table that breaks down this

[11:30](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=690s) team directory. As you might imagine,

[11:32](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=692s) very, very, very similar code. Instead

[11:34](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=694s) of the data table alone, we're now going

[11:35](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=695s) to import a grid and a pie chart. And if

[11:38](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=698s) you look at the bottom, you'll see that

[11:39](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=699s) we compose both the pie chart and the

[11:41](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=701s) data table into a grid very naturally

[11:43](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=703s) with a context manager. And this is the

[11:45](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=705s) result. we now get a pie chart next to

[11:48](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=708s) our data table. So this follows a

[11:50](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=710s) principle that we really try to hold in

[11:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=711s) a lot of our software at Prefect, which

[11:53](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=713s) is one line of code, one big noticeable

[11:55](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=715s) change. We try to keep that complexity

[11:57](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=717s) incremental. And so this satisfies a lot

[11:58](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=718s) of things that I think are really

[11:59](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=719s) important about frameworks and DSLs. Um,

[12:03](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=723s) this is very quickly because we won't

[12:04](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=724s) have time to go into it. This is just an

[12:05](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=725s) example I threw together and recorded of

[12:08](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=728s) fully client side interactivity where

[12:10](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=730s) all of these controls are linked. Uh,

[12:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=732s) stuff's updating, text is updating,

[12:14](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=734s) values are updating. No JavaScript was

[12:16](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=736s) written. This is just a couple of

[12:18](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=738s) classes composed that all have the same

[12:19](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=739s) attribute assigned. So they all work

[12:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=741s) together automatically.

[12:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=743s) Um, oh, and I did throw in a quick code

[12:26](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=746s) example of what that looks like. We have

[12:27](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=747s) a class called RX, which as you may

[12:29](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=749s) guess stands for reactive. If you use

[12:31](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=751s) these reactive variables, you can just

[12:33](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=753s) reference them anywhere in your code.

[12:34](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=754s) You can format them. You can you can

[12:36](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=756s) make them the name of something and it

[12:38](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=758s) will automatically compile into the

[12:39](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=759s) correct uh JavaScript implementation.

[12:42](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=762s) The second thing that we can do is a

[12:43](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=763s) fastmcp app. So if an interactive tool

[12:46](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=766s) is sort of a oneshot here's a user

[12:48](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=768s) interface and you can interact with it

[12:49](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=769s) in the client a fastmcp app is a full

[12:52](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=772s) application with a backend and in this

[12:54](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=774s) case the MCP server is going to be the

[12:56](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=776s) back end. We don't have time to go

[12:58](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=778s) through a full worked example in this

[13:00](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=780s) session but here's what the code looks

[13:01](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=781s) like just to give you a sense of the

[13:02](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=782s) ergonomics. We're going to write a class

[13:04](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=784s) which is our fastmcp app and then we're

[13:06](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=786s) going to decorate at least two uh

[13:09](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=789s) functions with app.ui UI. That's the

[13:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=792s) entry point that's going to return the

[13:13](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=793s) prefab components that form the base UI

[13:16](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=796s) of that application. And then at least

[13:18](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=798s) one, I guess this is optional, so zero

[13:19](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=799s) or more um app.tools. And these are

[13:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=803s) essentially backend methods that you can

[13:25](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=805s) now reference in the UI. So you could

[13:27](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=807s) have a button that takes data that the

[13:29](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=809s) user has entered into a form and sends

[13:31](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=811s) it to a database using a decorated tool

[13:34](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=814s) like this. One thing that we use and we

[13:37](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=817s) ship as a built-in component now in

[13:39](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=819s) fastmcp

[13:41](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=821s) is an upload component. So as you can

[13:43](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=823s) see because only the agent has access to

[13:46](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=826s) an MCP server you can't simply upload a

[13:49](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=829s) file to an MCP server. It has to go

[13:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=831s) through the brain of the agent. And so

[13:52](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=832s) what ends up happening is a lot of

[13:53](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=833s) people create basically an upload tool

[13:55](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=835s) on their MCP server forget that the

[13:57](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=837s) agent has to actually call it. And what

[13:59](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=839s) you end up doing is the world's most

[14:00](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=840s) expensive copy paste operation. You give

[14:02](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=842s) the agent a megabyte of text. the agent

[14:05](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=845s) retypes it character by character into

[14:07](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=847s) the MCP and now yes in fact you have

[14:10](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=850s) uploaded it but it's extremely extremely

[14:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=852s) inefficient. So this is a really good

[14:14](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=854s) use case for an MCP app where you ask

[14:17](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=857s) the agent to bring up the app interface

[14:19](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=859s) you drag a file into it and now the file

[14:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=861s) bypasses the agent and goes right into

[14:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=863s) the server. And we've made that a

[14:24](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=864s) oneliner like this along with a handful

[14:26](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=866s) of other um useful tools. And is this a

[14:30](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=870s) gift? this is not a GIF or if it is it's

[14:32](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=872s) not rendering but it would look like

[14:33](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=873s) this in your client in any client that

[14:35](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=875s) supports MCP apps if you ask the agent I

[14:37](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=877s) need to upload something it can now show

[14:38](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=878s) you this and you can upload safely and

[14:41](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=881s) most importantly cheaply um oh I do have

[14:44](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=884s) a gift mind know your own slides is a

[14:47](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=887s) good lesson from this talk so here's the

[14:49](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=889s) agent is now interacting with a file

[14:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=891s) that I just uploaded that I dragged and

[14:53](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=893s) dropped um I'll make these slides

[14:54](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=894s) available later if you'd like to see

[14:55](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=895s) this or of course it's a oneliner you

[14:57](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=897s) could try it in your servers uh this

[14:59](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=899s) afternoon. The last thing that I want to

[15:02](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=902s) talk about which is sort of enabled by

[15:03](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=903s) this architecture is a fully generative

[15:05](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=905s) UI. Um, we're just going to skip and let

[15:08](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=908s) this play while I talk. So, this is a

[15:10](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=910s) very simple demo where I asked Claude,

[15:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=912s) "Hey, just I'm giving a talk on this.

[15:14](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=914s) Just start streaming the most

[15:15](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=915s) interesting UI you can come up with."

[15:17](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=917s) And so, it just went. And what it's

[15:19](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=919s) doing here is we exposed a tool that

[15:22](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=922s) accepts the JSON uh the protocol

[15:25](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=925s) serialization of a UI that prefab is

[15:28](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=928s) based on. And so now as the agent is

[15:30](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=930s) streaming that information over the

[15:32](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=932s) wire, we are in real time rendering

[15:34](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=934s) whatever we've got, healing that JSON

[15:36](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=936s) and rendering it. And so this was a

[15:37](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=937s) really cool demo and it was really

[15:38](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=938s) effective and people like this because

[15:40](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=940s) now you don't even have to define the UI

[15:41](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=941s) yourself. All you have to do is use the

[15:44](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=944s) skill we already ship, share it with

[15:45](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=945s) your agent so it knows how to write a UI

[15:47](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=947s) and off it goes. It can make you

[15:49](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=949s) whatever you want. There are some

[15:50](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=950s) clients that have built-in versions of

[15:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=951s) this. if they have a built-in version,

[15:53](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=953s) you may prefer to use it by all means,

[15:54](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=954s) but this may be a way for you to build

[15:56](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=956s) your own custom uh approach or limited

[15:58](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=958s) set of components that are useful to

[16:00](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=960s) you. Now, a really interesting thing

[16:02](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=962s) happened when we spun this up. So, as I

[16:04](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=964s) mentioned, originally the plan was for

[16:06](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=966s) the agent to send JSON over the wire and

[16:08](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=968s) have it be rendered into this full React

[16:10](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=970s) application.

[16:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=972s) What we ended up discovering is that the

[16:13](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=973s) Python representation of a UI is about

[16:16](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=976s) 70% smaller than the JSON

[16:18](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=978s) representation.

[16:21](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=981s) So we don't do this anymore. When I

[16:23](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=983s) recorded this demo was streaming JSON.

[16:25](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=985s) What we now do is we actually stream the

[16:26](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=986s) Python over the wire. It's executed in a

[16:29](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=989s) sandbox. It's turned into JSON on the

[16:32](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=992s) server and then that's rendered. And so

[16:34](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=994s) this has a dramatic dramatic token

[16:36](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=996s) efficiency, cost, and latency uh

[16:38](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=998s) benefit. So it would work exactly the

[16:41](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1001s) same as when I recorded this demo, but

[16:42](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1002s) this is just one of those things that

[16:44](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1004s) we've learned on the fly. And it's

[16:45](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1005s) really fascinating that the Python

[16:46](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1006s) representation is just that much more

[16:48](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1008s) compact and ergonomic than the full um

[16:51](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1011s) JSON one. So um that's prefab. If you'd

[16:54](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1014s) like to check it out, if you're curious,

[16:56](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1016s) if you want to see the weirdest thing

[16:57](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1017s) I've ever built um along with however

[16:59](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1019s) other many people, you can see the docs

[17:01](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1021s) at prefab.pref.io.

[17:02](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1022s) You can see the full library uh which is

[17:04](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1024s) on our GitHub here. And this is already

[17:07](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1027s) fully baked into FastmcP. So, if you're

[17:09](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1029s) using a recent version of FastMPP, you

[17:11](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1031s) should be able to install this optional

[17:12](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1032s) addition, uh, import the components,

[17:14](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1034s) return them, and start playing with

[17:16](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1036s) these MCP apps. Thank you all for

[17:18](https://www.youtube.com/watch?v=Krzs8GeiWTc&t=1038s) coming. [applause]
