# 非通用 Agent Framework 目标与评测草稿 v0

## 1. 定位

这个 framework 不是通用 agent framework。

它是一个有明确取舍的平台，用来快速构建、上线、运营和持续改进生产级业务应用。agent 只是业务系统的一部分，不是系统本身。

目标不是“很多 agent 能互相聊天、能调用工具”。目标是：

1. 业务团队能从一个业务需求快速长出应用。
2. 应用能快速变成生产服务。
3. 生产服务能持续证明行业领先的业务价值。

这个 framework 应该用业务应用结果、生产契约和可衡量价值来评判，而不是用 agent 抽象是否优雅来评判。

## 2. 目标应用类型

framework 应聚焦具备以下特征的业务应用：

- 应用连接真实业务系统，例如 CRM、客服、ITSM、财务、HR、采购、云平台、数据库、可观测平台、工单系统或内部管理系统。
- 应用会读写持久化业务状态。
- 应用有面向用户的工作流，不只是聊天。
- 应用必须 enforce 租户、用户、数据、工具和审批边界。
- 应用可以通过最终状态、业务 KPI、审计 trace 和运行 SLO 来评估。
- 应用通过生产 trace、失败案例、回归 eval 和版本化发布持续改进。

## 3. 核心目标

framework 必须优化三个周期。

| 目标 | 定义 | 核心问题 |
|---|---|---|
| Time to Application | 从业务需求到可用应用的时间 | 团队多快能创建一个用户可以试用的 workflow？ |
| Time to Production | 从可用应用到生产服务的时间 | 应用多快能通过安全、可靠性、可观测和发布门禁？ |
| Time to Leading Value | 从生产服务到证明业务价值的时间 | 它多快能优于现有流程、纯人工流程或竞品平台？ |

## 4. 非目标

- 不最大化通用框架灵活性。
- 不把任意 agent graph 设计作为主要产品价值。
- 不让 final answer 质量成为主要成功指标。
- 不让每个业务应用重复实现 workflow state、credentials、audit、eval、deployment、quota 和 observability。
- 不用前端行为或聊天记录作为 canonical business state。
- 不允许 raw payload、summary、UI artifact、audit log、memory 和 training data 混成一个不可控数据通道。

## 5. 核心技术维度

设计目标上需要考虑 7 个核心技术维度。业务价值不作为独立技术维度，而是这些技术维度共同作用后的结果层。

| 核心技术维度 | 关注问题 | 主要子维度 |
|---|---|---|
| Application Factory Efficiency | 能否快速从业务需求生成可运行、可演进的应用 | Application Generation Speed、Engineering Integration & Maintainability |
| Context Engineering | agent 运行时输入、记忆、证据、artifact 和 compact context 是否有清晰契约 | Context Assembly、Memory & Retrieval、Compaction、Context Replay、Artifact Boundary |
| Reliability & Correctness | 应用是否能稳定完成正确业务状态，并在失败时可恢复 | End-to-End Business Success、Reliability & Robustness |
| Security & Governance | 数据、权限、凭据、审批、审计、租户边界是否可控 | Production Readiness 中的 security/governance 能力 |
| Scalability & Performance | 并发、长任务、队列、backpressure、latency、throughput 是否可支撑生产负载 | Reliability & Robustness、Cost & Scale Efficiency 中的 capacity/performance 能力 |
| Cost Efficiency | token、模型、工具、API、人工和基础设施成本是否可衡量、可归因、可控制 | Cost & Scale Efficiency |
| Continuous Improvement | 是否能从 trace、feedback、eval、版本对比中持续改进并防回归 | Evaluation Loop & Observability |

全量成熟度评分使用这些核心技术维度。

| 核心技术维度 | 全量权重 |
|---|---:|
| Application Factory Efficiency | 16 |
| Context Engineering | 15 |
| Reliability & Correctness | 18 |
| Security & Governance | 18 |
| Scalability & Performance | 12 |
| Cost Efficiency | 9 |
| Continuous Improvement | 12 |

## 6. 阶段分层

阶段分层只描述阶段和核心技术维度的映射关系，不定义额外硬门禁。

