You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Rasa自定义动作action_joke运行失败:无法连接动作服务器

Troubleshooting Rasa Custom Action Connection Failure

It looks like your Rasa bot is having trouble connecting to the action server that runs your custom action_joke action. Let's break down the problem and fix it step by step.

First, here's the custom action code you're using to fetch jokes:

import requests
import json
from rasa_core_sdk import Action, Tracker
class ActionJoke(Action):
    def name(self):
        return "action_joke"
    def run(self, dispatcher, tracker, domain):
        request = requests.get('http://api.icndb.com/jokes/random').json()
        joke = request['value']['joke']
        dispatcher.utter_message(joke)
        return []

The error logs show the core issue:

2020-04-09 15:37:06 ERROR rasa.core.actions.action - 无法运行自定义动作'action_joke'。无法连接到服务器'http://localhost:5055/webhook'。服务器是否正在运行?错误信息:无法连接到主机localhost:5055 ssl:default [连接调用失败('127.0.0.1', 5055)]
2020-04-09 15:37:06 ERROR rasa.core.processor - 运行动作'action_joke'时遇到异常。机器人将继续运行,但动作事件已丢失。请检查动作服务器的日志以获取更多信息。

This means your Rasa core bot can't reach the separate action server that executes custom actions. Here's how to resolve this:

  • Start the Rasa Action Server: Custom actions don't run alongside the core bot by default—you need to launch the action server separately. Open a terminal, navigate to the directory where your action.py file lives, and run:

    rasa run actions
    

    This starts the server on localhost:5055 (the default endpoint your bot is trying to use).

  • Verify the Action Server is Active: Confirm the server is running by checking the endpoint with curl or your browser:

    curl http://localhost:5055/webhook
    

    You should get a {"status":"ok"} response if it's working correctly.

  • Check Endpoint Configuration: Make sure your endpoints.yml file has the correct action endpoint setup. It should include:

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

    If you changed the port/host for the action server, update this URL to match.

  • Restart Your Rasa Bot: After starting the action server, restart your core Rasa instance to ensure it establishes the connection properly.

Once these steps are done, your bot should successfully connect to the action server, run action_joke, and fetch random jokes for users.

内容的提问来源于stack exchange,提问作者Biman Pal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 09:47:57