Frontend Agent UX in 7 Days: From Streaming to Generative UI
Course questions · 27 / 27
33 more tagsShow fewer tags
D1 What Makes Agent Frontends Hard: an Event Protocol and Your First Stream in the Browser
You need to consume a streaming response in the browser and the request carries a body. Would you use EventSource, WebSocket, or fetch with ReadableStream? Why?浏览器里要读一条带请求体的流式响应,EventSource、WebSocket、fetch 加 ReadableStream 你选哪个?为什么?
Common in ChinaCommon overseasBasic#streaming#sse#browser-api🔒 Unlock D1 to see the answer keys.
Why do protocols like AG-UI split one message into START, CONTENT, and END events instead of sending a complete message?AG-UI 这类协议为什么要把一条消息拆成 START、CONTENT、END 三个事件,而不是直接发一条完整消息?
Common in ChinaCommon overseasIntermediate#protocol-design#streaming#ui-state🔒 Unlock D1 to see the answer keys.
Your frontend receives an event type the protocol does not define. Should it throw, ignore it, or pass it through? What drives your decision?你的前端收到一个协议里没定义过的事件类型,应该报错、忽略,还是透传给上层?说出你的判断依据。
Common in ChinaCommon overseasDeep dive#forward-compatibility#protocol-design#error-handling🔒 Unlock D1 to see the answer keys.
D2 Streaming Without Jank: Render Storms, Incremental Markdown, and Scroll Anchoring
A model is emitting 80 deltas per second, your chat page drops frames, and the input box lags. In what order do you diagnose and fix it?模型每秒吐 80 个增量,你的聊天页开始掉帧、输入框也变卡,你按什么顺序排查和优化?
Common in ChinaCommon overseasDeep dive#react-performance#streaming#profiling🔒 Unlock D2 to see the answer keys.
Your streaming Markdown renderer receives a code fence that has opened but not yet closed. How should it handle that?流式 Markdown 渲染到一半,代码块的围栏只来了一半,你的渲染器应该怎么处理?
Common in ChinaCommon overseasIntermediate#markdown#streaming#rendering🔒 Unlock D2 to see the answer keys.
When should a chat message list auto-scroll to the bottom, and when should it not? State your rule.聊天消息列表什么时候该自动滚到底部,什么时候不该?说出你的判定规则。
Common in ChinaCommon overseasBasic#scroll-behavior#ux#chat-ui🔒 Unlock D2 to see the answer keys.
Your streaming chat never janks locally but users report lag in production. What could explain that?你的流式聊天在本地怎么测都不卡,一上线用户就抱怨界面卡顿。可能是什么原因?
Common in ChinaCommon overseasDeep dive#react-performance#testing#debugging🔒 Unlock D2 to see the answer keys.
D3 Tool Call Visualization and Humans in the Loop: Interruption Is Not Local Interception
Why implement human-in-the-loop approval as run interruption and resumption rather than a frontend modal that blocks the request?为什么人在回路的审批要做成运行中断加恢复,而不是前端弹窗拦住请求?
Common in ChinaCommon overseasDeep dive#human-in-the-loop#security#protocol-design🔒 Unlock D3 to see the answer keys.
Tool call arguments arrive as streamed fragments. What should the UI display before they are complete?工具调用的参数是一段段流式拼出来的,界面在参数还没拼完时应该显示什么?
Common in ChinaCommon overseasIntermediate#tool-calling#streaming#ui-state🔒 Unlock D3 to see the answer keys.
The user rejects a tool call. What should your system do next?用户拒绝了一个工具调用,你的系统接下来应该怎么处理?
Common in ChinaCommon overseasBasic#ux#error-handling#human-in-the-loop🔒 Unlock D3 to see the answer keys.
An agent fires three tool calls concurrently and their events interleave on arrival. How do you keep them straight?Agent 并发发起了三个工具调用,事件交错着到达前端,你怎么保证它们各自归位?
Common in ChinaCommon overseasIntermediate#streaming#state-management#tool-calling🔒 Unlock D3 to see the answer keys.
D4 Reasoning and Shared State: a Collapsible Thinking Panel and Incremental Sync
Should the model's reasoning be shown to users? Collapsed or expanded by default? Justify your choice.模型的推理过程要不要展示给用户?默认收起还是默认展开?说出你的理由。
Common in ChinaCommon overseasIntermediate#reasoning-ui#ux#protocol-design🔒 Unlock D4 to see the answer keys.
Shared state can be sent as full snapshots or as incremental patches. How do you decide which?共享状态既可以每次发完整快照,也可以发增量补丁,你怎么决定用哪种?
Common in ChinaCommon overseasIntermediate#state-sync#protocol-design#architecture🔒 Unlock D4 to see the answer keys.
Your frontend receives a JSON Patch that cannot be applied. What does that tell you, and how do you recover?前端收到一个打不上的 JSON Patch,说明发生了什么?你的恢复策略是什么?
Common in ChinaCommon overseasDeep dive#state-sync#error-handling#json-patch🔒 Unlock D4 to see the answer keys.
What belongs in a shared state panel versus in the conversation itself?什么样的信息该放进共享状态面板,什么样的该留在对话里?
Common in ChinaCommon overseasIntermediate#information-architecture#ux#agent-ui🔒 Unlock D4 to see the answer keys.
D5 Three Paradigms of Generative UI: From Component Mapping to Declarative Interfaces
How much control do the three generative UI paradigms hand to the model, and which would you choose in production?生成式界面的三种范式分别把多少控制权交给模型?你在生产里会选哪种?
Common in ChinaCommon overseasIntermediate#generative-ui#architecture#decision-making🔒 Unlock D5 to see the answer keys.
The model returns a component type you never registered. How should the interface handle it?模型返回了一个你没注册过的组件类型,界面应该怎么处理?
Common in ChinaCommon overseasIntermediate#generative-ui#error-handling#resilience🔒 Unlock D5 to see the answer keys.
What are the risks of having a model generate frontend code that runs in the user's browser, and how would you bound them?让模型直接生成前端代码并在用户浏览器里执行,有哪些风险?你会怎么设边界?
Common in ChinaCommon overseasDeep dive#security#generative-ui#prompt-injection🔒 Unlock D5 to see the answer keys.
Structured output also streams. How should the interface render a JSON payload that is only half complete?结构化输出也是流式生成的,界面在 JSON 只到一半时应该怎么渲染?
Common in ChinaCommon overseasIntermediate#streaming#generative-ui#ui-state🔒 Unlock D5 to see the answer keys.
D6 Session Control and Long Tasks: Stopping, Retrying, Branching, and Subagents
The user clicks stop. Is calling AbortController enough on the frontend? What does the server still need to do?用户点了停止,前端调用中止控制器就够了吗?服务端还需要做什么?
Common in ChinaCommon overseasIntermediate#abort-controller#cost-control#streaming🔒 Unlock D6 to see the answer keys.
Should conversation history be an array or a tree? How do edit-and-resend and branching affect that choice?会话历史用数组还是用树?编辑重发和分支这两个需求会怎么影响你的选择?
Common in ChinaCommon overseasIntermediate#data-structure#session-management#ux🔒 Unlock D6 to see the answer keys.
A stream breaks midway and the client reconnects to resume. How do you prevent duplicate messages?流断在一半,前端重连续播,怎么保证不出现重复的消息?
Common in ChinaCommon overseasDeep dive#resumption#deduplication#streaming🔒 Unlock D6 to see the answer keys.
An agent runs a three-minute task. How do you present progress in the UI?Agent 跑一个三分钟的长任务,界面上你会怎么表现进度?
Common in ChinaCommon overseasIntermediate#long-running-tasks#progress-ui#ux🔒 Unlock D6 to see the answer keys.
D7 Accessibility and Performance Budgets: Making Streaming Interfaces Work for Everyone
Why is pointing a live region at the streaming element wrong, and what should you do instead?为什么把实时区域直接指向流式渲染的元素是错的?正确做法是什么?
Common in ChinaCommon overseasDeep dive#accessibility#aria-live#streaming🔒 Unlock D7 to see the answer keys.
What performance budgets would you set for an agent chat interface, and how would you measure each?你会给一个 Agent 聊天界面设哪几条性能预算?分别怎么测?
Common in ChinaCommon overseasIntermediate#performance#metrics#agent-ui🔒 Unlock D7 to see the answer keys.
When a new message streams in, should keyboard focus follow it? Justify your answer.新消息流式到达时,键盘焦点应该跟着走吗?说出你的判断和理由。
Common in ChinaCommon overseasIntermediate#accessibility#keyboard#focus-management🔒 Unlock D7 to see the answer keys.
Your streaming UI is green across automated tests, yet users report problems with screen readers. What does that tell you?你的流式界面在自动化测试里全绿,但用户报告说屏幕阅读器上有问题。这说明什么?
Common in ChinaCommon overseasDeep dive#testing#accessibility#engineering-practice🔒 Unlock D7 to see the answer keys.