- v2 foundation: ActionResult/DevError/ActorContext/ResourceRef/Execution types - ActionRegistry + ResourceRegistry (namespaced types, FAIL FAST on duplicates) - ActionRuntime pipeline: validate -> authorize -> middleware -> handler -> output validation -> audit -> event -> execution persisted (devos_action_executions) - Legacy bridge: v1 services registered as devops.*/core.* resources & actions (47 actions, 9 resources) - Unified Action API: POST /api/v2/actions/:actionId, GET discovery (actions/resources) - 10 v2 unit tests (registry fail-fast, validation, authz, failure audit, events)
37 KiB
06_MCP_SKILL_AGENT_RUNTIME.md
DevOS Developer Work OS MCP / Skill / Capability / Agent Runtime 设计规范 Version: 1.0
1. 文档目标
06 定义 DevOS 的 AI Capability Runtime。
前面的架构已经确定:
03 Resource / Action
04 Task / Job / Execution
05 Plugin Runtime
现在需要解决:
Agent 到底如何发现能力、理解能力、规划任务、调用工具并持续执行?
核心目标不是再做一个“聊天机器人”。
而是建立:
Capability
↓
Skill
↓
Agent
↓
Plan
↓
Task
↓
Action
↓
Execution
同时支持:
MCP
Plugin
Skill
Workflow
Human
统一进入同一个 Runtime。
2. 最重要的架构原则
DevOS 必须严格区分:
MCP
Skill
Action
Agent
它们不是同一个东西。
MCP
如何访问外部能力。
例如:
GitHub MCP
Cloudflare MCP
Browser MCP
Search MCP
Action
系统真正可以执行的原子行为。
例如:
github.repository.create
website.scan
server.deploy
article.publish
Skill
告诉 Agent 如何完成一类目标。
例如:
seo.website.audit
seo.campaign.execute
github.repository.manage
deploy.application
Agent
根据 Goal 动态决定使用哪些 Skill / Action / Resource。
因此:
MCP ≠ Skill
Skill ≠ Action
Action ≠ Agent
3. 四层架构
DevOS AI Runtime:
┌──────────────────────────────┐
│ Agent │
│ Goal / Planning │
└──────────────┬───────────────┘
│
┌──────────────▼───────────────┐
│ Skill │
│ Domain Knowledge │
└──────────────┬───────────────┘
│
┌──────────────▼───────────────┐
│ Capability │
│ Action / MCP / Resource │
└──────────────┬───────────────┘
│
┌──────────────▼───────────────┐
│ DevOS Runtime │
│ Permission / Task / Queue │
└──────────────────────────────┘
4. Capability
Capability 是 Agent 能看到的:
“系统能做什么”的统一描述。
Capability 可以来自:
Core
Plugin
MCP
Action
Skill
Workflow
5. Capability Registry
DevOS 必须建立:
Capability Registry
例如:
capabilities
├── actions
├── resources
├── skills
├── mcp-tools
└── workflows
统一搜索:
capabilityRegistry.search({
query: "deploy website"
})
返回:
server.deploy
docker.build
github.repository.release
6. Capability 数据模型
interface Capability {
id: string
type:
| "action"
| "skill"
| "mcp_tool"
| "workflow"
| "resource"
name: string
description: string
namespace: string
inputSchema?: unknown
outputSchema?: unknown
permissions?: string[]
source: {
type: "core" | "plugin" | "mcp"
id: string
}
metadata?: Record<string, unknown>
}
7. Capability Discovery
Agent 不应该把所有工具一次性塞进 LLM Context。
错误:
5000 tools
↓
全部发送给模型
这会导致:
Token 巨大
成本高
模型选择能力下降
正确:
Goal
↓
Capability Search
↓
Top relevant capabilities
↓
LLM
8. 两阶段 Discovery
推荐:
Phase 1:
Semantic Search
Phase 2:
Permission / Scope Filtering
流程:
Goal
↓
Search
↓
Candidate Capabilities
↓
Permission
↓
Scope
↓
Availability
↓
Final Capabilities
9. Capability Search
例如:
Goal:
“把最新 GitHub 项目部署到服务器”
搜索:
deploy
github
repository
docker
server
候选:
github.repository.get
github.repository.release
docker.build
server.deploy
server.health_check
Agent 才看到这些能力。
10. Token-Efficient Discovery
这是 DevOS Agent Runtime 的重点。
不要发送:
完整 JSON Schema
完整 Plugin Manifest
完整 README
完整文档
第一阶段只返回:
id
name
description
type
required permission
例如:
{
"id": "server.deploy",
"name": "Deploy Application",
"description": "Deploy an application to a server",
"type": "action"
}
模型决定需要后,再获取详细 Schema。
11. Progressive Disclosure
能力信息分层:
Level 1
Capability Summary
Level 2
Capability Schema
Level 3
Skill Instructions
Level 4
Execution Context
例如:
Agent
↓
“我需要部署”
↓
发现 server.deploy
↓
获取 schema
↓
生成 input
↓
执行
12. Skill
Skill 是 Agent 的:
任务解决方法 / 专业流程 / 决策指南。
Skill 不应该成为一个新的执行 Runtime。
13. Skill 示例
seo.website.audit
描述:
目标:
完成网站 SEO 审计。
输入:
website
步骤:
1. 获取网站
2. Crawl
3. 技术 SEO 分析
4. 内容分析
5. Backlink 分析
6. 生成报告
使用能力:
website.scan
seo.keyword.analyze
seo.backlink.analyze
report.generate
14. Skill Manifest
interface SkillManifest {
id: string
name: string
description: string
version: string
inputs?: unknown
outputs?: unknown
requiredCapabilities?: string[]
instructions?: string
examples?: SkillExample[]
metadata?: Record<string, unknown>
}
15. Skill 不应该直接执行代码
错误:
Skill
↓
直接调用 API
正确:
Skill
↓
选择 Capability
↓
Action Runtime
因此 Skill 是:
Knowledge + Strategy
而不是:
Execution Engine
16. Skill 来源
Skill 可以来自:
Core
Plugin
Project
User
Agent
Marketplace
例如:
skills/
├── core/
├── seo/
├── github/
├── devops/
└── custom/
17. Skill Scope
Skill 也支持 Scope:
global
organization
project
user
例如某个项目可以有:
project.deploy.production
只适用于该项目。
18. Skill 与 Plugin
Plugin:
提供能力。
Skill:
教 Agent 如何使用这些能力。
例如:
GitHub Plugin
│
├── github.repository.sync
├── github.repository.create
└── github.issue.create
GitHub Skill
│
└── github.repository.manage
这两个应该分开。
19. MCP
MCP 是 DevOS 与外部 Agent / Tool Ecosystem 之间的标准能力接口。
DevOS 可以:
作为 MCP Client
也可以:
作为 MCP Server
20. DevOS 作为 MCP Client
例如:
DevOS
↓
External MCP
↓
Browser
或者:
DevOS
↓
Search MCP
21. DevOS 作为 MCP Server
外部 Agent:
Claude
Cursor
其他 Agent
可以连接:
DevOS MCP Server
获得:
Resources
Actions
Skills
Tasks
22. MCP Tool 映射
最重要规则:
MCP Tool 必须尽可能映射到 DevOS Capability。
例如:
MCP:
create_github_issue
映射:
github.issue.create
调用:
MCP
↓
Capability
↓
Action Runtime
23. MCP 不允许绕过权限
即使调用来源是外部 Agent:
External Agent
↓
MCP
仍然:
Authentication
↓
Authorization
↓
Scope
↓
Action
↓
Audit
绝不能:
MCP
↓
direct database
24. MCP Server
DevOS MCP Server:
/api/mcp
提供:
tools
resources
prompts
但是不要默认暴露整个 DevOS。
必须经过:
Capability Filter
25. MCP Capability Filter
根据:
Actor
Organization
Project
Permission
Scope
Plugin Status
过滤。
例如:
Admin
→ 100 tools
Normal User
→ 30 tools
Agent
→ 15 tools
26. Agent
Agent 是:
Goal-driven Decision & Execution Runtime。
Agent 不只是:
LLM + Prompt
而应该拥有:
Goal
Memory
Context
Planning
Capability Discovery
Execution
Observation
Reflection
Retry
Approval
27. Agent Runtime
┌─────────────────────────────┐
│ Agent Runtime │
├─────────────────────────────┤
│ Goal │
│ Context │
│ Memory │
│ Planner │
│ Capability Discovery │
│ Executor │
│ Observer │
│ Evaluator │
│ Approval │
└─────────────────────────────┘
28. Agent Goal
interface AgentGoal {
id: string
description: string
actor: Actor
organizationId: string
projectId?: string
status:
| "pending"
| "planning"
| "executing"
| "waiting"
| "completed"
| "failed"
| "cancelled"
constraints?: Record<string, unknown>
createdAt: Date
}
29. Goal 示例
用户:
10天内让 a.com 获得100篇软文和200个外链。
Agent 不应该直接:
调用 SEO Tool
而应该:
Goal
↓
Understand
↓
Discover Skills
↓
Discover Capabilities
↓
Plan
↓
Approval if needed
↓
Tasks
↓
Execute
↓
Observe
↓
Verify
↓
Report
30. Agent Plan
Plan 是 Agent 对 Goal 的执行计划。
interface AgentPlan {
id: string
goalId: string
steps: AgentPlanStep[]
status: string
}
Step:
interface AgentPlanStep {
id: string
type:
| "action"
| "task"
| "workflow"
| "approval"
| "condition"
capabilityId: string
input?: unknown
dependsOn?: string[]
status: string
}
31. Agent Plan 示例
Goal
│
├── Step 1
│ seo.website.scan
│
├── Step 2
│ seo.keyword.research
│
├── Step 3
│ seo.content.generate
│
├── Step 4
│ seo.content.publish
│
└── Step 5
seo.backlink.submit
32. Plan 不等于 Workflow
两者必须区分。
Workflow
=
预先定义的流程
Agent Plan
=
Agent 根据当前 Goal 动态产生的计划
例如:
Workflow:
A → B → C
Agent:
Goal
↓
发现情况
↓
A
↓
观察结果
↓
决定 B 或 D
↓
继续
33. Agent Loop
Agent Runtime 核心:
Observe
↓
Think / Plan
↓
Act
↓
Observe
↓
Evaluate
↓
Continue / Replan / Finish
代码模型:
while (!goal.completed) {
const observation = await observe()
const decision = await planner.decide(observation)
const result = await executor.execute(decision)
await evaluator.evaluate(result)
}
实际生产环境必须支持:
maxIterations
timeout
budget
cancel
approval
34. Agent Executor
Agent Executor 不应该直接执行代码。
Agent Executor
↓
Capability
↓
Action Runtime
例如:
executor.execute({
capability: "github.repository.create",
input: {...}
})
最终:
Action Runtime
负责真正执行。
35. Agent Observation
Action 完成后:
Execution Result
↓
Observation
↓
Agent
例如:
{
"success": true,
"output": {
"pages": 1032,
"errors": 14
}
}
Agent 决定:
继续
或者:
重新规划
36. Replanning
Agent 不应该一次生成一个不可修改的巨大计划。
推荐:
Plan
↓
Execute 1-3 steps
↓
Observe
↓
Replan
尤其适用于:
外部 API
Web
SEO
DevOps
自动化
因为环境会发生变化。
37. Agent Memory
Memory 分为:
Short-term
Long-term
Working Context
Short-term
当前执行上下文:
最近 Action
最近结果
当前计划
Long-term
持久知识:
Project Preferences
Previous Decisions
Important Facts
Working Context
当前 Goal 所需的信息:
website
project
credentials
resources
previous results
38. Memory 不应该等于 Chat History
不要:
整个聊天记录
↓
每次全部发给 LLM
应该:
Memory Store
↓
Retrieve relevant context
↓
LLM
39. Agent Context
统一:
interface AgentContext {
goalId: string
organizationId: string
projectId?: string
actor: Actor
resources: ResourceRef[]
capabilities: Capability[]
memory: MemoryContext
variables: Record<string, unknown>
budget?: AgentBudget
}
40. Agent Budget
Agent 必须有预算控制。
interface AgentBudget {
maxTokens?: number
maxIterations?: number
maxExecutionTimeMs?: number
maxTasks?: number
maxMoney?: number
maxCredits?: number
}
例如:
最多:
100 次 Action
20 次 LLM
$5
30 分钟
41. Agent Cost
每个 Agent Execution 应记录:
LLM tokens
Tool calls
Action executions
External API calls
Money
Credits
最终:
Goal Cost
$2.37
42. Approval
Agent 遇到高风险 Action:
Agent
↓
Action
↓
requiresApproval
↓
Approval Task
↓
Human
↓
Approved
↓
Execution
例如:
删除服务器
部署生产环境
批量发送邮件
批量发布内容
批量外链
43. Agent Safety Policy
每个 Agent 都必须经过 Policy。
例如:
interface AgentPolicy {
allowedCapabilities: string[]
deniedCapabilities: string[]
maxIterations: number
requireApprovalFor: string[]
}
44. Agent Permission
Agent 的权限不能自动等于用户全部权限。
例如:
User:
admin
Agent:
seo-agent
Agent 可以被限制:
seo.website.*
seo.content.*
但:
server.delete
明确禁止。
45. Agent Identity
Agent 应该拥有自己的 Actor:
actor.type = "agent"
actor.id = "agent_xxx"
Audit:
User
↓
Agent
↓
Action
因此能够知道:
“这个操作是谁授权的,又是哪个 Agent 执行的?”
46. Agent Task
Agent 创建:
Task
而不是:
AgentTask
避免出现两套系统。
正确:
Agent
↓
Task Runtime
47. Agent Workflow
Agent 可以调用 Workflow:
Agent
↓
Workflow
↓
Tasks
↓
Actions
这非常适合:
稳定流程
Agent 只负责:
选择 Workflow
填充参数
观察结果
48. Skill + Workflow + Agent
三者关系:
Skill
=
怎么解决问题
Workflow
=
固定怎么执行
Agent
=
当前应该怎么解决
例如:
Skill:
SEO Audit
Workflow:
标准 SEO Audit Workflow
Agent:
根据网站情况决定是否使用完整 Workflow
49. Skill 可以推荐 Workflow
Skill 可以声明:
{
"recommendedWorkflows": [
"seo.standard_audit"
]
}
Agent 可以选择:
Workflow
或者:
动态 Action Plan
50. Agent Tool Calling
模型产生:
{
"capability": "github.repository.sync",
"input": {
"repositoryId": "repo_123"
}
}
Agent Runtime 不应该直接信任。
必须:
LLM Output
↓
Schema Validation
↓
Permission
↓
Scope
↓
Policy
↓
Approval
↓
Action Runtime
51. Tool Result
Tool Result 必须标准化:
interface ToolResult {
success: boolean
data?: unknown
error?: {
code: string
message: string
}
executionId?: string
taskId?: string
}
52. MCP Tool Result
MCP 返回的结果最终应该转换为统一:
Capability Result
这样 Agent 不需要知道:
这是 MCP
这是 Plugin
这是 Core
它只知道:
Capability
53. Capability Adapter
如果外部 MCP Tool 无法直接映射到 Action:
External MCP
↓
MCP Adapter
↓
Capability
Adapter 负责:
Input conversion
Output conversion
Error normalization
54. MCP Resource
MCP Resource 可以映射:
DevOS Resource
例如:
github://repository/123
对应:
github.repository:123
Agent 可以读取:
Resource
再决定调用:
Action
55. Skill Discovery
Agent 不应该搜索所有 Skill。
例如:
Goal:
部署 Next.js 应用
搜索:
deploy
nextjs
application
返回:
application.deploy
docker.deploy
nextjs.deploy
然后再加载详细内容。
56. Capability Ranking
搜索结果应该有:
relevance
permission
availability
quality
cost
例如:
server.deploy
score: 0.93
docker.deploy
score: 0.84
ssh.execute
score: 0.51
优先选择高层 Capability。
57. 为什么不能让 Agent 直接 SSH
例如:
Agent
↓
ssh.execute
↓
rm -rf /
风险非常高。
应该优先:
Agent
↓
server.deploy
高层 Action 可以拥有:
Schema
Permission
Policy
Validation
Audit
因此:
Agent 应优先使用业务 Action,而不是低层原始工具。
58. Capability Abstraction Level
建议:
Level 1
Business Action
Level 2
System Action
Level 3
Raw Tool
例如:
deploy.application
↓
docker.run
↓
ssh.execute
Agent 默认优先 Level 1。
只有没有高层能力时,才允许向下。
59. Agent Fallback
例如:
deploy.application
不存在。
Agent 可以发现:
docker.build
server.execute_command
然后组合:
docker.build
↓
server.execute_command
但如果存在高层:
deploy.application
就不应该自己拼底层 Action。
60. Agent Planning Policy
Planner 可以设置:
prefer_existing_workflow
prefer_high_level_actions
minimize_tool_calls
minimize_cost
require_approval
例如:
{
"preferHighLevelActions": true,
"minimizeToolCalls": true,
"maxIterations": 20
}
61. Agent State Machine
pending
↓
planning
↓
executing
↓
observing
↓
evaluating
├── completed
├── replanning
├── waiting
└── failed
取消:
任何状态
↓
cancelled
62. Agent Run
一次 Agent Goal 执行应该有:
interface AgentRun {
id: string
goalId: string
status: AgentRunStatus
model?: string
provider?: string
iterations: number
tokenUsage?: TokenUsage
cost?: ExecutionCost
startedAt?: Date
completedAt?: Date
}
63. Agent Step
interface AgentStep {
id: string
runId: string
type:
| "thought"
| "plan"
| "tool_call"
| "observation"
| "evaluation"
| "approval"
capabilityId?: string
input?: unknown
output?: unknown
status: string
createdAt: Date
}
注意:
不要求把模型内部完整思维过程持久化或展示。
只保存:
decision summary
action
result
reason / metadata
64. Agent Trace
UI:
Agent Run
────────────────────────────
Goal
10天完成 SEO Campaign
Step 1
✓ Website Scan
Step 2
✓ Keyword Research
Step 3
✓ Content Plan
Step 4
⏳ Generate Content
Step 5
○ Publish
Step 6
○ Backlinks
点击 Step:
Capability
Input
Execution
Output
Cost
Logs
65. Agent 与 Event
Agent 可以订阅 Event:
deployment.completed
website.scan.completed
content.published
例如:
Event
↓
Agent Observation
↓
Agent Decision
66. Agent 与 Scheduler
Scheduler 可以启动 Agent Goal:
每天 02:00
↓
Create Agent Goal
↓
Agent Run
例如:
每天检查所有网站 SEO 健康状态。
67. Agent 与 Webhook
Webhook:
GitHub Push
↓
Event
↓
Agent Trigger
↓
Goal
↓
Plan
68. Agent Trigger
统一:
interface AgentTrigger {
type:
| "manual"
| "schedule"
| "event"
| "webhook"
config: unknown
goalTemplate: unknown
}
69. Agent 与 Plugin
Plugin 提供:
Capability
Skill
MCP
Agent 自动发现。
因此 Plugin 安装:
Install SEO Plugin
之后 Agent 自动拥有:
SEO Skills
SEO Actions
SEO MCP
无需修改 Agent Core。
70. 这是 DevOS 的关键扩展机制
最终:
安装 Plugin
↓
Resources
Actions
Skills
MCP
UI
↓
Capability Registry
↓
Agent 自动发现
因此:
增加 Agent 能力,不需要修改 Agent。
只需要增加 Plugin。
71. AI SEO 示例
用户:
10天内给 a.com 做100篇软文 + 200个外链。
Agent:
Goal
↓
Discover Skills
↓
seo.campaign.execute
Skill:
需要:
website
keyword data
content capability
backlink capability
Capability Discovery:
seo.website.scan
seo.keyword.research
seo.content.generate
seo.content.publish
seo.backlink.submit
72. Agent Plan
1. Scan website
2. Research keywords
3. Build content strategy
4. Generate 100 articles
5. Publish articles
6. Find backlink opportunities
7. Submit backlinks
8. Verify
9. Report
但是:
Agent 不一定一次性执行全部步骤。
可能:
Scan
↓
Observe
↓
Replan
↓
Keyword Research
↓
Observe
↓
Generate
73. 批量任务
100 篇文章不能:
Agent
↓
生成 100 × Tool Call
应该:
Agent
↓
Create Task
↓
Task creates Jobs
↓
100 Jobs
↓
Queue
↓
Workers
Agent 只负责:
规划
而不是亲自执行 100 个工作单元。
74. Agent 与 Task 的边界
Agent:
“What should we do?”
Task:
“What work needs to be done?”
Action:
“How do we execute it?”
Execution:
“What actually happened?”
这是整个 AI Runtime 的核心分层。
75. Agent 不应该控制 Queue
错误:
Agent
↓
Redis
↓
Queue
正确:
Agent
↓
Task Runtime
↓
Queue Runtime
76. Agent 不应该控制 Worker
同样:
Agent
↓
Worker
禁止。
Agent 只:
Create Task
Execute Action
Observe Result
77. AI Runtime API
建议:
POST /agents/goals
GET /agents/goals
GET /agents/goals/:id
POST /agents/goals/:id/cancel
GET /agents/runs/:id
GET /agents/runs/:id/steps
POST /capabilities/search
GET /capabilities/:id
GET /skills
GET /skills/:id
78. Capability API
POST /api/capabilities/search
Request:
{
"query": "deploy application",
"types": ["action", "skill", "workflow"],
"limit": 10
}
Response:
{
"items": [
{
"id": "application.deploy",
"type": "action",
"name": "Deploy Application"
}
]
}
79. Capability Detail API
GET /api/capabilities/application.deploy
返回:
Input Schema
Output Schema
Permissions
Description
Examples
Provider
Version
80. Skill API
GET /api/skills/seo.website.audit
返回:
Description
Inputs
Outputs
Required Capabilities
Instructions
Examples
81. MCP Gateway
推荐:
packages/mcp/
结构:
MCP Runtime
├── MCP Server
├── MCP Client
├── Tool Registry
├── Resource Registry
├── Prompt Registry
└── Adapter
82. Agent Runtime Package
packages/agent/
├── runtime
├── planner
├── executor
├── observer
├── evaluator
├── memory
├── policy
└── budget
83. Skill Runtime
packages/skill/
├── registry
├── loader
├── resolver
├── validator
└── runtime
84. Capability Runtime
packages/capability/
├── registry
├── discovery
├── resolver
├── ranking
├── permission-filter
└── adapters
85. 模型 Provider
Agent Runtime 不应该绑定单一 LLM。
统一:
interface ModelProvider {
generate(request: ModelRequest): Promise<ModelResponse>
stream(request: ModelRequest): AsyncIterable<ModelChunk>
}
支持:
OpenAI
Anthropic
Google
Local
OpenRouter
Custom
86. Model Registry
Model Registry
记录:
Provider
Model
Context Window
Pricing
Capabilities
Vision
Tool Calling
Structured Output
Agent 可以选择:
cheap model
fast model
reasoning model
vision model
87. Model Policy
不同任务可以选择不同模型:
简单分类
→ Fast / Cheap
复杂 Planning
→ Reasoning
图片分析
→ Vision
不要把模型选择硬编码进 Agent。
88. Structured Output
Planner 必须尽量使用:
JSON Schema
例如:
const planSchema = z.object({
steps: z.array(...)
})
避免:
LLM
↓
纯文本
↓
正则解析
89. Agent Error Handling
Agent 可能遇到:
Capability unavailable
Permission denied
Tool failed
Invalid input
Timeout
Budget exceeded
Model error
统一处理:
Retry
Fallback
Replan
Ask Human
Fail
90. Human-in-the-loop
Agent 不应该永远自动完成。
可以:
Agent
↓
Need decision
↓
Human Approval
↓
Continue
Task:
waiting
Approval 完成:
running
91. Agent Chat
聊天只是 Agent 的一个入口。
Chat
↓
Agent Goal
而不是:
Chatbot
=
Agent Runtime
未来还可以:
API
CLI
Scheduler
Webhook
MCP
创建 Goal。
92. Agent UI
推荐:
Agents
├── Agents
├── Goals
├── Runs
├── Skills
├── Capabilities
└── Models
Agent Detail:
Agent
────────────────
Capabilities
Skills
Policies
Models
Memory
Runs
Cost
93. Agent Run UI
Goal
│
├── Planning ✓
│
├── Website Scan ✓
│
├── Keyword Research ✓
│
├── Generate Content ⏳
│
└── Publish ○
每一步都能进入:
Task
Execution
Logs
Output
94. Agent Debug Mode
开发环境必须支持:
Agent Trace
Capability Discovery
Selected Skill
Plan
Tool Calls
Execution IDs
Task IDs
Cost
Errors
这样开发者才能调试 Agent。
95. 不要实现“万能 Agent”
第一版不要:
One giant agent
推荐:
Agent Runtime
+
Agent Profiles
例如:
General Agent
SEO Agent
DevOps Agent
Content Agent
它们共用 Runtime。
96. Agent Profile
interface AgentProfile {
id: string
name: string
description?: string
systemInstructions?: string
allowedSkills?: string[]
allowedCapabilities?: string[]
deniedCapabilities?: string[]
modelPolicy?: ModelPolicy
budget?: AgentBudget
policy?: AgentPolicy
}
97. SEO Agent
SEO Agent
│
├── Skills
│ ├── seo.audit
│ ├── seo.content
│ └── seo.backlink
│
├── Capabilities
│ └── seo.*
│
└── Policy
它不需要独立 Runtime。
98. DevOps Agent
DevOps Agent
│
├── server.*
├── docker.*
├── deployment.*
└── monitoring.*
依旧使用:
Agent Runtime
99. 最终完整链路
User
│
▼
Goal
│
▼
Agent Runtime
│
┌───────┴───────┐
▼ ▼
Skill Capability Search
│ │
└───────┬───────┘
▼
Plan
│
▼
Task
│
▼
Job
│
▼
Action
│
▼
Action Runtime
│
▼
Execution
│
▼
Event
│
▼
Observation
│
▼
Agent
│
┌───────┼────────┐
▼ ▼ ▼
Continue Replan Complete
100. MCP 的完整位置
Agent
│
▼
Capability Layer
│
┌────────┼─────────┐
▼ ▼ ▼
Action Skill MCP
│ │
│ ▼
│ External System
│
▼
Action Runtime
MCP 是能力来源 / 适配层,不是 DevOS 的第二套业务执行系统。
101. Plugin 的完整位置
Plugin
│
├── Resource
├── Action
├── Skill
├── MCP
├── Workflow
└── UI
│
▼
Capability Registry
│
▼
Agent
所以:
Plugin 是能力供应商,Agent 是能力消费者。
102. 黄金规则
Rule 1
Agent 不直接操作数据库
Rule 2
Agent 不直接操作 Queue
Rule 3
Agent 不直接操作 Worker
Rule 4
Agent 必须通过 Capability / Action 执行
Rule 5
Skill 不直接执行底层业务
Rule 6
MCP 不绕过 Action Runtime
Rule 7
Agent Task 必须使用 DevOS Task Runtime
Rule 8
Agent 必须经过 Permission / Policy
Rule 9
Agent Capability Discovery 必须进行权限过滤
Rule 10
不要一次向 LLM 暴露全部 Tools
Rule 11
优先高层 Business Action
Rule 12
Agent Runtime 不绑定具体模型
103. Zcode 实现要求
新增:
packages/
├── capability/
├── skill/
├── agent/
└── mcp/
核心模块:
CapabilityRegistry
CapabilityDiscovery
CapabilityResolver
CapabilityRanker
SkillRegistry
SkillLoader
SkillResolver
AgentRuntime
AgentPlanner
AgentExecutor
AgentObserver
AgentEvaluator
AgentMemory
AgentPolicy
AgentBudget
MCPServer
MCPClient
MCPToolRegistry
MCPAdapter
ModelRegistry
ModelProvider
104. 第一阶段验收 Demo
Zcode 必须完成以下完整演示。
Demo 1:Capability Discovery
输入:
deploy application
返回:
application.deploy
docker.build
server.health_check
Demo 2:Skill Discovery
输入:
SEO audit
返回:
seo.website.audit
Demo 3:Agent Goal
输入:
检查 example.com 的 SEO
完整链路:
Goal
↓
Agent
↓
Skill
↓
Capability Discovery
↓
seo.website.scan
↓
Task
↓
Execution
↓
Result
↓
Agent
↓
Report
Demo 4:MCP
外部 MCP Tool:
seo_scan_website
最终:
MCP
↓
seo.website.scan
↓
Action Runtime
Demo 5:Plugin → Agent
安装:
GitHub Plugin
之后:
Capability Registry
自动出现:
github.repository.*
Agent 可以立即发现这些能力。
不允许修改 Agent Runtime 源码。
105. 最终目标
完成 06 后,DevOS 的核心已经形成:
┌───────────────┐
│ Agent │
└───────┬───────┘
│
Skill / Plan
│
▼
Capability Registry
│
┌─────────────┼─────────────┐
▼ ▼ ▼
Action MCP Workflow
│ │ │
└─────────────┼─────────────┘
▼
Action Runtime
│
▼
Task
│
▼
Job
│
▼
Queue
│
▼
Worker
│
▼
Execution
│
▼
Event
│
▼
Observation
│
└──────→ Agent
这一步完成后,DevOS 就不再只是一个“后台框架”。
它实际上开始形成:
Resource Runtime + Action Runtime + Plugin Runtime + Execution Runtime + Capability Runtime + Agent Runtime
这几个 Runtime 共同构成你后面真正可以反复复用的 DevOS Application/Agent Platform Core。