from rasa.core.agent import Agent model_directory = "/path/to/your/model" # Load the agent agent = Agent.load(model_directory)
user_input = "Hello" sender_id = "my_user" # Get the agent's response response = agent.handle_text(user_input, sender_id) # Print the response print(response[0]["text"])In this example, we pass in some user input (`"Hello"`) and a `sender_id` to identify the user. We then call the `handle_text` method on the `agent`, which will return a list of response messages. We print the first (and typically only) message using the `"text"` key. `rasa.core.agent` is part of the Rasa Open Source framework, which is a Python library for building AI assistants and chatbots. It can be installed using `pip` with the command `pip install rasa`.