Week 1 · D1🔒 LockedAbout 4 hours
What Makes Agent Frontends Hard: an Event Protocol and Your First Stream in the Browser
Start with the three things that separate an agent interface from an ordinary chat interface, meet AG-UI as the open event protocol between backend and frontend, then read your first stream in the browser with plain fetch and ReadableStream, and understand why EventSource fails at step one.
Start with the three things that separate an agent interface from an ordinary chat interface, meet AG-UI as the open event protocol between backend and frontend, then read your first stream in the browser with plain fetch and ReadableStream, and understand why EventSource fails at step one.
Interview questions
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 this chapter 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 this chapter 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 this chapter to see the answer keys.
