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

    get_graph

    Copy
    get_graph(
      self,
      assistant_id: str,
      *,
      xray: int | bool = 
    View source on GitHub
    False
    ,
    headers
    :
    Mapping
    [
    str
    ,
    str
    ]
    |
    None
    =
    None
    ,
    params
    :
    QueryParamTypes
    |
    None
    =
    None
    )
    ->
    dict
    [
    str
    ,
    list
    [
    dict
    [
    str
    ,
    Any
    ]
    ]
    ]

    Parameters

    NameTypeDescription
    assistant_id*str

    The ID of the assistant to get the graph of.

    xrayint | bool
    Default:False

    Include graph representation of subgraphs. If an integer value is provided, only subgraphs with a depth less than or equal to the value will be included.

    headersMapping[str, str] | None
    Default:None
    paramsQueryParamTypes | None
    Default:None

    Get the graph of an assistant by ID.

    client = get_client(url="http://localhost:2024")
    graph_info = await client.assistants.get_graph(
        assistant_id="my_assistant_id"
    )
    print(graph_info)
    
    --------------------------------------------------------------------------------------------------------------------------
    
    {
        'nodes':
            [
                {'id': '__start__', 'type': 'schema', 'data': '__start__'},
                {'id': '__end__', 'type': 'schema', 'data': '__end__'},
                {'id': 'agent','type': 'runnable','data': {'id': ['langgraph', 'utils', 'RunnableCallable'],'name': 'agent'}},
            ],
        'edges':
            [
                {'source': '__start__', 'target': 'agent'},
                {'source': 'agent','target': '__end__'}
            ]
    }

    Optional custom headers to include with the request.

    Optional query parameters to include with the request.