Async & the event loop

Every route so far has been def, not async def

Look back at list_walkers โ€” it's a plain def, not async def. That's allowed, and FastAPI handles it well: it runs ordinary def route functions in a small thread pool, so a slow one doesn't block other requests. async def is for a different situation: I/O-bound work โ€” waiting on a network call, a database query, or a file read โ€” where the function can pause while waiting and let the event loop handle other requests in the meantime.

The rule of thumb: I/O-bound (waiting on something external โ€” network, disk, another service) benefits from async def + await. CPU-bound (actually crunching numbers on the CPU) doesn't benefit from async at all โ€” it still blocks the event loop while it runs, async keyword or not.