# Python async def is lazy until you await

> Calling async def returns a coroutine object. Nothing runs until you await it or schedule it on the event loop.

Source: https://fullbytedeveloper.com/blog/python-async-def-is-lazy
Published here: 2026-11-26, updated 2026-12-03

Calling an `async def` function does not run its body. Per the language reference, `async def` always defines a coroutine function, even when the body has no `await`, and the call returns a coroutine object that stays idle until you await it or schedule it on the event loop [1][2].

## Call the function and print the type

Build a tiny coroutine, call it once without awaiting, then finish it with `asyncio.run` [2]:

```python title="async_lazy.py"
import asyncio

async def work():
    print("body ran")
    return 42

coro = work()
print(type(coro).__name__)
print(asyncio.run(coro))
```

```bash
python3 async_lazy.py
```

Captured output:

```text
coroutine
body ran
42
```

The first line is the type name of the object you built. The print inside `work` appears only after `asyncio.run` drives the coroutine to completion [2]. If you stop after `work()` and never await, CPython later emits `RuntimeWarning: coroutine was never awaited` when the object is collected [2].

## See call versus await on one diagram

<figure>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 260" role="img" aria-label="Calling async def builds a coroutine; await or asyncio.run runs the body">
  <defs>
    <marker id="arrowAsyncLazy" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto">
      <path d="M0,0 L8,3 L0,6 Z" fill="#14b8a6"/>
    </marker>
  </defs>
  <rect x="0" y="0" width="720" height="260" rx="12" fill="#0b1f3a"/>
  <text x="24" y="36" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="16" font-weight="700">async def work(): ...</text>
  <rect x="24" y="56" width="160" height="64" rx="8" fill="#123052" stroke="#64748b" stroke-width="2"/>
  <text x="36" y="84" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">1. call work()</text>
  <text x="36" y="104" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">body still idle</text>
  <path d="M196 88 H244" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#arrowAsyncLazy)"/>
  <rect x="252" y="56" width="200" height="64" rx="8" fill="#123052" stroke="#14b8a6" stroke-width="2"/>
  <text x="264" y="84" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">2. coroutine object</text>
  <text x="264" y="104" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">type name: coroutine</text>
  <path d="M464 88 H512" stroke="#14b8a6" stroke-width="3" fill="none" marker-end="url(#arrowAsyncLazy)"/>
  <rect x="520" y="56" width="176" height="64" rx="8" fill="#123052" stroke="#f59e0b" stroke-width="2"/>
  <text x="532" y="84" fill="#f59e0b" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">3. await / run</text>
  <text x="532" y="104" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">body prints</text>
  <rect x="24" y="148" width="672" height="84" rx="8" fill="#123052" stroke="#64748b" stroke-width="2"/>
  <text x="36" y="180" fill="#f8fafc" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">Discarding the object without await leaves the body untouched and later trips</text>
  <text x="36" y="204" fill="#cbd5e1" font-family="ui-sans-serif, system-ui, sans-serif" font-size="14">RuntimeWarning: coroutine was never awaited [2]</text>
</svg>
</figure>

*The call builds an awaitable; only await, create_task, or asyncio.run moves the body forward.*

## Drop a coroutine on purpose and read the warning

```python title="never_awaited.py"
import asyncio
import warnings

warnings.simplefilter("always")

async def boom():
    print("should not print without await")

async def main():
    boom()

asyncio.run(main())
```

```bash
python3 never_awaited.py
```

Captured output (warning text may wrap):

```text
... RuntimeWarning: coroutine 'boom' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
```

The string `should not print without await` never appears. That is the silent-failure shape the asyncio docs call out: you built an object and threw it away [2].

## Remember where await is legal

The language reference states that `await` expressions, `async for`, and `async with` may only appear inside a coroutine function [1]. Coroutines can suspend and resume at many points; that suspension is why the call alone is not enough [1][3].

Practical map:

1. `work()` returns a coroutine object; the body is idle.
2. `await work()` inside another `async def` runs until the next await point or return.
3. `asyncio.run(work())` is the usual script entry that owns the loop [2].
4. `asyncio.create_task(work())` schedules concurrent progress with other tasks [2].

## Catch the shapes that drop work

These patterns all create coroutine objects and then ignore them [2]:

1. A sync helper that calls `work()` with no `asyncio.run`.
2. A list comprehension that builds coroutines and never awaits (`[work() for _ in range(3)]`).
3. A web handler that returns a coroutine by mistake instead of awaiting it.
4. `print(work())`, which prints a coroutine repr and never runs the body.

When concurrency is the goal, schedule with `create_task` (or gather) instead of calling and dropping. Sequential `await` finishes near the sum of delays; overlapping tasks finish closer to the longest delay. The timed comparison lives in [Python create_task vs await](/blog/python-create-task-vs-await) [2].

## When not to reach for async def

Skip `async def` when the function only does CPU work with no awaitable I/O. A coroutine function that never awaits still returns a coroutine object, so callers must still await or schedule it, and you gain no overlap [1]. Prefer a plain `def` for pure sync helpers. If the bottleneck is CPU on classic CPython, see [Python GIL threads are not parallel](/blog/python-gil-threads-not-parallel). For overlap versus same-core speedup vocabulary, see [Concurrency vs parallelism](/blog/concurrency-vs-parallelism-plain).

## Compare runtimes without mixing claims

