运用CARE框架管理人工智能智能体:清晰性、自主性及其他要素。
运用CARE框架管理AI智能体:将清晰性、自主性、关系性与公平性应用于任务分配、智能体合约、模型选择及上下文处理。
来源: You Already Know How to Manage Agents: The CARE Framework for AI Engineering
管理培训有时会传授一些比预期更直接适用于软件领域的知识。领导力培训中的CARE框架包含清晰性、自主性、关系性和公平性这四项原则,与运行AI智能体所遵循的既定实践几乎是一一对应的。在处理智能体时遵循这些相同原则,是获得更好结果的合理方式。下文将结合被委派任务的团队成员这一角色,逐一阐述这些原则。
现状
一两年前,与编程助手协作似乎只是一系列简单的指令:编写函数、修复错误、添加测试。如今,这些智能体能够浏览代码库、运行Shell命令、在文档中查找信息、同时编辑多个文件、执行测试并将任务分配给子智能体。然而它们往往仍被当作自动补全工具来管理。如今的瓶颈已不再是提示问题,而是任务分配问题。
简而言之,CARE四个问题包括:
- 清晰度:成功的标准是什么?
- 自主性:执行者能在多大程度上自行决策?
- 职责关系:谁应该承担这项工作?
- 公平性:他们需要什么条件才能取得成功?
技术经理和团队领导早已明白,要获得良好成果,这些因素各自的重要性,无需时刻盯着执行者操作。
清晰性:明确目标结果,而非提示内容
假设某利益相关方希望在用户资料端点实现缓存功能,这项工作将由生成式AI代理来完成。一个典型的模糊请求是“为用户资料端点实现缓存功能”。对于熟悉该系统的人来说,这听起来很清晰,但实际上并非如此。代理会面临数十个未解决的问题:到底是哪个端点?要缓存什么内容?缓存时长多久?什么情况会导致缓存条目失效?现有的缓存基础设施是什么?什么才算任务完成?
清晰性并不意味着需要更长的提示语,而是指目标结果与约束条件必须明确无误。该任务的更清晰表述如下:
Goal:
Reduce repeated database reads from GET /users/{id}.
Constraints:
- Use the existing Redis abstraction.
- Do not introduce a new dependency.
- Cache only successful responses.
- TTL: 10 minutes.
- Existing public API behavior must not change.
Before implementing:
- Inspect similar caching implementations in the repository.
- Identify how cache invalidation is handled elsewhere.
Validation:
- Existing tests must pass.
- Add tests for cache hit, cache miss, and invalidation.
Definition of done:
The implementation is complete when the endpoint behaves identically
from the client's perspective and repeated reads no longer hit MSSQL.
提示工程只是提升清晰度的其中一个方面。真正的技能在于能够把工作描述得足够清晰,以便他人能够完成它,而这正是管理者和领导们每天都在做的。
自主性:需要责任意识,而不仅仅是指令
人们可能认为智能体不存在微观管理的问题,但实际上确实存在。当智能体需要不断被督促时,通常是因为缺乏清晰的描述和明确的指令。想象这样一个场景:
Find the problem.
Okay, fix it.
Now run the tests.
There's an error. Fix that.
Run them again.
用户需要手动操控每一个步骤,这会让双方都感到疲惫。
一个智能体即便能够完全理解任务,也可能缺乏自主性。自主性关乎决策权:智能体可以决定什么、可以更改什么、能在多大程度上独立处理问题以及何时需要向上级汇报。智能体合约很好地体现了这一点:
You own this task until it is implemented and validated.
You may:
- inspect any file in the repository
- modify files related to this feature
- run builds, tests and static analysis
- create focused subagents for research or validation
After implementation:
1. Run the relevant test suite.
2. Inspect your diff for unintended changes.
3. Validate the implementation against the acceptance criteria.
4. Fix issues you discover before returning.
Escalate only if:
- the requested behavior conflicts with existing architecture
- required credentials/access are unavailable
- the change would require modifying a public API
清晰的目标决定了终点,而自主性则决定了智能体在旅程中能掌控的程度。不过,自主性并不意味着可以为所欲为,健康的自主性是建立在界限之上的。
关系:了解智能体
此处所说的关系指的是对智能体的精准认知,而非拟人化处理。它是关于所使用的模型和智能体的优势、劣势、故障模式以及过往表现等积累起来的知识。管理者会了解每个人最擅长的工作领域,对于人工智能系统也应形成同样的认知:
| Work | Agent/model characteristic |
| ------------------------------------- | ----------------------------------- |
| Repository-wide architecture research | Strong reasoning + large context |
| Small mechanical refactor | Fast, inexpensive model |
| UI implementation from screenshots | Strong vision model |
| Test generation | Fast coding specialist |
| Final architecture critique | Independent high-reasoning reviewer |
仅使用一个模型、一个巨大上下文来处理所有任务的做法远非理想。相关工作应当交给具备相应能力的智能体来完成。多智能体设计并非为了增加智能体数量,而是将任务精准分配给最适合处理它的智能体:
Main Agent
│
├── Research Agent
│ └── Investigate existing caching patterns
│
├── Implementation Agent
│ └── Make the code change
│
└── Reviewer Agent
└── Validate implementation independently
随着系统不断积累关于架构决策、编码规范、常见故障模式、早期决策以及哪些模型在哪些任务上表现良好的知识,这种关联度就会提升。简而言之,这种关联度就是模型理解能力与积累的上下文信息的结合。
公平性:提供智能体所需的信息
人们常有的抱怨是“AI又产生了幻觉”或“它输出的成果质量很差”。但我们应该看看智能体实际得到了什么——没有API文档,没有任务需求说明,没有日志,没有示例代码,没有架构说明,也无法连接到正在运行的应用程序。这是模型的故障,还是有人被要求在缺乏必要信息的情况下解决问题?
假设智能体能够找到或获得所有这些信息:
.agent/
│
├── context/
│ ├── architecture.md
│ ├── domain.md
│ └── conventions.md
│
├── skills/
│ ├── debug-production.md
│ ├── review-mr.md
│ └── implement-feature.md
│
├── references/
│ ├── api-spec/
│ ├── examples/
│ └── decisions/
│
└── tools/
├── git
├── jira
├── logs
├── browser
└── tests
具体的布局不如原则重要。智能体需要恰当的指令和工具。用于生产环境调试的智能体可能需要代码、日志、追踪信息、最近的部署记录以及Git历史记录;用于用户界面的智能体可能需要代码、截图、设计系统、浏览器以及组件文档;审核人员则可能需要差异对比结果、完整文件、测试用例、工单信息、类似代码以及仓库规范。其智能水平是相同的,只是所需资源有所不同。在认定模型不具备相应能力之前,先考虑它是否被赋予了相应的条件。
以CARE作为调试视角
工作流程的走向是从指导逐步过渡到授权,再到统筹协调,领导者的角色也会随之变化。有才能的人在目标不明确、过度管控、任务不匹配或资源不足的情况下表现不佳。将这些认知应用到智能体上,意味着同样的管理方式现在也能用于团队中所有负责解决问题的人,无论他们是人类还是智能体。
一体化智能体定义
不同运行时环境的架构各异,但一个实用的智能体定义通常会将CARE要素整合为类似这样的结构:
---
name: implementation-agent
description: Implements scoped repository changes end-to-end. Use proactively for feature, bug-fix, and refactor tasks that require code changes and validation.
tools: Read, Grep, Glob, Edit, Write, Bash
model: inherit
---
You are an implementation agent responsible for completing scoped coding tasks end-to-end.
When given a task:
1. **Investigate**
- Read the relevant code before changing it.
- Search for similar implementations and existing project conventions.
- Do not guess when repository evidence is available.
2. **Plan**
- Form a short plan covering the files to change, the implementation approach, and validation.
3. **Implement**
- Make the smallest change that fully satisfies the task.
- Reuse existing patterns and dependencies.
- Do not modify unrelated code.
4. **Validate**
- Run the relevant tests, build/type-check, and lint/static analysis when available.
- If your change causes a failure, fix it and validate again.
5. **Review**
- Inspect the final diff.
- Remove accidental or unrelated changes.
- Confirm the requested behavior and acceptance criteria are satisfied.
Continue autonomously until the task is complete.
Escalate only when required access is unavailable, requirements materially conflict, or the task would require a destructive action or a public API/architecture change outside the requested scope.
The task is done only when the implementation is complete, relevant validation passes, and the final diff has been reviewed.
授权是新兴的关键技能
智能体虽非人类,但围绕它们构建的系统却会遭遇极为常见的管理问题。若给智能体设定模糊的目标、过度干预每一步操作、分配错误的模型或限制其获取的上下文与工具,其性能就会下降。随着智能体能力不断提升,优势将不再仅限于更强大的模型或更精准的提示词。那些懂得有效授权的团队才能最大程度发挥人工智能的潜力。
相关阅读
- 为何大多数AI智能体仅运行一次就会失效,以及长期运行的智能体为何能存活 —— 上下文限制、状态缺失以及薄弱的自我检查机制是导致大多数智能体失效的原因。了解那些能让智能体持续运行的检查点、内存管理、评估机制及审批流程。