LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    Chat LangChain

    What can I help with?

    Enter to send·Shift+Enter new line

    Menu

    LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph-sdkpriorityPriorityassign
    Method●Since v0.4

    assign

    Copy
    assign(
        self,
        fn: _AssignHandlerT,
    ) -> _AssignHandlerT
    View source on GitHub

    Parameters

    NameTypeDescription
    fn*_AssignHandlerT

    The assign handler function

    Register the function that assigns a thread's priority settings.

    The function receives a PriorityContext and returns PrioritySettings, or None for the defaults.

    Example:

    @priority.assign
    async def assign(ctx: PriorityContext) -> PrioritySettings | None:
        if ctx.cron_id is not None:
            return {"priority": -2}
        return None