What does it do?
Trio handles async concurrency, letting a single Python program juggle many tasks at once, like network requests, without needing a separate thread for each one, similar to how a single skilled waiter can serve many tables by never standing idle at any one of them. What sets Trio apart from Python’s built-in asyncio is a design principle called structured concurrency, which makes it much harder to accidentally lose track of a task still running in the background, a common source of subtle async bugs. It was built specifically to be more predictable and harder to misuse than what came before it.
See it in action
This runs two simple greeting tasks at the same time, each pausing for a bit before printing its message, showing how the program can juggle multiple things at once.
import trio
async def say(text, delay):
await trio.sleep(delay)
print(text)
async def main():
async with trio.open_nursery() as nursery:
nursery.start_soon(say, "hello", 1)
nursery.start_soon(say, "world", 2)
trio.run(main)
Why would a non-developer care?
Anyone who’s dealt with an app that seems to hang unpredictably or leak resources over time has felt the consequences of concurrency bugs. Trio’s whole reason for existing is making that entire category of bug structurally harder to write in the first place.
Real-world examples
Trio was created by Nathaniel J. Smith, and its ideas around structured concurrency were influential enough that other concurrency tools, including improvements to Python’s own asyncio, have borrowed concepts from it. It’s used by projects that specifically want its safety guarantees, including parts of the networking-focused Python ecosystem like httpx, which can run on either asyncio or Trio.
Who uses it
Python developers building networking or I/O-heavy applications who want strict, safety-focused concurrency rather than the more permissive style of asyncio.
How it compares to alternatives
Its main point of comparison is Python’s built-in asyncio module, which Trio deliberately diverges from on core design principles rather than trying to be a drop-in replacement. AnyIO exists partly to let libraries support both asyncio and Trio through one interface.