by 888newstep
企业级 AI Agent 平台 | Spring Boot 3 + LangChain4j | ReAct 推理 + 多路召回 RAG + 语义缓存 + 多智能体协作
# Add to your Claude Code skills
git clone https://github.com/888newstep/ai-agent-platformGuides for using ai agents skills like ai-agent-platform.
Last scanned: 8/6/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-08-06T06:30:55.544Z",
"npmAuditRan": true,
"pipAuditRan": true,
"promptInjectionRan": true
}基于 Spring Boot 3 + LangChain4j 构建的企业级 AI Agent 平台,集成 ReAct 推理循环、多路召回 RAG、语义缓存和工具调用框架。
mvn test / mvn verifytarget/site/jacoco/index.html/actuator/health, /actuator/metrics, /actuator/prometheus; metrics require authentication by default, while the local .env.example enables public scraping for Compose.docker compose up -d app prometheus grafanadocs/observability.md🎯 适用人群
- 正在准备大厂 Java / AI 岗位面试的求职者(覆盖高频面试考点)
- 需要快速搭建 AI 客服系统的中小企业或独立开发者
- 想学习 RAG + Agent 完整落地实践的技术爱好者
- 需要可扩展 AI Agent 框架的产品开发者
| 层级 | 技术 |
|---|---|
| 框架 | Spring Boot 3.5, LangChain4j 0.34 |
| 语言 | Java 17 |
| 数据库 | MySQL 8.0, Redis 7, Milvus 2.4 |
| AI 模型 | DeepSeek, 通义千问, 豆包, Qwen3-Flash, Ollama |
| 嵌入模型 | BGE-M3 (SiliconFlow API) |
| 部署 | Docker, Docker Compose |
| CI/CD | GitHub Actions |
git clone https://github.com/888newstep/ai-agent-platform.git
cd ai-agent-platform
cp .env.example .env
# 编辑 .env 填入你的 API 密钥
docker compose up -d
curl http://localhost:8081/api/v1/agent/health
# 返回: {"status":"UP","service":"AI Customer Service Agent","version":"1.0.0"}
curl -X POST http://localhost:8081/api/v1/agent/session
curl -X POST "http://localhost:8081/api/v1/agent/chat?sessionId={sessionId}&question=你好&useRag=true"
curl -X POST "http://localhost:8081/api/v1/agent/react/chat?sessionId={sessionId}&question=查询数据库中的用户数量&useRag=true"
curl -N "http://localhost:8081/api/v1/agent/chat/stream?sessionId={sessionId}&question=请详细介绍RAG技术"
curl -X POST -F "file=@文档.pdf" http://localhost:8081/api/v1/agent/document/upload
评测接口需要管理员凭证。导出报告后,可以列出最近报告并比较两次评测的指标变化:
curl -H "X-Admin-Api-Key: ${ADMIN_API_KEY}" \
"http://localhost:8081/api/v1/agent/evaluate/history?limit=20"
curl -H "X-Admin-Api-Key: ${ADMIN_API_KEY}" \
"http://localhost:8081/api/v1/agent/evaluate/history/compare?baseline={fileName}&candidate={fileName}"
比较结果中的 metricDeltas 使用 candidate - baseline,并在数据集来源、样本数或 topKs 不一致时标记为不可直接比较。
仓库提供最小示例数据集 examples/evaluation-datasets/rag-sample.json,默认配置已指向该目录。详细的双配置真实评测流程见 docs/RAG_BENCHMARK.md,运行脚本为 scripts/run-rag-evaluation.ps1。数据集中的 relevantDocIds 是评测基准的 chunk ID;只有先导入包含这些 ID 的文档,召回率和准确率才具有业务意义。若复用已有 ecommerce_qa collection,请先设置 AI_VECTOR_STORE_MODE=qa、MILVUS_COLLECTION_NAME=ecommerce_qa 和 MILVUS_READ_ONLY=true;真实数据请通过 AI_EVALUATION_DATASET_DIRECTORY 指向本地私有目录,避免提交到 GitHub。
curl -X POST \
-H "X-Admin-Api-Key: ${ADMIN_API_KEY}" \
"http://localhost:8081/api/v1/agent/evaluate/export?datasetPath=examples/evaluation-datasets/rag-sample.json&topKs=1,3,5"
┌─────────────────────────────────────────────────────────────┐
│ AI Agent Platform │
├─────────────────────────────────────────────────────────────┤
│ Controller Layer │
│ ┌─────────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ Chat API │ │ ReAct API │ │ Document API │ │
│ └──────┬───────┘ └──────┬───────┘ └────────┬─────────┘ │
├─────────┼────────────────┼──────────────────┼───────────────┤
│ Service Layer │ │ │
│ ┌──────┴────────┐ ┌─────┴──────┐ ┌────────┴──────────┐ │
│ │ AiAgentService│ │ ReActAgent │ │ DocumentService │ │
│ └──────┬────────┘ └─────┬──────┘ └────────┬──────────┘ │
│ │ │ │ │
│ ┌──────┴────────────────┴──────────────────┴──────────┐ │
│ │ SemanticCacheService │ │
│ └──────────────────────┬──────────────────────────────┘ │
├─────────────────────────┼──────────────────────────────────┤
│ Retrieval Layer │ │
│ ┌──────────────────────┴──────────────────────────────┐ │
│ │ MultiRecallService │ │
│ │ ┌────────────────┐ ┌──────────────────────────┐ │ │
│ │ │ Vector Search │ │ BM25 Keyword Search │ │ │
│ │ │ (Milvus) │ │ (Bm25Search) │ │ │
│ │ └────────┬───────┘ └──────────┬───────────────┘ │ │
│ │ └──────────┬──────────┘ │ │
│ │ RRF Fusion │ │
│ └──────────────────────────────────────────────────────┘ │
├──────────────────────────────────────────────────────────────┤
│ Tool Layer │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ ToolService (query_database / call_external_api) │ │
│ └──────────────────────────────────────────────────────┘ │
├──────────────────────────────────────────────────────────────┤
│ Infrastructure Layer │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
│ │ MySQL │ │ Redis │ │ Milvus │ │ AI Models │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ │
└──────────────────────────────────────────────────────────────┘
详细架构设计请参阅 docs/ARCHITECTURE.md
Thought: 分析问题,决定下一步行动
↓
Action: 选择工具(query_database / call_external_api)
↓
Action Input: 工具参数
↓
Observation: 工具执行结果
↓
(重复以上步骤,直到得到足够信息)
↓
Final Answer: 给出最终回答
| 机制 | 说明 |
|---|---|
| 最大迭代步数 | 默认 10 步,防止无限循环 |
| 超时控制 | 整体任务 3 分钟超时 |
| 死循环检测 | 相同 Observation 连续出现 3 次则终止 |
| 异常捕获 | LLM 调用或工具执行失败时优雅降级 |
score(d) = Σ 1/(k + rank_i(d))
其中 k=60,rank_i(d) 是文档 d 在第 i 路检索中的排名。
src/main/java/com/aiagent/
├── agent/
│ ├── api/ # Agent REST API
│ ├── application/ # 普通聊天、ReAct、Multi-Agent 编排
│ └── infrastructure/tool/ # 数据库与外部 API 工具
├── infrastructure/
│ ├── cache/ # 语义缓存与 RAG 缓存
│ ├── config/ # 模型、Milvus、安全与限流配置
│ └── metrics/ # Micrometer 业务指标
├── knowledge/
│ ├── application/ # 文档上传、解析与入库
│ └── infrastructure/ # Parser、Splitter、VectorStore
├── rag/application/ # Adaptive RAG、Multi-Recall、评测
├── chat/ # 会话与 SSE 流式响应
└── shared/ # 公共响应体与异常处理
安全提示:启动前必须通过环境变量设置
JWT_SECRET和ADMIN_API_KEY。仓库中的.env.example仅是占位模板,不要直接用于生产环境。
在 application.yml 中修改 ai.model.provider:
ai:
model:
provider: deepseek # 可选: deepseek, qianwen, doubao, qwen3-flash, local
ai:
embedding:
provider: siliconflow # 可选: local, local-qwen3, siliconflow
参考 .env.example 文件,所有敏感配置通过环境变量注入。
该项目适用于以下面试场景:
| 知识点 | 项目体现 |
|---|---|
| Spring Boot 启动流程 | AiModelConfig 自动配置、@ConditionalOnProperty |
| 策略模式 | 多模型动态切换 |
| Redis 缓存 | 会话管理、语义缓存 |
| 数据库优化 | JPA + 连接池配置 |
| Docker 部署 | 4 服务编排、健康检查 |
| 知识点 | 项目体现 |
|---|---|
| ReAct Agent | 完整推理循环、死循环防护、超时控制 |
| 长上下文管理 (Q174) | 滑动窗口 + 摘要压缩 + 历史检索 |
| RAG 效果评估 (Q173) | 召回率/准确率/F1/延迟量化评估 |
| RAG 优化 | 多路召回 + RRF 融合 |
| 成本控制 | 语义缓存、本地模型降级 |
| Embedding | SiliconFlow BGE-M3 接入 |
| 向量数据库 | Milvus 集合创建、索引构建 |
| 多智能体 (Q147) | Supervisor + Worker 协作模式 |
| SSE 流式输出 (Q151-153) | 心跳机制 + 虚拟线程管理 |
Apache License 2.0
ai-agent-platform is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by 888newstep. 企业级 AI Agent 平台 | Spring Boot 3 + LangChain4j | ReAct 推理 + 多路召回 RAG + 语义缓存 + 多智能体协作. It has 114 GitHub stars.
Yes. ai-agent-platform passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/888newstep/ai-agent-platform" and add it to your Claude Code skills directory (see the Installation section above).
ai-agent-platform is primarily written in Java. It is open-source under 888newstep on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh ai-agent-platform against similar tools.
No comments yet. Be the first to share your thoughts!