-
Notifications
You must be signed in to change notification settings - Fork 26
Improve Use RemoteGraph page lgp #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Preview ID generated: preview-improv-1756931698-528fb72 |
</Info> | ||
|
||
`RemoteGraph` is an interface that allows you to interact with your LangGraph Platform deployment as if it were a regular, locally-defined LangGraph graph (e.g. a `CompiledGraph`). This guide shows you how you can initialize a `RemoteGraph` and interact with it. | ||
[`RemoteGraph`](https://langchain-ai.github.io/langgraph/reference/remote_graph) is a client-side interface that allows you to interact with your [deployment](/langgraph-platform/deployment-options) as if it were a local graph. It provides API parity with [`CompiledGraph`](/oss/python/langgraph/graph-api#compiling-your-graph), which means that you can use the same methods (`invoke`, `stream`, `get_state`, etc.) in your development and production environments. This page describes how to initialize a `RemoteGraph` and interact with it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/oss/python/langgraph/graph-api#compiling-your-graph
returns a 404 page in the preview.
Really weird, but when I click the link, the URL contains an extra /python
in the path, which is causing the 404 page. Maybe this is just a bug in the preview.
- Separation of development and deployment: Build and test a graph locally with `CompiledGraph`, deploy it to LangGraph Platform, and then [use `RemoteGraph`](#initialize-the-graph) to call it in production while working with the same API interface. | ||
- Thread-level persistence: [Persist and fetch the state](#persist-state-at-the-thread-level) of a conversation across calls with a thread ID. | ||
- Subgraph embedding: Compose modular graphs for a multi-agent workflow by embedding a `RemoteGraph` as a [subgraph](#use-as-a-subgraph) within another graph. | ||
- Reusable workflows: Use deployed graphs as nodes or [tools](https://langchain-ai.github.io/langgraph/reference/remote_graph#meth-as-tool), so that you can reuse and expose complex logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This URL for tool
might be better: https://langchain-ai.github.io/langgraph/reference/remote_graph/#langgraph.pregel.remote.RemoteGraph.as_tool
This URL actually scrolled down the page to the as_tool
method for me.
</Info> | ||
|
||
`RemoteGraph` is an interface that allows you to interact with your LangGraph Platform deployment as if it were a regular, locally-defined LangGraph graph (e.g. a `CompiledGraph`). This guide shows you how you can initialize a `RemoteGraph` and interact with it. | ||
[`RemoteGraph`](https://langchain-ai.github.io/langgraph/reference/remote_graph) is a client-side interface that allows you to interact with your [deployment](/langgraph-platform/deployment-options) as if it were a local graph. It provides API parity with [`CompiledGraph`](/oss/python/langgraph/graph-api#compiling-your-graph), which means that you can use the same methods (`invoke`, `stream`, `get_state`, etc.) in your development and production environments. This page describes how to initialize a `RemoteGraph` and interact with it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with the rest of the page, can we append ()
to the method names: invoke()
.
remote_graph = RemoteGraph(graph_name, url=url) | ||
|
||
# Using assistant ID | ||
assistant_id = <ASSISTANT_ID> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quotation marks for string: assistant_id = <ASSISTANT_ID>
--> assistant_id = "<ASSISTANT_ID>"
We did the same in the JS example.
```python | ||
from langgraph_sdk import get_client, get_sync_client | ||
from langgraph.pregel.remote import RemoteGraph | ||
url = <DEPLOYMENT_URL> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url = <DEPLOYMENT_URL>
--> url = "<DEPLOYMENT_URL>"
|
||
```python Python | ||
from langgraph_sdk import get_sync_client | ||
url = <DEPLOYMENT_URL> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url = <DEPLOYMENT_URL>
--> url = "<DEPLOYMENT_URL>"
<CodeGroup> | ||
|
||
```python Python | ||
from langgraph_sdk import get_sync_client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a blank line after this line (e.g. nice Python code formatting)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Done!
|
||
<Note> | ||
If you need to use a `checkpointer` with a graph that has a `RemoteGraph` subgraph node, make sure to use UUIDs as thread IDs. | ||
If you need to use a `checkpointer` with a graph that has a `RemoteGraph` subgraph node, make sure to use UUIDs as thread IDs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double text. We can remove this line.
``` | ||
</Tab> | ||
</Tabs> | ||
A graph can also call out to multiple `RemoteGraph` instances as [_subgraph_](/oss/python/langgraph/subgraphs) nodes. This allows for modular, scalable workflows where different responsibilities are split across separate graphs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _subgraph_
link has the same issue with the extra /python
in the path.
from langgraph.graph import StateGraph, MessagesState, START | ||
from typing import TypedDict | ||
|
||
url = <DEPLOYMENT_URL> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url = <DEPLOYMENT_URL>
--> url = "<DEPLOYMENT_URL>"
Preview ID generated: preview-improv-1758633637-f9cd3e5 |
TFTRs! Incorporated all of your feedback! |
DOC-40
<CodeGroup>
for global page syncing of code blocks.Preview
https://langchain-5e9cc07a-preview-improv-1756931698-528fb72.mintlify.app/langgraph-platform/use-remote-graph