| 阶段 | 阶段目标 | 主评分维度 | 辅助/观察维度 |
|---|---|---|---|
| P0: 应用可生成 | 从业务需求快速长出可运行、可验收的应用骨架 | Application Factory Efficiency、Context Engineering、Reliability & Correctness | Continuous Improvement、Security & Governance、Cost Efficiency |
| P1: 可控试运行 | 应用可以在受控环境中跑真实业务 workflow | Context Engineering、Reliability & Correctness、Security & Governance、Continuous Improvement | Application Factory Efficiency、Scalability & Performance、Cost Efficiency |
| P2: 生产服务 | 应用可以稳定上线，对真实用户和真实业务状态负责 | Context Engineering、Security & Governance、Scalability & Performance、Reliability & Correctness、Cost Efficiency | Continuous Improvement、Application Factory Efficiency |
| P3: 领先价值 | 应用持续证明优于人工流程、现有系统或竞品平台 | Context Engineering、Reliability & Correctness、Continuous Improvement、Cost Efficiency、Scalability & Performance | Application Factory Efficiency、Security & Governance |

### 6.1 维度启用矩阵

| 核心技术维度 | P0 | P1 | P2 | P3 |
|---|---|---|---|---|
| Application Factory Efficiency | 主评分 | 辅助评分 | 辅助评分 | 辅助评分 |
| Context Engineering | 主评分 | 主评分 | 主评分 | 主评分 |
| Reliability & Correctness | 主评分 | 主评分 | 主评分 | 主评分 |
| Security & Governance | 基础检查 | 主评分 | 主评分 | 主评分 |
| Scalability & Performance | 观察项 | 辅助评分 | 主评分 | 主评分 |
| Cost Efficiency | 观察项 | 辅助评分 | 主评分 | 主评分 |
| Continuous Improvement | 基础检查 | 主评分 | 主评分 | 主评分 |

## 7. 子维度映射

原来的 8 个评测项作为子维度保留，并补充 context-specific 子域，用来支撑 7 个核心技术维度的具体打分。

| 子维度 | 所属核心技术维度 |
|---|---|
| Application Generation Speed | Application Factory Efficiency |
| Engineering Integration & Maintainability | Application Factory Efficiency |
| Context Assembly & Packing | Context Engineering |
| Memory & Retrieval | Context Engineering |
| Context Compaction & Replay | Context Engineering |
| Artifact & Evidence Boundary | Context Engineering |
| End-to-End Business Success | Reliability & Correctness |
| Reliability & Robustness | Reliability & Correctness、Scalability & Performance |
| Production Readiness | Security & Governance |
| Evaluation Loop & Observability | Continuous Improvement |
| Cost & Scale Efficiency | Cost Efficiency、Scalability & Performance |
| Business Value Leadership | 结果层 KPI，不作为核心技术维度 |

## 8. 竞品能力横向对比

分数按 7 个核心技术维度使用 1-5 分。Context Engineering 是新增维度，当前分数仍是草稿，后续需要按真实 benchmark 重评。

| 平台 | Application Factory Efficiency | Context Engineering | Reliability & Correctness | Security & Governance | Scalability & Performance | Cost Efficiency | Continuous Improvement | 加权分 |
|---|---:|---:|---:|---:|---:|---:|---:|---:|
| OpenAI Agents / Responses | 4.00 | 3.70 | 2.80 | 2.50 | 2.75 | 3.00 | 4.00 | 3.23 |
| LangGraph / LangSmith | 3.67 | 4.30 | 4.20 | 3.50 | 4.00 | 3.50 | 4.50 | 3.95 |
| Google ADK / Vertex Agent Engine | 4.00 | 4.00 | 3.70 | 4.00 | 4.00 | 4.00 | 4.00 | 3.95 |
| Microsoft Agent Framework / Copilot Studio | 4.50 | 4.00 | 3.70 | 4.00 | 4.00 | 4.00 | 4.00 | 4.03 |
| Salesforce Agentforce | 4.17 | 4.20 | 3.80 | 4.50 | 3.50 | 3.50 | 3.50 | 3.95 |
| ServiceNow AI Agent Studio | 4.17 | 4.00 | 4.00 | 4.50 | 3.75 | 3.50 | 3.50 | 3.98 |
| UiPath Agentic Automation | 4.17 | 4.00 | 4.20 | 4.50 | 4.25 | 4.00 | 4.00 | 4.18 |
| AWS Bedrock AgentCore / Agents | 3.67 | 4.50 | 3.70 | 4.50 | 4.25 | 4.50 | 4.00 | 4.13 |
| CrewAI | 3.83 | 2.80 | 3.00 | 2.50 | 3.00 | 3.00 | 3.00 | 3.01 |

### 8.1 参考系统评分

| 系统 | 阶段判断 | 加权分 | 强项 | 子文档 |
|---|---|---:|---|---|
| Investibook | P1.5，接近内部 P2 | 3.35 | Reliability & Correctness、Continuous Improvement | [investibook-score.md](investibook-score.md) |
| hub9 | P1，轻量 hub/daemon runtime | 3.14 | Application Factory Efficiency、Reliability & Correctness、Cost Efficiency | [hub9-score.md](hub9-score.md) |

