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

    LangChain Assistant

    Ask a question to get started

    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-sdk_asynccronCronClientcreate
    Method●Since v0.3

    create

    Copy
    create(
      self,
      assistant_id: str,
      *,
      schedule: str,
      
    View source on GitHub
    input
    :
    Input
    |
    None
    =
    None
    ,
    metadata
    :
    Mapping
    [
    str
    ,
    Any
    ]
    |
    None
    =
    None
    ,
    config
    :
    Config
    |
    None
    =
    None
    ,
    context
    :
    Context
    |
    None
    =
    None
    ,
    checkpoint_during
    :
    bool
    |
    None
    =
    None
    ,
    interrupt_before
    :
    All
    |
    list
    [
    str
    ]
    |
    None
    =
    None
    ,
    interrupt_after
    :
    All
    |
    list
    [
    str
    ]
    |
    None
    =
    None
    ,
    webhook
    :
    str
    |
    None
    =
    None
    ,
    on_run_completed
    :
    OnCompletionBehavior
    |
    None
    =
    None
    ,
    multitask_strategy
    :
    str
    |
    None
    =
    None
    ,
    end_time
    :
    datetime
    |
    None
    =
    None
    ,
    enabled
    :
    bool
    |
    None
    =
    None
    ,
    timezone
    :
    str
    |
    tzinfo
    |
    None
    =
    None
    ,
    stream_mode
    :
    StreamMode
    |
    Sequence
    [
    StreamMode
    ]
    |
    None
    =
    None
    ,
    stream_subgraphs
    :
    bool
    |
    None
    =
    None
    ,
    stream_resumable
    :
    bool
    |
    None
    =
    None
    ,
    durability
    :
    Durability
    |
    None
    =
    None
    ,
    headers
    :
    Mapping
    [
    str
    ,
    str
    ]
    |
    None
    =
    None
    ,
    params
    :
    QueryParamTypes
    |
    None
    =
    None
    )
    ->
    Run

    Parameters

    NameTypeDescription
    assistant_id*str

    The assistant ID or graph name to use for the cron job. If using graph name, will default to first assistant created from that graph.

    schedule*str

    The cron schedule to execute this job on. Schedules are interpreted in UTC unless a timezone is specified.

    inputInput | None
    Default:None

    The input to the graph.

    metadataMapping[str, Any] | None
    Default:None
    configConfig | None
    Default:None
    contextContext | None
    Default:None
    checkpoint_duringbool | None
    Default:None
    interrupt_beforeAll | list[str] | None
    Default:None
    interrupt_afterAll | list[str] | None
    Default:None
    webhookstr | None
    Default:None
    on_run_completedOnCompletionBehavior | None
    Default:None
    multitask_strategystr | None
    Default:None
    end_timedatetime | None
    Default:None
    enabledbool | None
    Default:None
    timezonestr | tzinfo | None
    Default:None
    stream_modeStreamMode | Sequence[StreamMode] | None
    Default:None
    stream_subgraphsbool | None
    Default:None
    stream_resumablebool | None
    Default:None
    durabilityDurability | None
    Default:None
    headersMapping[str, str] | None
    Default:None
    paramsQueryParamTypes | None
    Default:None

    Create a cron run.

    client = get_client(url="http://localhost:2024")
    cron_run = client.crons.create(
        assistant_id="agent",
        schedule="27 15 * * *",
        input={"messages": [{"role": "user", "content": "hello!"}]},
        metadata={"name":"my_run"},
        context={"model_name": "openai"},
        interrupt_before=["node_to_stop_before_1","node_to_stop_before_2"],
        interrupt_after=["node_to_stop_after_1","node_to_stop_after_2"],
        webhook="https://my.fake.webhook.com",
        multitask_strategy="interrupt",
        enabled=True,
    )

    Metadata to assign to the cron job runs.

    The configuration for the assistant.

    Static context to add to the assistant.

    (deprecated) Whether to checkpoint during the run (or only at the end/interruption).

    Nodes to interrupt immediately before they get executed.

    Nodes to Nodes to interrupt immediately after they get executed.

    Webhook to call after LangGraph API call is done.

    What to do with the thread after the run completes. Must be one of 'delete' (default) or 'keep'. 'delete' removes the thread after execution. 'keep' creates a new thread for each execution but does not clean them up. Clients are responsible for cleaning up kept threads.

    Multitask strategy to use. Must be one of 'reject', 'interrupt', 'rollback', or 'enqueue'.

    The time to stop running the cron job. If not provided, the cron job will run indefinitely.

    Whether the cron job is enabled or not.

    IANA timezone for the cron schedule. Accepts a string (e.g. 'America/New_York') or a datetime.tzinfo instance (e.g. ZoneInfo("America/New_York")).

    The stream mode(s) to use.

    Whether to stream output from subgraphs.

    Whether to persist the stream chunks in order to resume the stream later.

    Durability level for the run. Must be one of 'sync', 'async', or 'exit'. "async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True "sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False "exit" means checkpoints are only persisted when the run exits, does not save intermediate steps

    Optional custom headers to include with the request.

    Optional query parameters to include with the request.