Agents in the UI
When one question becomes ten steps over several minutes: plans, progress, leaving and returning, stopping, MCP tools, several agents on one screen, and a refund the user can audit.
Until now one question meant one answer, even when a tool ran in the middle. An agent is different: it plans, calls tool after tool, reads each result, changes its mind and keeps going until the job is done. One request can mean ten model calls and several minutes. The screen has to show what is happening, let the user leave and come back, and keep the user in charge.
This phase uses the real Vercel AI SDK: ToolLoopAgent, createAgentUIStreamResponse, step and tool parts, data parts for progress, and resumable streams. You will show a plan and its steps, survive a closed tab, stop a run at step three, take a corrected instruction, read what the Model Context Protocol (MCP) is from a frontend's point of view, and draw several agents without drowning the user in noise.
Every example runs the real SDK against a scripted stand-in model, so nothing here needs a key, and each one prints the same thing every time. By the end, Mitra can handle a multi-step refund: a plan, live progress, an approval before money moves, and a receipt the user can audit.
Practise this phase
Hands-on exercises: write the code, see your page live, and press Check to have it tested automatically.