参考系统子文档仍沿用加入 `Context Engineering` 前的旧 6 维评分，后续需要单独重评。按当前理解，Investibook 的 evidence compaction / workspace report / authored analysis boundary 会显著加强 `Context Engineering`；hub9 的 TiDB-backed durable routing state 会有一定帮助，但不是它的核心强项。

### 8.2 TiDB AI Infra 加分点

TiDB AI Infra 不按 CLI command 评分，而按 infra 组件评分。每个组件最多只映射 1 个主维度和 1 个次维度；局部副作用不扩展成多维度加分。

| 组件 | 组件定位 | 主加分维度 | 次加分维度 | 能力边界 | 加分原因 |
|---|---|---|---|---|---|
| `db9` | agent-native serverless Postgres，底层基于 TiKV，内置 fs9 文件系统、vector/embedding、HTTP from SQL、branching、cron、functions、observability。 | Application Factory Efficiency | Context Engineering | 用于 agent backend/workspace：结构化状态进 Postgres，raw context/artifact/session snapshot 进 fs9 文件系统，并可通过 SQL、CLI、SDK、mount 使用；不是 memory 产品本身，也不等同于只给 CI 用的临时数据库。 | 业务应用可以快速拿到完整 backend surface：database、file storage、semantic retrieval、branch isolation、scheduled jobs 和 type generation；同时把 raw artifact 和模型上下文分层，减少把大 payload 直接塞进 prompt 的需求。 |
| `mem9` | agent memory infrastructure，面向 OpenClaw、Claude Code、OpenCode、Codex、Dify 等 runtime，提供 server-backed persistent memory。 | Context Engineering | Continuous Improvement | 用于长期记忆存储、hybrid recall、session ingest、memory CRUD、space/app isolation、dashboard 管理；不是 TiDB serverless cluster takeover 组件。当前 Investibook/agentkit 没有发现本地 `mem9` 接入，但公开 `mem9-ai/mem9` repo 和 mem9.ai 文档已明确其 memory 定位。 | 跨 session、跨机器、跨 agent 的持久记忆能沉淀用户纠错、项目事实、历史案例和生产反馈；OpenClaw memory plugin 会在 prompt build 前召回相关 memory，并在 reset/compaction/agent_end 生命周期中保存或重查记忆，从而提升长期迭代和状态连续性。 |

不建议把 `db9` 计入 `Security & Governance` 或生产级 `Scalability & Performance`。不建议把 `mem9` 计成 application database provisioning 能力；它的主战场是 durable memory、retrieval、memory governance 和 multi-agent shared context。

`mem9` 与 OpenClaw 的关系应写成外部 memory backend/plugin integration；不能写成 OpenClaw 官方内置默认 memory。

### 8.3 平台能力画像

| 平台 | 最强能力 | 相对本 brief 的最弱能力 |
|---|---|---|
| OpenAI Agents / Responses | 模型原生 agent primitives、hosted tools、tracing、eval hooks | 不是完整生产业务应用平台；tenant RBAC、durable workflow、部署和业务状态需要应用侧负责 |
| LangGraph / LangSmith | durable agent runtime、state graph、checkpointing、human-in-loop、tracing/eval | 工程框架强，但不是 opinionated business app factory；治理和业务价值层需要平台补齐 |
| Google ADK / Vertex Agent Engine | code-first agent 开发，加上云部署、sessions、tools、eval、GCP 企业集成 | 云平台耦合明显；app-level 业务 contract 和 multi-cloud neutrality 需要额外设计 |
| Microsoft Agent Framework / Copilot Studio | 企业低代码应用创建、connector、Microsoft 生态、治理路径 | 业务成功高度依赖 Microsoft 生态适配和 connector 覆盖 |
| Salesforce Agentforce | CRM-native 业务价值、企业数据 grounding、actions、trust/governance story | 强在 Salesforce-centered workflow；对非 CRM operational system 不够通用 |
| ServiceNow AI Agent Studio | ITSM/workflow-native automation、企业流程集成、治理 | 强在 ServiceNow-centered workflow；在 ServiceNow process/data model 之外泛化有限 |
| UiPath Agentic Automation | automation runtime、orchestrator、human-in-loop、治理、企业 workflow execution | 自动化底座强；agent-native reasoning/app generation 深度需要 benchmark 验证 |
| AWS Bedrock AgentCore / Agents | 云生产 primitives、identity、gateway、memory/runtime/observability、AWS 集成 | 对业务 app generation 和业务 KPI loop 的 opinionated 程度较低 |
| CrewAI | 快速 multi-agent workflow prototyping、简单心智模型 | production runtime、governance、durable execution 和 enterprise value proof 需要外部平台支持 |

