LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Graphs
    • Functional API
    • Pregel
    • Checkpointing
    • Storage
    • Caching
    • Types
    • Runtime
    • Config
    • Errors
    • Constants
    • Channels
    • Agents
    LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewGraphsFunctional APIPregelCheckpointingStorageCachingTypesRuntimeConfigErrorsConstantsChannelsAgents
    LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph_internal_runnablecreate_task_in_config_context
    Functionā—Since v1.1

    create_task_in_config_context

    Copy
    create_task_in_config_context(
      coro_factory: Callable[[], Coroutine[Any, Any, Any]],
      config: RunnableConfig
    
    View source on GitHub
    )
    ->
    asyncio
    .
    Task
    [
    Any
    ]

    Create an asyncio.Task that inherits config as the child runnable context.

    asyncio.create_task snapshots the current contextvars onto the new task, so calling create_task while the config context is set ensures the task sees config via var_child_runnable_config and any tracing parent.