No message received from RASA custom action

Hi!

I’ve been working on a custom bot which connects to Google Assistant, based on this tutorial: Going beyond hey Google. I have it up and running on Docker with my own domain data. However, when I tried to implement a custom action server in another container, the server is available, but dispatcher.utter_message() doesn’t return the message back to RASA to be forwarded to Google and close the loop.

As shown in the code, I also tried dispatcher.utter_template("utter_dummy", tracker) to check if that returns anything, but no luck. I believe the issue is that I’m not starting the action server correctly, as I don’t call rasa run actions, but when I tried to add this command in docker-compose I get:

“./entrypoint.sh: line 17: exec: actions: cannot execute: Is a directory”

The actions folder contains __init__.py and actions.py

  • docker-compose:
version: '3.0'
services:
  opn_bot_ga:
    image: rasa/rasa:latest
    volumes:
      - ./:/app
    ports:
      - 3001:5004
    command:
      # - train
      - run
      - --enable-api
      - -p
      - "5004"
  action_server:
    image: rasa/rasa-sdk:latest
    ports:
      - 5055:5055
    volumes:
      - ./actions:/app/actions
  • endpoints.yml
action_endpoint:
  url: 'http://action_server:5055/webhook'
  • actions.py
import requests
import json
from rasa_sdk import Action


class ActionTest(Action):
  def name(self):
    # define the name of the action
    return "action_joke"

  def run(self, dispatcher, tracker, domain):
    request = requests.get('http://api.icndb.com/jokes/random').json()  # make an api call
    joke = request['value']['joke']  # extract a joke from returned json response
    dispatcher.utter_message(joke)
   # dispatcher.utter_template("utter_dummy", tracker)
    return []

What rasa version are you using?

Can you please try to specify your actions file directly? E.g. rasa run actions --actions actions/actions.py. Does that help?

Hello,

I am having this same issue. I have set up a minimal Rasa stack using Docker Compose (I overwrote the rasa entrypoint on the rasa/rasa:latest-full image so I could use the commands within the container, since the official Rasa image has rasa as its ENTRYPOINT).

The current versions being pulled from Docker Hub are:

  • Rasa 1.5.0
  • rasa-sdk 1.5.0

After running rasa init to get a base project up and running, I changed the bot_challenge intent to run the custom hello world example action. I added a log statement to the run method of the hello world action. I know that a connection is being made between Rasa Core and the Actions Server, since I get the following output in the Action Server logs when triggering the bot_challenge intent.

However, there is no reply from dispatcher.utter_message. I am using rasa shell to chat with the bot.

2019-11-26 14:32:21 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
2019-11-26 14:32:21 INFO     rasa_sdk.executor  - Registered function for 'action_hello_world'.
2019-11-26 14:32:21 INFO     sanic.root  - Goin' Fast @ http://0.0.0.0:5055
2019-11-26 14:32:21 INFO     sanic.root  - Starting worker [1]
2019-11-26 14:32:33 INFO     actions.actions  - Hello world executed!
2019-11-26 14:32:33 INFO     sanic.access  - 

Any idea why this isn’t working? I can get the bot to respond outside of custom actions.

Here are the relevant files:

docker-compose.yaml

  # Rasa -----------------------------------------
  rasa:
    container_name: rasa
    build:
      context: $HOME/app/rasa/
      dockerfile: docker/Dockerfile
    command: tail -f /dev/null
    ports:
      - 5005:5005
      - 5002:5002
    volumes:
      - $HOME/app/rasa:/app
    restart: always

  # Rasa Action Server--------------------------------
  rasa-actions:
    container_name: rasa-actions
    image: rasa/rasa-sdk:latest
    ports:
      - 5055:5055
    volumes:
      - $HOME/app/rasa/actions:/app/actions
    restart: always

actions/actions.py

import logging
from typing import Any, Text, Dict, List

from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher

# Define logger
log = logging.getLogger(__name__)


class ActionHelloWorld(Action):

    def name(self) -> Text:
        return "action_hello_world"

    def run(self, dispatcher: CollectingDispatcher, tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
        log.info('Hello world executed!')

        dispatcher.utter_message("Hello World!")

        return []
1 Like

Hey Tanja, thanks for your reply. I am using rasa/rasa:latest and rasa/rasa-sdk:latest images from Docker Hub.

I also tried to build the command in docker-compose:

  action_server:
    image: rasa/rasa-sdk:latest
    ports:
      - 5055:5055
    volumes:
      - ./actions:/app/actions
    command:
      - run 
      - actions 
      - --actions 
      - actions/actions.py

but still an error: action_server_1 | ./entrypoint.sh: line 17: exec: actions: cannot execute: Is a directory

Seems really similar to my issue. I also get INFO sanic.access - , but only when I use dispatcher.utter_template()

Hey @Tanja, any thoughts about this issue?

image

This solved this problem for me…

1 Like

Update rasa-sdk to 1.5.1

1 Like

Thanks for the replies and help! Works perfectly after updating.