Run an async entrypoint
Execute a top-level coroutine and manage the event loop automatically.
import asyncio
async def main():
print("hello")
await asyncio.sleep(1)
print("world")
asyncio.run(main())Use `asyncio.run()` for most top-level programs. It creates the event loop, runs the coroutine, and closes the loop.