Rasa Python API

So I have been building an agent for Rasa using the command line i.e. rasa train, rasa run actions, rasa shell etc. and now I want to try and interface with it with my website. However, is there a way for me to run it in conjunction with my personal Flask backend? Basically, is there a way to create agents and run rasa nlu and core in a regular python script, and just cache the agent and history as a variable in python?

Also, is there a way to set a timeout for my agent? Basically, after like a couple minutes of doing nothing, I want the agent to just delete old sessions to save memory so I am not memorizing the state of every single conversation forever

You could build everything with python, but it’s much easier to just run rasa run --enable-api and uses that as a service instead. If you’d like to run flask beside it, maybe just run both services via docker-compose? Any reason why you’d like to have flask interact with Rasa as opposed to hosting Rasa via a web interface directly?

Is there a reason why you’re not using a database? The in-memory trackers are meant for local mode, if you are running production you’d typically use a database/cache for that.

My usecase is running my assistant at the edge, without using any cloud provisions to reduce bandwidth and memory utilization. Running a whole process at another post probably isn’t great.

You’d like to run it in something like cloud functions?

No, I want to run all of Rasa, locally, at the edge, without having a whole process running at a different endpoint.