Skip to content

better document what the first argument to a RemoteGraph can be #116

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

Merged
merged 5 commits into from
Aug 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions src/langgraph-platform/use-remote-graph.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sidebarTitle: Interact with the deployment using RemoteGraph

When initializing a `RemoteGraph`, you must always specify:

* `name`: the name of the graph you want to interact with. This is the same graph name you use in `langgraph.json` configuration file for your deployment.
* `name`: the name of the graph you want to interact with **or** an assistant ID. If you specify a graph name, the default assistant will be used. If you specify an assistant ID, that specific assistant will be used. The graph name is the same name you use in `langgraph.json` configuration file for your deployment.
* `api_key`: a valid LangSmith API key. Can be set as an environment variable (`LANGSMITH_API_KEY`) or passed directly via the `api_key` argument. The API key could also be provided via the `client` / `sync_client` arguments, if `LangGraphClient` / `SyncLangGraphClient` were initialized with `api_key` argument.

Additionally, you have to provide one of the following:
Expand All @@ -35,17 +35,29 @@ Additionally, you have to provide one of the following:
from langgraph.pregel.remote import RemoteGraph

url = <DEPLOYMENT_URL>

# Using graph name (uses default assistant)
graph_name = "agent"
remote-graph = RemoteGraph(graph_name, url=url)

# Using assistant ID
assistant_id = <ASSISTANT_ID>
remote-graph = RemoteGraph(assistant_id, url=url)
```
</Tab>
<Tab title="JavaScript">
```ts
import { RemoteGraph } from "@langchain/langgraph/remote";

const url = `<DEPLOYMENT_URL>`;

// Using graph name (uses default assistant)
const graphName = "agent";
const remoteGraph = new RemoteGraph({ graphId: graphName, url });

// Using assistant ID
const assistantId = `<ASSISTANT_ID>`;
const remoteGraph = new RemoteGraph({ graphId: assistantId, url });
```
</Tab>
</Tabs>
Expand All @@ -59,10 +71,16 @@ Additionally, you have to provide one of the following:
from langgraph.pregel.remote import RemoteGraph

url = <DEPLOYMENT_URL>
graph_name = "agent"
client = get_client(url=url)
sync_client = get_sync_client(url=url)

# Using graph name (uses default assistant)
graph_name = "agent"
remote-graph = RemoteGraph(graph_name, client=client, sync_client=sync_client)

# Using assistant ID
assistant_id = <ASSISTANT_ID>
remote-graph = RemoteGraph(assistant_id, client=client, sync_client=sync_client)
```
</Tab>
<Tab title="JavaScript">
Expand All @@ -71,8 +89,14 @@ Additionally, you have to provide one of the following:
import { RemoteGraph } from "@langchain/langgraph/remote";

const client = new Client({ apiUrl: `<DEPLOYMENT_URL>` });

// Using graph name (uses default assistant)
const graphName = "agent";
const remoteGraph = new RemoteGraph({ graphId: graphName, client });

// Using assistant ID
const assistantId = `<ASSISTANT_ID>`;
const remoteGraph = new RemoteGraph({ graphId: assistantId, client });
```
</Tab>
</Tabs>
Expand Down