LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-corelanguage_modelschat_model_streamAsyncProjection
    Class●Since v1.3

    AsyncProjection

    Copy
    AsyncProjection(
        self,
    )

    Bases

    _ProjectionBase

    Constructors

    Methods

    View source on GitHub
    constructor
    __init__
    method
    set_start

    Install a lazy-start callback invoked on first consumption.

    method
    set_arequest_more

    Wire the async pull callback iterators use to drive the source.

    Mirrors SyncProjection.set_request_more. Under caller-driven streaming, consumers call this callback when their buffer is empty so that the owning graph advances one step.

    method
    push

    Append a delta and notify waiters.

    method
    complete

    Set the final value, mark done, and notify waiters.

    method
    fail

    Mark errored and notify waiters.

    Async iterable of deltas that is also awaitable for the final value.

    Uses an asyncio.Event to notify consumers of state changes. Each waiter — the awaitable (__await__) and each async iterator cursor — shares the event and re-checks its own condition on wake. The event is cleared before a waiter awaits, so stale "something happened" signals don't cause spin loops.

    This is single-loop only — producers and consumers must share an event loop. If cross-thread wake is ever required, revert to a list-of-futures pattern with call_soon_threadsafe.