Scalableminds/chatroom register/load agent issue

I have a python file and place it with rasa bot folder. This file is according to their advanced usage to register the agent. My sequence to start the bot is:

  1. start chatroom: yarn serve
  2. start action server
  3. run rasa_apagent.py: python rasa_apagent.py
  4. start rasa bot: python -m rasa_core.run --enable_api -d models/dialogue -u models/current/nlu --endpoints endpoints.yml --credentials credentials.yml -o out.log

But it returns that OSError: [Errno 48] Address already in use: ('0.0.0.0', 5005)

Anyone know how to solve this issue? Very appreciated.

rasa_apagent.py:

import os
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_utils.bot_server_channel import BotServerInputChannel

#Creating the Interpreter and Agent
def load_agent():
    nlu_interpreter = RasaNLUInterpreter('./models/current/nlu')
    agent = Agent()
    agent = Agent.load('./models/dialogue', interpreter = nlu_interpreter)
    
    return agent
    
#Creating the server
def main_server():
    agent = load_agent()

    channel = BotServerInputChannel(agent, port=5005)
    agent.handle_channels([channel], http_port=5005)


main_server()

I think the port 5005 is allocated to Rasa core, try set the input channel to a different port.

channel = BotServerInputChannel(agent, port=5005)
agent.handle_channels([channel], http_port=5005)

But as their instruction, it should be 5005 because the idea is to register the bot for rasa core, isn’t it?

Huum indeed, the doc states that you should use the port 5005. Maybe an another process is already using this port, can you check ? (networking - How can you find out which process is listening on a port on Windows? - Stack Overflow)

okay the chatroom developer said I can only use either the rasa_core.run or python myscript_for_the_agent.py