End session request

Ahh, okay! In that case, the end_session endpoint wouldn't work because it really just refers to the internal annotation session rather than the Python session.

If you need to stop the process from Python, you could try something like this and just kill the server on the port you're running Prodigy on:

Alternatively, if you can call into the Jupyter kernels, you could try an approach like the one we're using in our jupyterlab-prodigy extension: