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
@@ -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: