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

AI Engineer17:38
0 comments · 0 votesOpen discussionClose discussion
Sign in to join the discussion

    Video summary

    Jeremiah Lowin explains how MCP apps let an agent bring an interactive interface into a conversation so a person can work directly with tools and server data. The design problem is narrower than building arbitrary consumer websites: Python developers often need tables, forms and charts for sharing or collecting information inside organizations.

    Jeremiah Lowin presents Prefab as a way to compose existing interface components with Python classes and nested context managers. The Python description becomes a declarative JSON representation rendered by a React application. Reactive variables bind component values and client-side interactions, allowing Python authors to describe behavior without writing the corresponding JavaScript themselves.

    Jeremiah Lowin illustrates progressively richer integrations with FastMCP: returning an interactive table from a tool, combining a table and chart in a grid, and defining an application with backend methods. A file-upload example shows why direct interaction matters: the user can send a file to the server through the app instead of having the agent reproduce its contents in a tool call. These capabilities require a client that supports MCP apps.

    Jeremiah Lowin then describes generative interfaces based on the same structured representation. The recorded example streams agent-generated JSON into a renderer; a subsequently described approach streams Python, executes it in a sandbox and converts it to JSON. Jeremiah Lowin reports that the Python representation is about 70% smaller in this work, presenting potential token and latency benefits rather than an independently verified general benchmark.

    Original YouTube thumbnailWatch on YouTube