SyntaxError in agent handle_text

OS: Linux 4.9.184-linuxkit

Python: 3.6.7

I tried to run the example of agent in Rasa Docs. Agent

from rasa.core.agent import Agent

from rasa.core.interpreter import RasaNLUInterpreter

agent = Agent.load(“examples/restaurantbot/models/current”)

await agent.handle_text(“hello”)

[u’how can I help you?’]

But it came to an SyntaxError: invalid syntax.

Is anyone can help me?

Oops! Looks like our docs are incorrect there, thanks for bringing this up!

You need to import asyncio and run handle_message within the events loop, for instance with:

 import asyncio
asyncio.run(ag.handle_text('hi'))
[{'recipient_id': 'default', 'text': 'Hey! How are you?'}]

Thx, asyncio.run(ag.handle_text('hi')) works after I upgrade python version to 3.7.4.