Rasa.core.agent import Agent Issue

I am using Rasa Version 2.1.0 and I seem to be getting an issue when I import Agent. This is the error I receive:

TypeError Traceback (most recent call last)

[<ipython-input-70-8f67cf765ed0>](https://localhost:8080/#) in <module>() ----> 1 from rasa.core.agent import agent 2 3 # loading the Core training samples 4 ##training_data = load_data("stories.md") 5

9 frames

[/usr/local/lib/python3.6/dist-packages/rasa/core/agent.py](https://localhost:8080/#) in <module>() 27 from rasa.core.lock_store import InMemoryLockStore, LockStore 28 from rasa.core.nlg import NaturalLanguageGenerator ---> 29 from rasa.core.policies.ensemble import PolicyEnsemble, SimplePolicyEnsemble 30 from rasa.core.policies.memoization import MemoizationPolicy 31 from rasa.core.policies.policy import Policy, PolicyPrediction

[/usr/local/lib/python3.6/dist-packages/rasa/core/policies/__init__.py](https://localhost:8080/#) in <module>() 3 4 # and after that any implementation ----> 5 from rasa.core.policies.ensemble import SimplePolicyEnsemble, PolicyEnsemble

[/usr/local/lib/python3.6/dist-packages/rasa/core/policies/ensemble.py](https://localhost:8080/#) in <module>() 38 from rasa.core.policies.fallback import FallbackPolicy 39 from rasa.core.policies.memoization import MemoizationPolicy, AugmentedMemoizationPolicy ---> 40 from rasa.core.policies.rule_policy import RulePolicy 41 from rasa.shared.core.trackers import DialogueStateTracker 42 from rasa.shared.core.generator import TrackerWithCachedStates

[/usr/local/lib/python3.6/dist-packages/rasa/core/policies/rule_policy.py](https://localhost:8080/#) in <module>() 41 from rasa.shared.core.domain import InvalidDomain, State, Domain 42 from rasa.shared.nlu.constants import ACTION_NAME, INTENT_NAME_KEY ---> 43 import rasa.core.test 44 import rasa.core.training.training 45

[/usr/local/lib/python3.6/dist-packages/rasa/core/test.py](https://localhost:8080/#) in <module>() 10 from rasa.shared.exceptions import RasaException 11 import rasa.shared.utils.io ---> 12 from rasa.core.channels import UserMessage 13 from rasa.shared.nlu.training_data.message import Message 14 from rasa.shared.core.training_data.story_writer.yaml_story_writer import (

[/usr/local/lib/python3.6/dist-packages/rasa/core/channels/__init__.py](https://localhost:8080/#) in <module>() 16 from rasa.core.channels.botframework import BotFrameworkInput # nopep8 17 from rasa.core.channels.callback import CallbackInput # nopep8 ---> 18 from rasa.core.channels.console import CmdlineInput # nopep8 19 from rasa.core.channels.facebook import FacebookInput # nopep8 20 from rasa.core.channels.mattermost import MattermostInput # nopep8

[/usr/local/lib/python3.6/dist-packages/rasa/core/channels/console.py](https://localhost:8080/#) in <module>() 6 7 import aiohttp ----> 8 import questionary 9 from aiohttp import ClientTimeout 10 from prompt_toolkit.styles import Style

[/usr/local/lib/python3.6/dist-packages/questionary/__init__.py](https://localhost:8080/#) in <module>() 3 4 import questionary.version ----> 5 from questionary.form import Form 6 from questionary.form import form 7 from questionary.prompt import prompt

[/usr/local/lib/python3.6/dist-packages/questionary/form.py](https://localhost:8080/#) in <module>() 1 from collections import namedtuple 2 ----> 3 from questionary.constants import DEFAULT_KBI_MESSAGE 4 from questionary.question import Question 5

[/usr/local/lib/python3.6/dist-packages/questionary/constants.py](https://localhost:8080/#) in <module>() 39 ("selected", ""), # style for a selected item of a checkbox 40 ("separator", ""), # separator in lists ---> 41 ("instruction", ""), # user instructions for select, rawselect, checkbox 42 ] 43 )

TypeError: object() takes no parameters

Please help me out I am stuck. I’ve tried changing the Rasa version and still nothing.

Hi @IsraaMohamedHamid. When do you get this error? Is it when you run rasa train? Do you get the same issue when you are just initialising new Rasa project with rasa init?

I’m using google Colab. It appears after this code:

from rasa.core.interpreter import RasaNLUInterpreter 
from rasa.core.policies.policy import *
from rasa.core.agent import Agent
from rasa.core import training

agent = Agent('domain.yml', policies=[MemoizationPolicy(),  MappingPolicy(), TEDPolicy()])

# Configuration for Rasa Core.

# https://rasa.com/docs/rasa/core/policies/

# loading our neatly defined training dialogues

training_data = agent.load_data('stories.md')

agent.train(

    training_data,

    validation_split=0.2,

    epochs=200, 

    max_history= 5
)

agent.persist('models/dialogue')

Hi @IsraaMohamedHamid. It appears to me that you are using a snipped of code written for an old version of Rasa. Could you test your assistant in a command line and use rasa train function for training the model and rasa shell for testing an assistant?

I’ve tried in using cmd line and it works however I need it work for colab as well so I was wondering what the alternative of Agent is for the new version of Rasa? Also I’ve tired using this code rasa.core.train('domain.yml', 'stories.md', 'rasa_Core_models') and I’m not sure I think it trainings but it doesn’t save the result.