I have reading the Rasa examples created by the Rasa team and please correct me if I’m wrong but in all examples I’ve seen, actions that call external services, perform synchronous http requests. Is this a suggested best practice?
In our use case we will not have many concurrent users but some external HTTP requests will have long running times. For this reason I wanted to use asynchronous HTTP calls to make sure that other users don’t get blocked during the request.
I have implemented HTTP calls using aiohttp but at the moment I am creating a ClientSession whenever an HTTP request to the external service is issued. I would like to reuse the ClientSession, but it’s not clear to me how to create it in the Action object with proper shutdown as it is suggested to be used within a context manager, but that doesn’t play well with Rasa actions (otherwise suggest how to implement).
Also please let me know what are best practices on synchronous vs. asynchronous in the Action server.