Python for AIIntermediate18 October 2026
A Python API streams model output to clients. How should it detect that a client has disconnected?
Pick an answer to see the explanation.
Answer
Check cancellation or disconnect signals and stop upstream work
Propagating cancellation prevents unnecessary model usage after the consumer disappears. The service should also close resources cleanly and record a bounded operational event.
Learn more: Explore AI automation with Python →