Python 3.14+Async programmingterm
asyncio.FutureCallGraph
call graph
A snapshot of the await graph for a task or future: who awaits it (awaited_by) and which frames it is suspended in (call_stack). Returned by capture_call_graph(), 3.14+.
Syntax
graph = asyncio.capture_call_graph(future=None, *, depth=1, limit=None)
It is a frozen dataclass with the fields future, call_stack and awaited_by — data for debugging a stuck program, not a way to control tasks. A normal traceback shows one coroutine's stack, while the graph also sees the chain 'task A awaits task B'. To just look, asyncio.print_call_graph() or python -m asyncio ps PID is enough; Python 3.13 and earlier lack the name.
Examples
import asyncio
async def child():
await asyncio.sleep(0.01)
return asyncio.capture_call_graph()
async def main():
graph = await asyncio.create_task(child(), name='child')
print(type(graph).__name__, graph.future.get_name()) # → FutureCallGraph child
print(len(graph.awaited_by)) # → 1 — её ждёт main
asyncio.run(main())
See also
Open in the full glossarydocs.python.orgReport an inaccuracy