Endpoints error message with custom actions and rasa shell

As far as docs are incomplete, I follow those guides that we have:

  1. Create a custom action as code with name and run methods filled properly.
  2. Define it in a domain
  3. Add it as an action to a story step
  4. Comment out in endpoints.yml:
    action_endpoint:
    url: "http://localhost:5055/webhook"
  5. Im using PyCharm as IDE, so in separate terminals I pass
    rasa run actions
    and
    rasa shell
    (after training ofcourse).
  6. After shell is loaded I get a prompt for interaction.
  7. When I get into story that uses custom action I always ran into this error:

Traceback (most recent call last): File “c:\programdata\anaconda3\lib\site-packages\rasa\core\processor.py”, line 773, in _run_action output_channel, nlg, temporary_tracker, self.domain File “c:\programdata\anaconda3\lib\site-packages\rasa\core\actions\action.py”, line 673, in run f"Failed to execute custom action ‘{self.name()}’ " rasa.shared.exceptions.RasaException: Failed to execute custom action ‘action_balance_choice’ because no endpoint is configured to run this custom action. Please take a look at the docs and set an endpoint configuration via the --endpoints flag. Custom Actions

When I look at the docs - there are no clues on how to handle that - just a cyclic linking between pages, where one should expect some new issues.

Another question is - do I need (and how) to run any cli command to get any non-model changes to ran into actual state on execution? Like for example changes made to endpoints.yml - how and when those changes become actual to the running program?

Hello,

  1. What’s your Rasa version? (Execute rasa --version)
  2. What’s the chatbot’s directory structure? (Execute command tree /f in the chatbot’s root directory)
  3. Are you running both rasa run actions and rasa shell in the chatbot’s root directory?
  4. What are the logs in the terminal where you ran rasa run actions?

It seems that your domain file and class definition in actions/actions.py don’t match, e.g.:

In actions/actions.py … class MyAction(Action): def name(self): return “action_myaction_in_domain_file”

Please check.

1 Like
  1. Rasa version = 2.8.2

  2. C:.
    │ config.yml
    │ credentials.yml
    │ domain.yml
    │ endpoints.yml
    │ forms.yml
    │ graph.html
    │ responses.yml

    ├───.idea
    │ │ .gitignore
    │ │ misc.xml
    │ │ modules.xml
    │ │ project.iml
    │ │ workspace.xml
    │ │
    │ └───inspectionProfiles
    │ profiles_settings.xml
    │ ├───actions
    │ │ actions.py
    │ │ __ init__.py
    │ │
    │ └───__ pycache__
    │ actions.cpython-37.pyc
    │ __init __.cpython-37.pyc

    ├───data
    │ nlu.yml
    │ rules.yml
    │ stories.yml

    ├───models
    │ 20210819-131501.tar.gz
    │ 20210819-131543.tar.gz
    │ 20210819-183340.tar.gz
    │ 20210819-192634.tar.gz
    │ 20210819-193022.tar.gz
    │ 20210819-193847.tar.gz
    │ 20210820-190849.tar.gz
    │ 20210820-191231.tar.gz

    └───results
    failed_test_stories.yml
    intent_confusion_matrix.png
    intent_histogram.png
    intent_report.json
    stories_with_warnings.yml
    story_confusion_matrix.png
    story_report.json
    TEDPolicy_confusion_matrix.png
    TEDPolicy_report.json

  3. Yes, both are running in bot’s root dir.

  4. Logs are:

2021-08-21 15:39:06 INFO rasa_sdk.endpoint - Starting action endpoint server…
2021-08-21 15:39:06 INFO rasa_sdk.executor - Registered function for ‘action_balance_choice’.
2021-08-21 15:39:06 INFO rasa_sdk.endpoint - Action endpoint is up and running on http://0.0.0.0:5055

domain.py:

actions:

  • ‘…’
  • utter_greet
  • utter_ask_choice
  • action_balance_choice

actions.py:

from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher

class ActionBalanceChoice(Action):
    def name(self) -> Text:
        return "action_balance_choice"

    def run(self, dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

@notrickyd Heya! Did you created the condo environment of python and installed rasa and rasa-sdk then or you working directly install the rasa in project working directory in PyCharm?

As, from the above error, you not created the environment.

@notrickyd Try delete the older trained models and re-train the model and try run.

Do share the information again please.

Hi!
Well yes, i didnt set up separate conda-env. But I used the default env with Conda set up. I also dont remember to install rasa-sdk directly - just rasa install only.

Therefore, it seems there is a mess with default playground project that is downloaded from the rasa.com. After uncommenting the initial lines of action_endpoint seems that url section must strictly be 4 spaces from left, otherwise it is handled as separate option.

When I did that - rasa actions server started to reply with a 500 Internal Server Error. Then I run rasa run actions -vv in debug mode and found from console that there is an error in actions.py on a certain line. When I fix it - everything got fine.

Summary: no reinstall or retrain is needed. Just fixing minor bugs on the web-site of rasa.com.

Also a help might come from this docs: Rasa Action Server Documentation and using Postman to
POST http://localhost:5055/webhook
with a certain payload one can check if the server answers.
Also
GET http://localhost:5055/actions
will show one’s custom actions submitted to server

@notrickyd Nice you solved it by your own, good to know the solution. Good luck with project.

1 Like

@notrickyd What do you mean by this and how to set up this " But I used the default env with Conda set up" ?

@nik202 I already had Conda installed on my PC. And most projects run under Conda project interpreter (Python 3.7 from anaconda directory).

Also from docs follows to first install rasa and only then create virtual envs. I just bypassed creating virtual envs.

Yes, I have a mess on my PC, but I use PC only for “first-steps” purposes. On dev-environment we have separate envs for separate projects.

@notrickyd Ok!