RemoteGraph
The RemoteGraph class is a client implementation for calling remote
APIs that implement the LangGraph Server API specification.
For example, the RemoteGraph class can be used to call APIs from deployments
on LangSmith Deployment.
RemoteGraph behaves the same way as a Graph and can be used directly as
a node in another Graph.
RemoteGraph(
self,
assistant_id: str,
,
*,
url: str | None = None,
api_key: str | None = None,
headers: dict[str, str] | None = None,
client: LangGraphClient | None = None,
sync_client: SyncLangGraphClient | None = None,
config: RunnableConfig | None = None,
name: str | None = None,
distributed_tracing: bool = False
)Bases
Parameters
| Name | Type | Description |
|---|---|---|
assistant_id* | str | The assistant ID or graph name of the remote graph to use. |
url | str | None | Default: NoneThe URL of the remote API. |
api_key | str | None | Default: NoneThe API key to use for authentication. If not provided, it will be read from the environment ( |
headers | dict[str, str] | None | Default: NoneAdditional headers to include in the requests. |
client | LangGraphClient | None | Default: NoneA |
sync_client | SyncLangGraphClient | None | Default: NoneA |
config | RunnableConfig | None | Default: NoneAn optional |
name | str | None | Default: NoneHuman-readable name to attach to the RemoteGraph instance.
This is useful for adding |
distributed_tracing | bool | Default: FalseWhether to enable sending LangSmith distributed tracing headers. |
Constructors
| Name | Type |
|---|---|
| assistant_id | str |
| url | str | None |
| api_key | str | None |
| headers | dict[str, str] | None |
| client | LangGraphClient | None |
| sync_client | SyncLangGraphClient | None |
| config | RunnableConfig | None |
| name | str | None |
| distributed_tracing | bool |
Attributes
Methods
Get graph by graph name.
This method calls GET /assistants/{assistant_id}/graph.
Get graph by graph name.
This method calls GET /assistants/{assistant_id}/graph.
Get the state of a thread.
This method calls POST /threads/{thread_id}/state/checkpoint if a
checkpoint is specified in the config or GET /threads/{thread_id}/state
if no checkpoint is specified.
Get the state of a thread.
This method calls POST /threads/{thread_id}/state/checkpoint if a
checkpoint is specified in the config or GET /threads/{thread_id}/state
if no checkpoint is specified.
Get the state history of a thread.
This method calls POST /threads/{thread_id}/history.
Get the state history of a thread.
This method calls POST /threads/{thread_id}/history.
Update the state of a thread.
This method calls POST /threads/{thread_id}/state.
Update the state of a thread.
This method calls POST /threads/{thread_id}/state.
Create a run and stream the results.
This method calls POST /threads/{thread_id}/runs/stream if a thread_id
is speciffed in the configurable field of the config or
POST /runs/stream otherwise.
Create a run and stream the results.
This method calls POST /threads/{thread_id}/runs/stream if a thread_id
is speciffed in the configurable field of the config or
POST /runs/stream otherwise.
Create a run, wait until it finishes and return the final state.
Create a run, wait until it finishes and return the final state.