## 9. 目标差异化

framework 不应该尝试在每个竞品的主场击败它们。

应该在这个技术能力组合轴上胜出：

```text
Application Factory Efficiency
+ Context Engineering
+ Reliability & Correctness
+ Security & Governance
+ Scalability & Performance
+ Cost Efficiency
+ Continuous Improvement
```

目标门槛：

| 维度 | 目标分数 |
|---|---:|
| Application Factory Efficiency | 4.5+ |
| Context Engineering | 4.5+ |
| Reliability & Correctness | 4.5+ |
| Security & Governance | 4.5+ |
| Scalability & Performance | 4.2+ |
| Cost Efficiency | 4.2+ |
| Continuous Improvement | 4.5+ |
| 加权总分 | 4.4+ |

目标差异化不是更灵活的 graph API，而是这些技术能力共同让“业务需求到生产价值”的路径更短、更安全。

## 10. Hard Gates

Hard Gates 是 cross-cutting production safety requirements，不只属于 Security & Governance。它们不参与普通加权评分。触发 Hard Gate 时，应用不能进入下一阶段。

| 范围 | 主要归属维度 | Hard Gate |
|---|---|---|
| Business State | Reliability & Correctness | agent 输出不能作为 source of truth。持久 workflow state 和业务系统状态必须存在。 |
| Side Effect | Reliability & Correctness | 工具重试不能重复产生外部副作用，除非有 idempotency key 或 compensation policy。 |
| Permission | Security & Governance | 每次工具调用都必须绑定 tenant、user、role、scope、credential source、approval policy 和 audit trail。 |
| Context Boundary | Context Engineering | raw payload、compact agent context、retrieved memory、tool output、UI artifact 和 eval artifact 必须按契约分层，不能混成一个 prompt/data 通道。 |
| Data Boundary | Security & Governance | raw payload、compact agent context、UI artifact、audit log、memory 和 eval data 必须有 tenant、retention、DLP 和 access policy。 |
| Secret Safety | Security & Governance | secret value 不能进入模型上下文、长期记忆、用户可见输出或普通日志。 |
| Approval | Security & Governance | 高风险动作必须显式审批，并产生 requester、approver、payload、result、time 的持久证据。 |
| Observability | Continuous Improvement | 每次 run 必须有 trace、tool call、state transition、cost、latency、artifact、version 和 final state diff。 |
| Evaluation | Continuous Improvement | eval 必须评分 workflow correctness、state correctness、permission、cost、latency 和 value，而不只评分最终文本。 |
| Release | Reliability & Correctness | prompt、model、tool schema、workflow policy、worker image 和 eval baseline 必须版本化且可回滚。 |
| Tenancy | Security & Governance | tenant isolation 必须覆盖数据、凭据、执行、quota、budget、cache、trace 和 artifact。 |

## 11. 持续跟踪来源

| 范围 | 来源 |
|---|---|
| OpenAI Agents SDK | https://openai.github.io/openai-agents-python/ |
| OpenAI agent evals and tracing | https://platform.openai.com/docs/guides/agent-evals |
| LangGraph | https://docs.langchain.com/oss/python/langgraph/overview |
| LangSmith evaluation | https://docs.langchain.com/langsmith/evaluation |
| Google ADK | https://google.github.io/adk-docs/ |
| Vertex AI Agent Engine | https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/overview |
| Microsoft Agent Framework | https://learn.microsoft.com/en-us/agent-framework/ |
| Copilot Studio | https://learn.microsoft.com/en-us/microsoft-copilot-studio/fundamentals-what-is-copilot-studio |
| AWS Bedrock AgentCore | https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/what-is-bedrock-agentcore.html |
| OpenTelemetry GenAI semantic conventions | https://opentelemetry.io/docs/specs/semconv/gen-ai/ |
| db9 | https://db9.ai/ |
| db9 docs | https://db9.ai/docs/overview/ |
| db9 agent workflows | https://db9.ai/docs/agent-workflows/overview/ |
| mem9 | https://github.com/mem9-ai/mem9 |
| mem9 docs | https://mem9.ai/docs/ |
| mem9 API | https://mem9.ai/api/ |
| mem9 on TiDB Cloud | https://www.pingcap.com/blog/how-we-built-mem9-agent-memory-product/ |
| SWE-bench | https://www.swebench.com/ |
| TAU-bench | https://arxiv.org/abs/2406.12045 |
| GAIA | https://arxiv.org/abs/2311.12983 |
| AgentBench | https://arxiv.org/abs/2308.03688 |
