前提条件
在开始之前,请确保您已注册LangSmith(免费注册)并获取了API密钥。1. 安装 LangGraph CLI
- Python server
- Node server
2. Create a LangGraph app 🌱
Create a new app from thenew-langgraph-project-python template or new-langgraph-project-js template. This template demonstrates a single-node application you can extend with your own logic.
- Python server
- Node server
3. Install dependencies
In the root of your new LangGraph app, install the dependencies inedit mode so your local changes are used by the server:
- Python server
- Node server
4. Create a .env file
You will find a .env.example in the root of your new LangGraph app. Create a .env file in the root of your new LangGraph app and copy the contents of the .env.example file into it, filling in the necessary API keys:
5. Launch LangGraph Server 🚀
Start the LangGraph API server locally:- Python server
- Node server
langgraph dev command starts LangGraph Server in an in-memory mode. This mode is suitable for development and testing purposes.
6. Test the API
- Python SDK (async)
- Python SDK (sync)
- Javascript SDK
- Rest API
- Install the LangGraph Python SDK:
- Send a message to the assistant (threadless run):
下一步
现在您已经在本地上运行了 LangGraph 应用程序,您就可以准备部署它了: 为LangSmith选择一个托管选项: 有关更多详细信息,请参阅托管比较。 然后部署您的应用: 探索功能:- 工作室: 使用工作室UI可视化、交互和调试您的应用程序。尝试工作室快速入门。
- API参考:LangGraph服务器API,Python SDK,JS/TS SDK