Skip to main content

AI 开发 - Prompt,Agent,MCP,Skill,Cowork

·1687 字·4 分钟
AI
Table of Contents

Prompt -> Agent -> MCP -> SKill -> Cowork

💡 初步了解 #

你 (用户)
  ↓ 给指令
Prompt(口头任务)
  ↓ 驱动
Agent(智能员工)
  ↓ 通过
MCP(万能接口)
  ↓ 调用
Skill(技能手册)
  ↓ 协作完成
Cowork(团队作战)

就拿生活中专修房子来做一个比喻吧,方便大家理解。

  1. 你对工长说:“我要把客厅改成北欧风” → 这就是 Prompt
  2. 工长 Agent 接到任务,开始规划:要拆墙、买家具、刷漆工长用“装修平台 MCP ”连接各种服务商:水电工、木工、油漆工
  3. 每个师傅自带“专业手册 Skill”:水电工手册、木工手册,按标准施工
  4. 多个师傅协作 Cowork:水电先走,木工再做,油漆最后上,互相配合
概念解决的核心问题类比
PromptAI 听不懂人话,需要精确表达翻译官
MCPAI 连不上外部系统,数据孤岛万能转接头
SkillAI 没经验,每次都要重新教操作手册
AgentAI 只能聊天,不能真干活数字员工
Cowork单个人干不了复杂项目团队协作

以上只是感性、快速理解这些名词,下面用一个完整、真实、最小可落地的 AI 系统案例,把整条链路全部串起来,并加入:

  • RAG
  • Memory
  • Planner
  • Tool Calling
  • Workflow Orchestration
  • Guardrail

🎯 真实场景 #

用户输入:

“根据公司知识库,帮我写一份 2025 年支付系统改造方案初稿,并发给 CTO。”

🔁 整个真实执行链路

User
Prompt
Planner Agent
RAG 检索
Skill 调用
工具执行
Memory 记录
Guardrail 校验
发送邮件

下面逐个给出真实实现形态。

1️⃣ Prompt(真实输入) #

{
  "role": "user",
  "content": "根据公司知识库,写一份2025支付系统改造方案初稿,并发给CTO"
}

这是自然语言任务。


2️⃣ Planner Agent(任务分解) #

真实 Agent 内部会生成类似:

[
  "检索公司历史支付架构文档",
  "提取2024改造遗留问题",
  "生成2025升级目标",
  "形成方案结构",
  "发送邮件"
]

这一步通常由:

  • OpenAI tool-based agent
  • LangGraph
  • AutoGen

完成。

这一步叫:

👉 Planning / Task Decomposition


3️⃣ RAG(真实检索增强) #

Agent 发现需要“公司知识库”。

于是调用 RAG。

真实实现:

Step 1:向量检索 #

query = "支付系统架构 改造 2024 问题"
results = vector_store.similarity_search(query, k=5)

底层可能是:

  • FAISS
  • Pinecone
  • Weaviate
  • Elasticsearch + embedding

返回:

[
  "2024支付系统存在单点问题...",
  "清算模块延迟较高...",
  "核心账务系统耦合严重..."
]

然后这些内容被拼进 Prompt:

以下是公司知识库资料:
1. ...
2. ...
请基于以上资料生成方案

这就是:

👉 RAG = Retrieval Augmented Generation

解决问题:

LLM 不知道你公司内部知识。


4️⃣ Skill(真实功能模块) #

Agent 需要:

  • 文档生成 Skill
  • 邮件发送 Skill
  • 知识库查询 Skill

真实代码形态:

def retrieve_knowledge(query): ...
def generate_document(context): ...
def send_email(to, content): ...

Skill 是:

👉 可调用的函数 / 微服务 / API


5️⃣ MCP(工具协议层) #

Agent 不直接调用函数。

而是通过统一 Tool Schema。

例如:

{
  "name": "retrieve_knowledge",
  "arguments": {
    "query": "支付系统改造"
  }
}

这是 MCP 层。

它解决:

  • 工具调用格式统一
  • 模型可解释工具能力
  • 可跨语言实现

6️⃣ Memory(长期记忆) #

生成后,系统会记录:

{
  "task": "2025支付系统改造方案",
  "generated_by": "Agent_1",
  "timestamp": "2026-02-22"
}

Memory 分两种:

Short-term memory #

对话上下文

Long-term memory #

数据库 / 向量库持久化

解决问题:

👉 Agent 不会“失忆”


7️⃣ Guardrail(安全校验) #

在发邮件前:

  • 检查是否包含敏感数据
  • 是否包含未公开财务数据
  • 是否违反合规策略

真实做法:

if contains_sensitive_data(content):
    block_send()

或:

  • OpenAI moderation API
  • 自定义合规模型

8️⃣ Cowork(多 Agent 协作) #

复杂版本会拆成:

Agent职责
Research AgentRAG 检索
Architect Agent方案生成
Reviewer Agent风险检查
Delivery Agent发送邮件

协作方式:

  • 共享 memory
  • 黑板模式
  • 有向图执行(LangGraph)

真实代码形态:

graph.add_node("research", research_agent)
graph.add_node("architect", architect_agent)
graph.add_node("review", review_agent)
graph.add_node("deliver", delivery_agent)

🔥 现在映射回你的原表格 #

概念在真实系统中的形态
Prompt用户自然语言输入
Agent带规划循环的 LLM Executor
MCPTool Calling Schema
SkillPython 函数 / 微服务
Cowork多 Agent Workflow
RAG向量检索 + 上下文拼接
Memory会话 + 长期数据库
Planner任务分解模块
Guardrail安全与合规校验
Workflow有向图执行引擎

🧠 核心结构(真正现代 Agent 系统) #

现代 AI 系统 =

LLM
+ Planning
+ Tool Calling
+ RAG
+ Memory
+ Multi-Agent
+ Workflow Engine
+ Guardrail

这已经不是“聊天模型”。

这是一个:

👉 可执行 AI 系统架构


✅ Large Language Models (LLMs) — how modern AI actually generates responses
✅ Tokens & Context Windows — how AI “reads” and remembers information
✅ AI Agents — systems that plan, reason, and take action autonomously
✅ Model Context Protocol (MCP) — how AI connects to real-world tools
✅ RAG (Retrieval Augmented Generation) — how AI uses external knowledge
✅ Fine-Tuning — how models adapt to specific tasks or behavior
✅ Context Engineering — the skill companies are hiring for right now
✅ Reasoning Models — AI that thinks step-by-step before answering
✅ Multimodal AI — models that understand text, images, audio, and video
✅ Mixture of Experts (MoE) — how modern AI scales efficiently