# Implenmenting custom two stage fallback

**URL:** <https://forum.rasa.com/t/implenmenting-custom-two-stage-fallback/39629>\
**Category:** Rasa Open Source\
**Created:** [January 29, 2021, 6:18pm UTC](https://forum.rasa.com/t/implenmenting-custom-two-stage-fallback/39629 "2021-01-29T18:18:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![harloc](https://avatars.discourse-cdn.com/v4/letter/h/73ab20/32.png) [@harloc](https://forum.rasa.com/u/harloc)\
**Post date:** [January 29, 2021, 6:18pm UTC](https://forum.rasa.com/t/implenmenting-custom-two-stage-fallback/39629/1 "2021-01-29T18:18:46Z")

</div>

Hello everyone,

I checked the forum and read the documentation, but the following question still puzzles me:

I want to implement custom answers for the two stage fallback. As I unterstand, to do so it requires the following: Write a rule for the `nlu_fallback` which triggers the `action_two_stage_fallback`

Implement custom versions of `utter_default` and `utter_ask_rephrase` as these will be be the appropriate Rasa class `ActionDefaultAskAffirmation`

At last it is necessary to create a custom version of the class `ActionDefaultAskAffirmation` which is commented in the source code:

> Default implementation which asks the user to affirm his intent. It is suggested to overwrite this default action with a custom action to have more meaningful prompts for the affirmations. E.g. have a description of the intent instead of its identifier name.

But how do I overwrite this class? It is possible to overwrite classes or part of them, for example: import MyClass def my\_new\_function(): … MyClass.old\_function = my\_new\_function

But how do I put this to use within Rasa? Or is the solution to create a custom action and just give it the appropriate name by implementing the function:

```
def name(self) -> Text:
    return ACTION_DEFAULT_ASK_AFFIRMATION_NAME

```

Will rasa then preferably use this new function, when its run on an action server.

So what is the best way to get a custom version of the “ask affirmation” function?

I appreciate every help

Thanks everybody!

---

<div class="post-metadata">

**Author:** ![user0042](https://avatars.discourse-cdn.com/v4/letter/u/dc4da7/32.png) [@user0042](https://forum.rasa.com/u/user0042)\
**Post date:** [April 13, 2021, 2:15am UTC](https://forum.rasa.com/t/implenmenting-custom-two-stage-fallback/39629/2 "2021-04-13T02:15:00Z")

</div>

Yes, you have to create an action with the name property set to “action\_default\_ask\_affirmation” You also have to add action\_default\_ask\_affirmation to your domain file and retrain it. Then update your config.yml and rules.yml as stated in the docs.

---

<div class="post-metadata">

**Author:** ![m-vdb](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/m-vdb/32/10526_2.png) [@m-vdb](https://forum.rasa.com/u/m-vdb)\
**Post date:** [April 21, 2021, 9:22am UTC](https://forum.rasa.com/t/implenmenting-custom-two-stage-fallback/39629/3 "2021-04-21T09:22:30Z")

</div>

In addition to @user0042 's reply, here’s [the documentation](https://rasa.com/docs/action-server/sdk-actions) that can be helpful to write custom actions. And you can find instruction to run the custom action server here: [Running a Rasa SDK Action Server](https://rasa.com/docs/action-server/running-action-server)