Python's model is await-and-schedule. JavaScript queues promise work on a single call stack ([JavaScript promises event loop quick start](/blog/javascript-promises-event-loop-quick-start)). Go starts work with `go` and has no await keyword in the same shape ([Goroutines vs coroutines](/blog/goroutines-vs-coroutines), [Go without async await](/blog/go-without-async-await)).

## Trace one suspension point

Await is a suspension point. The coroutine yields control back to the event loop so other ready tasks can run, then resumes when the awaited thing completes [2][3]. That is different from starting a new OS thread. On classic CPython you still share one interpreter lock for bytecode; async helps when you spend time waiting on I/O, not when you burn CPU in a tight loop [1].

```python title="sleep_once.py"
import asyncio
import time

async def nap(label, seconds):
    print(f"{label} start")
    await asyncio.sleep(seconds)
    print(f"{label} done")
    return label

async def main():
    t0 = time.perf_counter()
    await nap("solo", 0.05)
    print(f"solo wall={time.perf_counter() - t0:.3f}s")

asyncio.run(main())
```

```bash
python3 sleep_once.py
```

A typical capture looks like:

```text
solo start
solo done
solo wall=0.051s
```

The wall time sits near the sleep delay because nothing else ran in parallel. Replace the single await with two tasks if you want overlap; that comparison belongs on the create_task page [2].

## Read the glossary once

The glossary defines a coroutine as an object that can be entered, exited, and resumed at many points, and notes that `async def` is how you implement them in Python [3]. That definition is why logging `repr(coro)` is useless as a "did it run?" check: the repr only proves the object exists. Side effects live in the body, and the body starts after await or scheduling [1][3].

Library authors sometimes return awaitables that are not native coroutines (custom objects with `__await__`). Callers still must await them. The mental model stays the same: building the object is not running the work [2].

## Debug with warnings and types

Turn warnings into errors in local scripts when you are hunting dropped work:

```python title="warn_as_error.py"
import asyncio
import warnings

warnings.filterwarnings("error", category=RuntimeWarning, module="asyncio")

async def orphan():
    return "lost"

async def main():
    orphan()

try:
    asyncio.run(main())
except RuntimeWarning as err:
    print("caught:", err)
```

When that path raises, you get a hard failure at the point the coroutine dies unused instead of a log line you might miss. In production frameworks, prefer the framework's task factory and exception handlers so orphaned tasks surface in metrics [2].

A second quick check is `inspect.iscoroutine(obj)` or a plain `type(obj).__name__` print. If a handler "returns" a coroutine to a sync WSGI stack, you will see the type name in logs and an empty or wrong HTTP body. Await inside the async view, or schedule explicitly, before the response is finalized [2].

## Pair with create_task when overlap matters

Sequential awaits are correct when step two needs step one's result. They are the wrong default when two independent network calls can proceed together. `asyncio.create_task` schedules a Task so the loop can interleave them [2]. Gather or TaskGroup patterns then wait for the set. Keep cancellation and exception handling in mind: a failed sibling can leave others running unless you cancel or use a structured group [2].

Do not create tasks and then exit the process without awaiting them. Fire-and-forget without a sink is how you reintroduce the never-awaited class of bugs at task scale [2].

## Mistakes that keep printing nothing

Calling `async def` from sync code and treating the return value as the result. You hold a coroutine, not `42`.

Swallowing `RuntimeWarning` in test suites so never-awaited bugs stay silent [2].

Wrapping CPU-only helpers in `async def` and then wondering why `create_task` does not speed them up [1].

Using `await` in a plain `def`. The language reference rejects that placement [1].

Nesting `asyncio.run` inside a library helper while an outer loop already exists. Keep `asyncio.run` at the process entry and await from there [2].

Building a list of coroutines and iterating the list without awaiting each item. The list holds objects; nothing runs until each one is awaited or scheduled [2].

Returning a coroutine from a sync callback that a framework never awaits. The type looks fine in a debugger until you notice the body never printed [2].

## What to try next

Print `type(result)` whenever an "async function did nothing" ticket lands. If the type name is `coroutine`, decide among `await`, `asyncio.run`, or `create_task` before you dig into network failures. Keep the never-awaited warning turned on in local runs so the garbage collector reports the miss early [2]. For the concurrent scheduling story, open [Python create_task vs await](/blog/python-create-task-vs-await). For vocabulary about overlap versus parallel CPU, open [Concurrency vs parallelism](/blog/concurrency-vs-parallelism-plain).

Browse the [Dev explainers topic](https://fullbytedeveloper.com/blog/topic/dev-explainers).

Send this to the friend who calls async functions and wonders why nothing prints.

Image: Dark matte cube on a grid floor with one gold arrow entering from the left and three mint-green arrows leaving in different directions, flanked by curved control tracks with gold knobs and a tall translucent glass ring in front.
https://fullbytedeveloper.com/media/python-async-def-is-lazy/python-async-def-is-lazy-venice.webp
Calling async def only builds the object; the body stays idle until await or the event loop actually drives it.

## Sources

1. [Python language reference: Coroutines / async def, accessed 2026-12-03](https://docs.python.org/3/reference/compound_stmts.html#coroutine-function-definition)
2. [Python asyncio: Coroutines and tasks, accessed 2026-12-03](https://docs.python.org/3/library/asyncio-task.html)
3. [Python glossary: coroutine, accessed 2026-12-03](https://docs.python.org/3/glossary.html#term-coroutine)
