一、下载LangChain chat ui
下载地址:点此下载 ,也可以使用官网线上版本 地址:https://agentchat.vercel.app/
二、安装LangGraph cli
pip install -U langgraph
pip install -U "langgraph-cli[inmem]"
三、项目内创建langgraph.json
{
"dependencies": ["."],
"graphs": {
"agent": "./supervisor_agent.py:supervisor_agent" // agent的python文件:agent的名称
},
"env": ".env"
}
四、执行启动命令
langgraph dev --host 0.0.0.0 # 看到启动界面如下
INFO:langgraph_api.cli:
Welcome to
╦ ┌─┐┌┐┌┌─┐╔═╗┬─┐┌─┐┌─┐┬ ┬
║ ├─┤││││ ┬║ ╦├┬┘├─┤├─┘├─┤
╩═╝┴ ┴┘└┘└─┘╚═╝┴└─┴ ┴┴ ┴ ┴
- 🚀 API: http://127.0.0.1:2024
- 🎨 Studio UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024
- 📚 API Docs: http://127.0.0.1:2024/docs
This in-memory server is designed for development and testing.
For production use, please use LangSmith Deployment.
五、安装langchain chat ui依赖
此步骤针对本地运行的chat ui,如果是线上版本直接跳过
进入langchain chat ui的解压目录
执行install命令
pnpm install
运行启动命令
PS E:\workspace\AGI\项目\agent-chat-ui> pnpm dev # 看到一下结果表明启动成功过
> agent-chat-ui@0.0.0 dev E:\workspace\AGI\项目\agent-chat-ui
> next dev
▲ Next.js 15.5.14
- Local: http://localhost:3000
- Network: http://192.168.0.129:3000
- Experiments (use with caution):
· serverActions
✓ Starting...
✓ Ready in 2.6s
六、配置参数
打开langchain-chat-ui地址,配置参数
Deployment UIL:本地langgraph dev命令获取到的地址,一般为2024端口
Graph ID:langgraph.json配置文件下配置的agent名称
点击Continue即可使用