docs: Simplify LGP quickstarts

This commit is contained in:
Lauren Hirata Singh
2025-05-13 10:51:48 -07:00
parent 8d9a99bb99
commit 063a0e027b
10 changed files with 16 additions and 137 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 642 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 453 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

+4 -53
View File
@@ -9,20 +9,11 @@ Before you begin, ensure you have the following:
- A [GitHub account](https://github.com/)
- A [LangSmith account](https://smith.langchain.com/) free to sign up
This quickstart uses the [pre-built Python ReAct agent template](https://github.com/langchain-ai/react-agent), which requires the following:
- An API key for [Anthropic](https://console.anthropic.com/)
- An API key for [Tavily](https://app.tavily.com/)
!!! note
If you want to use a scaffold application that doesn't require API keys, use the [New LangGraph Project](https://github.com/langchain-ai/new-langgraph-project) template instead.
## 1. Create a repository on GitHub
To deploy a LangGraph application to **LangGraph Platform**, your application code must reside in a GitHub repository. Both public and private repositories are supported. For this quickstart, use the [pre-built Python ReAct agent template](https://github.com/langchain-ai/react-agent) for your application:
To deploy a LangGraph application to **LangGraph Platform**, your application code must reside in a GitHub repository. Both public and private repositories are supported. For this quickstart, use the [`new-langgraph-project` template](https://github.com/langchain-ai/react-agent) for your application:
1. Go to the [ReAct Agent](https://github.com/langchain-ai/react-agent) repository.
1. Go to the [`new-langgraph-project` repository](https://github.com/langchain-ai/new-langgraph-project).
1. Click the `Fork` button in the top right corner to fork the repository to your GitHub account.
1. Click **Create fork**.
@@ -32,12 +23,7 @@ To deploy a LangGraph application to **LangGraph Platform**, your application co
1. In the left sidebar, select **LangGraph Platform**.
1. Click the **+ New Deployment** button. A modal will open where you can fill in the required fields.
1. If you are a first time user or adding a private repository that has not been previously connected, click the **Import from GitHub** button and follow the instructions to connect your GitHub account.
1. Select your ReAct Agent repository.
1. In the **Environment Variables** section, set the following secrets:
- **ANTHROPIC_API_KEY**: Get an API key from [Anthropic](https://console.anthropic.com/).
- **TAVILY_API_KEY**: Get an API key on the [Tavily website](https://app.tavily.com/).
1. Select your New LangGraph Project repository.
1. Click **Submit** to deploy.
This may take about 15 minutes to complete. You can check the status in the **Deployment details** view.
@@ -52,7 +38,7 @@ Once your application is deployed:
LangGraph Studio will open to display your graph.
<figure markdown="1">
[![image](deployment/img/09_langgraph_studio.png){: style="max-height:400px"}](deployment/img/09_langgraph_studio.png)
[![image](deployment/img/langgraph_studio.png){: style="max-height:400px"}](deployment/img/langgraph_studio.png)
<figcaption>
Sample graph run in LangGraph Studio.
</figcaption>
@@ -129,41 +115,6 @@ You can now test the API:
print("\n\n")
```
=== "Javascript SDK"
1. Install the LangGraph JS SDK
```shell
npm install @langchain/langgraph-sdk
```
1. Send a message to the assistant (threadless run):
```js
const { Client } = await import("@langchain/langgraph-sdk");
const client = new Client({ apiUrl: "your-deployment-url", apiKey: "your-langsmith-api-key" });
const streamResponse = client.runs.stream(
null, // Threadless run
"agent", // Assistant ID
{
input: {
"messages": [
{ "role": "user", "content": "What is LangGraph?"}
]
},
streamMode: "messages",
}
);
for await (const chunk of streamResponse) {
console.log(`Receiving new event of type: ${chunk.event}...`);
console.log(JSON.stringify(chunk.data));
console.log("\n\n");
}
```
=== "Rest API"
```bash
@@ -8,15 +8,6 @@ Before you begin, ensure you have the following:
- An API key for [LangSmith](https://smith.langchain.com/settings) - free to sign up
This quickstart uses the [pre-built Python ReAct agent template](https://github.com/langchain-ai/react-agent), which requires the following:
- An API key for [Anthropic](https://console.anthropic.com/)
- An API key for [Tavily](https://app.tavily.com/)
!!! note
If you want to use a scaffold application that doesn't require API keys, use the [New LangGraph Project](https://github.com/langchain-ai/new-langgraph-project) template instead.
## 1. Install the LangGraph CLI
```bash
@@ -27,19 +18,11 @@ pip install --upgrade "langgraph-cli[inmem]"
## 2. Create a LangGraph app 🌱
Create a new app from the `react-agent` template. This template is a simple agent that can be flexibly extended to many tools.
Create a new app from the [`new-langgraph-project` template](https://github.com/langchain-ai/new-langgraph-project). This template demonstrates a simple chatbot that maintains chat memory, which allows for coherent conversations across multiple interactions.
=== "Python Server"
```shell
langgraph new path/to/your/app --template react-agent-python
```
=== "Node Server"
```shell
langgraph new path/to/your/app --template react-agent-js
```
```shell
langgraph new path/to/your/app --template new-langgraph-project
```
!!! tip "Additional templates"
@@ -49,19 +32,10 @@ Create a new app from the `react-agent` template. This template is a simple agen
In the root of your new LangGraph app, install the dependencies in `edit` mode so your local changes are used by the server:
=== "Python server"
```shell
cd path/to/your/app
pip install -e .
```
=== "Node server"
```shell
cd path/to/your/app
yarn install
```
```shell
cd path/to/your/app
pip install -e .
```
## 4. Create a `.env` file
@@ -69,25 +43,15 @@ You will find a `.env.example` in the root of your new LangGraph app. Create a `
```bash
LANGSMITH_API_KEY=lsv2...
TAVILY_API_KEY=tvly-...
ANTHROPIC_API_KEY=sk-
```
## 5. Launch LangGraph Server 🚀
Start the LangGraph API server locally:
=== "Python Server"
```shell
langgraph dev
```
=== "Node Server"
```shell
npx @langchain/langgraph-cli dev
```
```shell
langgraph dev
```
Sample output:
@@ -188,42 +152,6 @@ For a LangGraph Server running on a custom host/port, update the baseURL paramet
print("\n\n")
```
=== "Javascript SDK"
1. Install the LangGraph JS SDK:
```shell
npm install @langchain/langgraph-sdk
```
1. Send a message to the assistant (threadless run):
```js
const { Client } = await import("@langchain/langgraph-sdk");
// only set the apiUrl if you changed the default port when calling langgraph dev
const client = new Client({ apiUrl: "http://localhost:2024"});
const streamResponse = client.runs.stream(
null, // Threadless run
"agent", // Assistant ID
{
input: {
"messages": [
{ "role": "user", "content": "What is LangGraph?"}
]
},
streamMode: "messages-tuple",
}
);
for await (const chunk of streamResponse) {
console.log(`Receiving new event of type: ${chunk.event}...`);
console.log(JSON.stringify(chunk.data));
console.log("\n\n");
}
```
=== "Rest API"
```bash
@@ -244,7 +172,7 @@ For a LangGraph Server running on a custom host/port, update the baseURL paramet
}"
```
## Next Steps
## Next steps
Now that you have a LangGraph app running locally, take your journey further by exploring deployment and advanced features: