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

    create

    Copy
    create(
      self,
      graph_id: str | None,
      config: Config | None = None
    View source on GitHub
    ,
    *
    ,
    context
    :
    Context
    |
    None
    =
    None
    ,
    metadata
    :
    Json
    =
    None
    ,
    assistant_id
    :
    str
    |
    None
    =
    None
    ,
    if_exists
    :
    OnConflictBehavior
    |
    None
    =
    None
    ,
    name
    :
    str
    |
    None
    =
    None
    ,
    headers
    :
    Mapping
    [
    str
    ,
    str
    ]
    |
    None
    =
    None
    ,
    description
    :
    str
    |
    None
    =
    None
    ,
    params
    :
    QueryParamTypes
    |
    None
    =
    None
    )
    ->
    Assistant

    Parameters

    NameTypeDescription
    graph_id*str | None

    The ID of the graph the assistant should use. The graph ID is normally set in your langgraph.json configuration.

    configConfig | None
    Default:None

    Configuration to use for the graph.

    contextContext | None
    Default:None

    Static context to add to the assistant.

    metadataJson
    Default:None
    assistant_idstr | None
    Default:None
    if_existsOnConflictBehavior | None
    Default:None
    namestr | None
    Default:None
    headersMapping[str, str] | None
    Default:None
    descriptionstr | None
    Default:None
    paramsQueryParamTypes | None
    Default:None

    Create a new assistant.

    Useful when graph is configurable and you want to create different assistants based on different configurations.

    client = get_sync_client(url="http://localhost:2024")
    assistant = client.assistants.create(
        graph_id="agent",
        context={"model_name": "openai"},
        metadata={"number":1},
        assistant_id="my-assistant-id",
        if_exists="do_nothing",
        name="my_name"
    )

    Metadata to add to assistant.

    Assistant ID to use, will default to a random UUID if not provided.

    How to handle duplicate creation. Defaults to 'raise' under the hood. Must be either 'raise' (raise error if duplicate), or 'do_nothing' (return existing assistant).

    The name of the assistant. Defaults to 'Untitled' under the hood.

    Optional custom headers to include with the request.

    Optional description of the assistant. The description field is available for langgraph-api server version>=0.0.45

    Optional query parameters to include with the request.