Action Server API always response 500

Hello Community,

i have several bots running and a lot of custom actions, everything is working fine. For a new use case i want use the ActionServer API to call an action directly, not via rasa core.

When i follow the instruction on Rasa Action Server Documentation, i’m always get the 500 response code. What i’m doing wrong? To keep it simple, i’m trying the API-Call with the action_hello_word from the initial rasa project.

Any idea? Best Regards

URL (POST Method)

http://localhost:5055/webhook

endpoint file

action_endpoint
 url: "http://localhost:5055/webhook"

JSON-Payload

{
  "next_action": "action_hello_world",
  "sender_id": "demo",
  "tracker": {
    "conversation_id": "default"},
  "domain": {
    "config": {
      "store_entities_as_slots": false
    },
    "actions": [
      "action_hello_world"
    ]
  }
}

JSON-Response

{
    **"error": "'sender_id'",**
    "request_body": {
        "next_action": "action_hello_world",
        "sender": "demo",
        "tracker": {
            "conversation_id": "default"
        },
        "domain": {
            "config": {
                "store_entities_as_slots": false
            },
            "actions": [
                "action_hello_world"
            ]
        }
    }
}

Rasa Version

(rasa28test) user1@vboxdev:~/rasatest$ rasa --version
Rasa Version      :         3.3.1
Minimum Compatible Version: 3.0.0
Rasa SDK Version  :         3.3.0
Python Version    :         3.8.10
Operating System  :         Linux-5.15.0-46-generic-x86_64-with-glibc2.29
Python Path       :         /home/user1/rasa28test/bin/python

Action-Server Log-Output

^C(rasa28test) user1@vboxdev:~/rasatest$ python3 -m rasa_sdk --actions actions -p 5055 --debug
2022-11-11 15:54:33 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
2022-11-11 15:54:33 INFO     rasa_sdk.executor  - Registered function for 'action_hello_world'.
2022-11-11 15:54:33 INFO     rasa_sdk.endpoint  - Action endpoint is up and running on http://0.0.0.0:5055
2022-11-11 15:54:33 DEBUG    rasa_sdk.utils  - Using the default number of Sanic workers (1).
/home/user1/rasa28test/lib/python3.8/site-packages/rasa_sdk/utils.py:178: UserWarning: You are using an old version of rasa which might not be compatible with this version of rasa_sdk (3.3.0).
To ensure compatibility use the same version for both, modulo the last number, i.e. using version A.B.x the numbers A and B should be identical for both rasa and rasa_sdk.
  warnings.warn(
2022-11-11 15:54:48 DEBUG    rasa_sdk.executor  - Received request to run 'action_hello_world'
2022-11-11 15:54:48 ERROR    rasa_sdk.endpoint  - Exception occurred during execution of request <Request: POST /webhook>
Traceback (most recent call last):
  File "handle_request", line 83, in handle_request
    )
  File "/home/user1/rasa28test/lib/python3.8/site-packages/rasa_sdk/endpoint.py", line 104, in webhook
    result = await executor.run(action_call)
  File "/home/user1/rasa28test/lib/python3.8/site-packages/rasa_sdk/executor.py", line 394, in run
    tracker = Tracker.from_dict(tracker_json)
  File "/home/user1/rasa28test/lib/python3.8/site-packages/rasa_sdk/interfaces.py", line 28, in from_dict
    state["sender_id"],
KeyError: 'sender_id'

…i’ve found the problem. The log entry below guided me to the right place.

File "/home/user1/rasa28test/lib/python3.8/site-packages/rasa_sdk/interfaces.py", line 28, in from_dict
    state["sender_id"],
KeyError: 'sender_id'

The request example in the documentation is not correct.

In the documentation …the key sender_id is in the first level of the json.

{
    "next_action": "action_hello_world",
    "sender_id": "demo",
    "tracker": {
        
        "conversation_id": "default",
        "slots": {
            "myslot": "blabla"
        }
    },
    "domain": {
        "config": {
            "store_entities_as_slots": false
        },
        "actions": [
            "action_hello_world"
        ]
    }
}

But the key sender_id has to be part of the tracker object. This expression is working…

{
    "next_action": "action_hello_world",
    "tracker": {
        "sender_id": "demo",
        "conversation_id": "default",
        "slots": {
            "myslot": "blabla"
        }
    },
    "domain": {
        "config": {
            "store_entities_as_slots": false
        },
        "actions": [
            "action_hello_world"
        ]
    }
}

Please correct your documentation.

I appreciate the information and advice you have shared.