A 311 backend must show progressive reply text while tools fetch ticket status. Which Messages API capability fits?
Select an answer to reveal the explanation.
Short Explanation
Residents hate a frozen spinner. Streaming tokens keeps the chat alive while tools quietly chase ticket status.
Full Explanation
A 311 backend that must show progressive reply text while tools fetch ticket status needs Messages API streaming. Streaming Claude tokens to the resident chat UI while tools fetch status is correct because streaming improves perceived responsiveness: residents see progress instead of a frozen spinner while ticket tools run in interleaved or parallel flows. Conceptually this matches municipal 311 UX expectations—status lookups vary in latency, so the conversation channel should remain live and informative rather than blocked on the full finalization of every tool.
Buffering the full Messages response with tool results before rendering chat text fails by concept: nothing reaches the resident until every tool call and the full reply are complete, which is exactly the frozen-spinner experience streaming exists to avoid. Caching ticket lookup prompts with prompt caching to reuse prior status replies fails the stem: prompt caching speeds up repeated instruction text, but a ticket's status is live and per-resident, so reusing a cached reply risks showing a stale ticket state instead of progressive, current text. Queuing ticket status checks through the Batch API for background completion fails interactivity requirements for live chat: the Batch API is built for asynchronous jobs that complete minutes to hours later, the opposite of progressive, in-conversation replies.
Exam caveat: streaming questions contrast progressive tokens with fully blocked, cached, or batched alternatives that sound efficient but are not interactive. Keep 311 ticket-status framing. Operational check: enable Messages API streaming to the chat UI, keep tool status fetches non-blocking relative to token display where the API pattern allows, measure time-to-first-token, and UX-test with slow ticket tools to confirm residents still see progressive text.