Call Agent.train occurs "TypeError: 'coroutine' object is not iterable"

Please try this below code it may will work.

async def train_core(domain_file: Text = “domain.yml”, model_directory: Text = “models”, model_name: Text = “core”, training_data_file: Text = “data/stories.md”,):

logging.basicConfig(filename=logfile, level=logging.DEBUG)

agent = Agent(
    domain_file,
    policies=[
        MemoizationPolicy(max_history=3),
        KerasPolicy(batch_size=100, epochs=400, validation_split=0.2)
    ]
)
training_data = await agent.load_data(training_data_file)
agent.train(training_data)

# Attention: agent.persist stores the model and all meta data into a folder.
# The folder itself is not zipped.
model_path = os.path.join(model_directory, model_name)
agent.persist(model_path)

if name == ‘main’: loop = asyncio.get_event_loop() loop.run_until_complete(train_core())