aks-builds/sentinel-qe

GitHub: aks-builds/sentinel-qe

自托管 AI 质量工程平台,通过五大模块对自研 Agent 和外部 AI 产品进行测试、安全红队评估、认知基准评测和无障碍审计。

Stars: 0 | Forks: 0

# Sentinel
How Sentinel works: an SDK instruments an agent or API call, traces are ingested into Postgres/ClickHouse/Redis, requests route to one of five modules (Probe, Mirror, Guard, Cognify, Reach) sharing one auth layer and data model, AI-heavy work runs in the Python engine, a self-hosted Ollama judge scores the result without any data leaving the deployment, every module returns a structured verdict with evidence, and results land in the dashboard plus a CI/CD quality gate.
## 五大模块 | 模块 | 测试内容 | 覆盖范围 | |---|---|---| | **Probe** | *你构建的* Agents | OpenTelemetry 式 trace 捕获、tool-call schema 验证、hallucination 归因(reasoning/execution/perception/memorization/communication)、multi-agent 拓扑图、CI/CD 质量门禁 | | **Mirror** | *你消费的* AI 产品 | 跨 OpenAI/Anthropic/Google/Grok 的 API 行为回归、由 Playwright 驱动针对 ChatGPT/Claude.ai/Gemini/Grok 的 UI 测试、跨提供商基准测试、成本追踪 | | **Guard** | 安全态势 | 28+ 种对抗性 red-team 攻击、agentic 特有漏洞(目标窃取、工具污染、内存污染)、PII 泄露检测、GDPR/CCPA 检查、OWASP ASI 清单自动化 | | **Cognify** | 认知能力 | 人类基线任务库、多维度 LLM-judge 评分、人机对比、跨模型更新的纵向能力追踪 | | **Reach** | 无障碍与包容性 | 多语言质量对齐(20+ 种语言)、文化敏感性与偏见检测、阅读等级检查、WCAG UI 审计 | ## 架构 ``` flowchart TB PY["sentinel-py → PyPI
Python agent instrumentation"] JS["sentinel-js → npm
TypeScript agent instrumentation"] subgraph WEB["Sentinel Web — Next.js 15"] DASH["Dashboard · Test Suites · Results"] AUTH["Auth — NextAuth.js
(Credentials now; SSO/OIDC/SAML planned)"] API["API Routes — internal REST"] end subgraph ENGINE["Sentinel Engine — Python / FastAPI"] BUILT["Built: Hallucination Attribution · Self-hosted LLM Judge
External AI API Runner · Playwright Controller · Red-team Attack Engine"] PLANNED["Planned: Cognitive Benchmark · Accessibility Scorer"] end subgraph DATA["Data Layer"] PG["PostgreSQL — suites, runs, results, users, orgs"] CH["ClickHouse — traces, metrics, time-series"] REDIS["Redis — job queues, cache"] MINIO["MinIO — artifacts, exports (planned)"] end PY -->|"POST /api/traces"| WEB JS -->|"POST /api/traces"| WEB WEB -->|"HTTP, internal"| ENGINE WEB --> DATA ``` 模块化单体:所有五个模块共享一个数据模型、auth 层和测试套件外壳。计算密集型 AI(自托管的 LLM judge、red-teaming、Playwright 控制)作为独立进程在 Python 引擎中运行,并处于同一部署环境内,因此未来可以将模块拆分为独立的微服务,而无需重写代码。 ## 技术栈 | 层级 | 技术 | |---|---| | UI + API 外壳 | Next.js 15 (App Router) + TypeScript | | AI 引擎 | Python 3.12 + FastAPI + Uvicorn | | ORM | Prisma(仅限 Web——Python 引擎目前暂无数据库访问权限) | | 主数据库 | PostgreSQL 16 | | 指标数据库 | ClickHouse | | 队列 | Redis + BullMQ (JS) / Celery (Python) | | Artifact 存储 | MinIO(兼容 S3) | | 认证 | NextAuth.js v5(目前为 Credentials;计划通过 OIDC/SAML 支持 SSO) | | UI 组件 | shadcn/ui + Tailwind CSS | | Monorepo | pnpm workspaces + Turborepo | | Python 打包 | Poetry | | 容器 | Docker Compose (开发/生产) | | 测试 | Vitest (JS) + pytest (Python) | ## 快速开始 前置条件:Node.js ≥ 20,pnpm ≥ 9,Docker。 ``` cp .env.example .env # 启动 Postgres、Redis、MinIO、ClickHouse、Ollama(自托管 LLM judge)以及 Python engine docker compose -f docker/docker-compose.yml -f docker/docker-compose.dev.yml up -d # 一次性操作:将 judge 模型拉取到 Ollama 容器中 docker exec sentinel_ollama ollama pull llama3.2:3b pnpm install pnpm dev # runs all apps in the monorepo, Next.js on :3000 ``` ## 开发说明 ``` pnpm build # turbo run build pnpm test # turbo run test (Vitest across packages) pnpm lint # turbo run lint pnpm check-types # turbo run check-types cd apps/engine && poetry install && poetry run pytest # Python engine tests ``` ## 仓库结构 ``` sentinel/ ├── apps/ │ ├── web/ # Next.js 15 app — dashboard, auth, module UIs, API routes │ └── engine/ # Python FastAPI service — one router per module ├── packages/ │ ├── sentinel-py/ # Agent instrumentation SDK (PyPI) │ └── sentinel-js/ # Agent instrumentation SDK (npm) └── docker/ # Compose files for the data layer + engine ``` ## 设计原则 - **仅限自托管。** 在你自己的 VPC/集群中部署;数据不会离开你的环境。 - **SDK 优先的 trace 捕获。** Agent 插桩会发出由两个 SDK 共享的稳定 trace 结构,因此插桩不会随后端的演进而改变。 - **在发出时而非在应用上失败关闭。** SDK 故障(网络、配置格式错误)会在发出边界处被吞没——损坏的 trace 管道绝不应使被插桩的 agent 崩溃。 ## License 尚未授权——将在 v1 版本发布前添加许可证。在此之前,保留所有权利。 ## 联系方式 如有问题或反馈:[its.aks@outlook.com](mailto:its.aks@outlook.com)
标签:AI质量保障, AI风险缓解, 可访问性审计, 大型语言模型, 搜索引擎查询, 本地部署, 测试用例, 版权保护, 特征检测, 红队评估, 自动化攻击