# langgraph-customer **Repository Path**: happy_source/langgraph-customer ## Basic Information - **Project Name**: langgraph-customer - **Description**: 基于LangGraph 的多 Agent 智能客服系统 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-27 - **Last Updated**: 2026-05-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # LangGraph 多 Agent 智能客服系统 基于 [LangGraph](https://github.com/langchain-ai/langgraph) 构建的企业级多 Agent 客服系统。通过路由节点自动分类用户问题,分发至对应的专业 Agent 处理,并支持售后场景的人工审核(Human-in-the-Loop)流程。 ## 架构 ``` 用户问题 → Router(分类) → Order Agent(订单查询) → Product Agent(产品咨询) → Service Agent(售后服务)→ 需要审核? → Human Review → END → Tech Agent(技术支持) ``` 系统使用 LangGraph 的 `StateGraph` 编排工作流,核心流程: 1. **路由分类**:LLM 分析用户问题,将其归类为 `order` / `product` / `service` / `tech` 2. **专家处理**:根据分类结果,进入对应的专业 Agent 生成回复 3. **人工审核**:售后 Agent 检测到敏感关键词(退货、退款等)时,通过 LangGraph 的 `interrupt_before` 机制暂停流程,等待人工审批后继续 ## 项目结构 ``` ├── agents/ │ ├── router.py # 路由分类节点 & 条件边函数 │ ├── order_agent.py # 订单查询 Agent │ ├── product_agent.py # 产品咨询 Agent │ ├── service_agent.py # 售后服务 Agent(含敏感操作检测) │ ├── tech_agent.py # 技术支持 Agent │ └── review_agent.py # 人工审核节点 ├── state.py # 共享状态定义 (CustomerServiceState) ├── config.py # LLM 初始化配置 ├── main.py # Graph 构建与运行入口 └── pyproject.toml ``` ## 快速开始 ### 环境要求 - Python >= 3.11 - [uv](https://docs.astral.sh/uv/) 包管理器 ### 安装 ```bash uv sync ``` ### 配置 复制 `.env.example` 为 `.env`,填入 API Key: ```bash cp .env.example .env ``` ``` SILICONFLOW_API_KEY=your_key_here ``` > 默认使用 SiliconFlow 提供的 DeepSeek-V3.2 模型,可在 `config.py` 中切换模型和 API 地址。 ### 运行 ```bash uv run python main.py ``` 当前默认运行 `run_review_demo`,演示售后人工审核流程:系统处理退货请求后暂停,等待人工输入审核结果,然后继续执行。 ## 自定义扩展 - **新增 Agent**:在 `agents/` 下创建新模块,在 `router.py` 中添加新分类,并在 `main.py` 的 Graph 中注册节点和边 - **切换模型**:修改 `config.py` 中的 `model`、`base_url`、`api_key` 即可 - **状态扩展**:在 `state.py` 的 `CustomerServiceState` 中添加新字段 ## 技术栈 - [LangGraph](https://github.com/langchain-ai/langgraph) - 工作流编排 - [LangChain](https://github.com/langchain-ai/langchain) + [langchain-openai](https://github.com/langchain-ai/langchain-openai) - LLM 调用 - DeepSeek-V3.2 (via SiliconFlow) - 底层语言模型 ## License [MIT](LICENSE)