Asynchronous generator
An asynchronous generator lazily produces a sequence of values through asynchronous iteration and can suspend while awaiting asynchronous operations.
Machine Learning Platform Engineering
An async generator is a Python construct that asynchronously yields a sequence of values as they become available.
- How it is used
- Delivers retrieval context and LLM output progressively to a chat UI.
- How deep it goes
- Shows an async query method yielding structured updates; leaves source preparation and prompt construction abbreviated.
- Examples
- Uses a streaming query method that yields sources before tokens from an LLM.
- What you can do after
- Apply it via LangChain’s `astream` to deliver retrieved sources and generated tokens to a chat UI.
Read how Machine Learning Platform Engineering explains asynchronous generator →
Python Concurrency with asyncio
An asynchronous generator is a Python generator that yields values through an asynchronous iteration protocol and can suspend while awaiting asynchronous operations.
- How it is used
- Uses asynchronous generators to stream database results incrementally when complete result sets may exceed application memory.
- How deep it goes
- Explains lazy asynchronous production, async for, sequential awaiting, cursors, prefetching, and bounded consumption without implementation internals.
- Examples
- Demonstrates delayed integer generation, asyncpg product streaming, cursor navigation, and taking the first five rows.
- What you can do after
- Apply it via asyncio and asyncpg to consume large database result sets incrementally and bound the number of yielded rows.
Read how Python Concurrency with asyncio explains asynchronous generator →
The Joy of JavaScript
An async generator is a generator construct that produces asynchronous iteration, allowing values to be yielded over time with async semantics.
- How it is used
- Represents asynchronous push streams and exposes Promise-based data incrementally for reading, counting, validation, or transformation.
- How deep it goes
- Explains the signature, asynchronous consumption, chunked file processing, parsing, hydration, and validation through worked examples.
- Examples
- Demonstrates reading blocks.txt, yielding parsed blocks, counting them, and validating hydrated blockchain blocks.
- What you can do after
- Apply it via for await...of to process asynchronous data incrementally and build consumers that count, validate, or transform each value.
Read how The Joy of JavaScript explains asynchronous generator →
Related concepts
- asyncpgused by · asyncpg is a Python asynchronous PostgreSQL client library that provides coroutine-based database operations.
- functionkind of · A function is a callable program unit that performs an operation, may accept inputs, and can produce a result or side effect.
- async forused by · async for is Python syntax that asynchronously retrieves successive values from an asynchronous iterable until iteration is complete.
- coroutineproduces · A coroutine is a computation that can suspend and later resume execution while retaining its state, enabling cooperative transfer of control.
- yielduses · A language construct that yields control from a computation, optionally passing a value to another context, and may allow the suspended computation to continue later.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


