# Rasa Python API

**URL:** <https://forum.rasa.com/t/rasa-python-api/45842>\
**Category:** Rasa Open Source\
**Created:** [July 17, 2021, 3:51am UTC](https://forum.rasa.com/t/rasa-python-api/45842 "2021-07-17T03:51:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dragon18456](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@dragon18456](https://forum.rasa.com/u/dragon18456)\
**Post date:** [July 17, 2021, 3:51am UTC](https://forum.rasa.com/t/rasa-python-api/45842/1 "2021-07-17T03:51:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![koaning](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/koaning/32/6626_2.png) [@koaning](https://forum.rasa.com/u/koaning)\
**Post date:** [July 30, 2021, 11:23am UTC](https://forum.rasa.com/t/rasa-python-api/45842/2 "2021-07-30T11:23:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dragon18456](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@dragon18456](https://forum.rasa.com/u/dragon18456)\
**Post date:** [July 30, 2021, 5:55pm UTC](https://forum.rasa.com/t/rasa-python-api/45842/3 "2021-07-30T17:55:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![koaning](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/koaning/32/6626_2.png) [@koaning](https://forum.rasa.com/u/koaning)\
**Post date:** [August 2, 2021, 7:16am UTC](https://forum.rasa.com/t/rasa-python-api/45842/4 "2021-08-02T07:16:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dragon18456](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@dragon18456](https://forum.rasa.com/u/dragon18456)\
**Post date:** [August 2, 2021, 6:16pm UTC](https://forum.rasa.com/t/rasa-python-api/45842/5 "2021-08-02T18:16:45Z")

</div>

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