Running Rasa straight from python

Hi,

Can I run rasa straight from a python script, as a library or something, instead of having to boot up a server, wait until it has been booted (which takes multiple seconds), then curl a request, then kill the server afterwards?

I read on StackOverflow it used to be possible, but not anymore?

I’ve used this: Agent

In code like this:

import asyncio
from rasa.core.agent import Agent
from rasa.core.interpreter import RasaNLUInterpreter

if __name__ == '__main__':
    agent = Agent.load(model)
    # run an async function in a sync environment
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)
    reply = loop.run_until_complete(agent.parse_message_using_nlu_interpreter(text))
1 Like