The job was to return one eventual recommendation without holding the agent inside a single screen or request.
Read AI Customer Support Assistant →Why I used long polling for AI recommendations
A normal synchronous request was the simplest option, but AI response time could outlast a comfortable UI wait. Holding the request open would tie navigation to the model and make a slow dependency feel like a frozen support tool.
WebSockets and server-sent events were worth considering. Both can deliver updates efficiently, but this workflow did not need a continuous stream. It needed the final state of a known request. A persistent connection would add connection recovery, routing, and operational work without changing the agent experience much.
Long polling fit the shape of the problem. The UI could start a request, move on, and ask for its state later. Existing HTTP authentication and monitoring still applied. The cost was more request traffic, so polling had to be bounded, stop on terminal states, and back off when the result was not ready.
Choose communication patterns around the interaction, not trendiness.
Model pending and terminal states before writing the loading UI.
A simpler protocol still needs limits, correlation, and cleanup.