# Creating Custom Policy

**URL:** <https://forum.rasa.com/t/creating-custom-policy/25751>\
**Category:** Rasa Open Source\
**Created:** [March 6, 2020, 2:13pm UTC](https://forum.rasa.com/t/creating-custom-policy/25751 "2020-03-06T14:13:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![karnehm](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@karnehm](https://forum.rasa.com/u/karnehm)\
**Post date:** [March 6, 2020, 2:13pm UTC](https://forum.rasa.com/t/creating-custom-policy/25751/1 "2020-03-06T14:13:57Z")

</div>

Hello,

Is there any posibility to implement a custom policy. At the Documentation it looks like i could implement my own policy and import this at `config.yml`.

I looked at the Rasa-Source code and it looks like the policys must registered at `rasa/core/policies/registry.py` is this correct? Actually I implement my custom policy as a extension directly in Rasa-Core, but it feels wrong. I hope there’s a better solution to this.

The reason to do this is a research within my master thesis. I am looking for a framework where I could implement a Reainforcement Learning policy and compare it with already used policys, like the standard `kerasPolicy`.

I would very much appreciate your help.

Dominic Karnehm

---

<div class="post-metadata">

**Author:** ![chkoss](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chkoss/32/7186_2.png) [@chkoss](https://forum.rasa.com/u/chkoss)\
**Post date:** [March 9, 2020, 12:19pm UTC](https://forum.rasa.com/t/creating-custom-policy/25751/2 "2020-03-09T12:19:44Z")

</div>

Hello @karnehm,

Yes, you can implement a custom policy. Just write your own class that inherits from `rasa.core.policies.Policy` and add the policy to `config.yml` as described in the [docs](https://rasa.com/docs/rasa/core/policies/#id7). The policy’s name in `config.yml` should simply be the path to your policy class.

You don’t have to modify `rasa/core/policies/registry.py` or to write anything else directly in Rasa-Core.

Does this answer your question?

---

<div class="post-metadata">

**Author:** ![karnehm](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@karnehm](https://forum.rasa.com/u/karnehm)\
**Post date:** [March 9, 2020, 2:11pm UTC](https://forum.rasa.com/t/creating-custom-policy/25751/3 "2020-03-09T14:11:43Z")

</div>

Thank you @chkoss,

now it worked. I used an incorrect policy Path and forgot to implement ` __init__.py` .

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![basil-chatha](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/basil-chatha/32/9260_2.png) [@basil-chatha](https://forum.rasa.com/u/basil-chatha)\
**Post date:** [October 1, 2020, 12:19am UTC](https://forum.rasa.com/t/creating-custom-policy/25751/4 "2020-10-01T00:19:57Z")

</div>

@chkossThanks for this. I am trying to do this with rasa x in production using Docker. Where do I need to mount the file where my policy resides for it to work correctly?

---

<div class="post-metadata">

**Author:** ![arneverster](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/arneverster/32/9376_2.png) [@arneverster](https://forum.rasa.com/u/arneverster)\
**Post date:** [October 5, 2021, 8:21am UTC](https://forum.rasa.com/t/creating-custom-policy/25751/5 "2021-10-05T08:21:28Z")

</div>

Did you manage to solve this?
