Agentic Workflow:人机协作的工程化

“让 Agent 全自动干活"是很多人的幻想——但生产里,全自动 = 高风险 = 不敢上线。现实路径是人机协作(Human-in-the-Loop):Agent 干 80% 的活,人在关键节点把关。这篇文章是 Agentic Workflow 的工程化设计。

一、为什么不能全自动

1 2 3 4 8 + . . . . 0 A % 2 g 0 e % n t / / A I

核心原则:自主度要和风险匹配。 低风险任务全自动,高风险任务人在回路。

二、自主度分级

级别 描述 适用场景
L1 全自动 Agent 自主执行到结束 低风险(信息检索、格式整理)
L2 自动+汇报 自主执行,关键节点汇报 中风险(周报生成、数据分析)
L3 建议+审批 Agent 给方案,人批准后执行 高风险(写操作、发消息、下单)
L4 人主导 人指挥,Agent 执行 关键业务(面试、合同)

三、实现:三个关键机制

1. 人在回路(Human-in-the-Loop)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 关键节点暂停,等人工确认
from langgraph.graph import StateGraph, Command

def high_risk_action(state):
    # 高风险操作:生成方案 → 暂停 → 等人确认
    return Command(
        goto="human_approval",          # 转到人工节点
        update={"proposal": state["proposal"]}
    )

def human_approval(state):
    # 等待人工:approve / reject / edit
    decision = wait_for_human(state["proposal"])
    if decision == "reject":
        return Command(goto="regenerate")    # 重新生成
    return Command(goto="execute")           # 执行

设计要点

" " A g e n " t / / " f a i l - c l o s e d

2. 异常升级(Escalation)

A g e n t N /
1
2
3
4
5
6
7
def run_task(task):
    result = agent.execute(task)
    if result.confidence < 0.6:        # 低置信度
        return escalate_to_human(task, result)
    if result.retries >= 3:            # 重复失败
        return escalate_to_human(task, result, reason="retry-exceeded")
    return result

3. 审批工作流

A g e 1 2 3 n . . . t / +

四、人机协作的产品化

A g e 1 2 3 n . . . t A g e n t /

关键体验

A g e n " t A " g e n t " + "

五、工程落地清单

/ / / / / L 1 f - a L i 4 l - c l o s e d

六、踩坑记录

  1. 审批太频繁:每步都暂停 → 用户烦 → 只在高风险节点暂停,低风险全自动
  2. 人看不懂 Agent 在干嘛:只给结果不给过程 → 界面展示步骤流 + 决策理由
  3. 超时无人理:卡在审批 2 小时 → 超时自动降级(放弃/重试/通知)
  4. 把"建议"当"执行”:用户点了批准,Agent 又自主扩大了范围 → 批准只授权"建议内"的动作

总结

Agentic Workflow 的核心认知:

  1. 全自动是理想,人机协作是现实:自主度匹配风险
  2. 三个机制:人在回路(暂停)、异常升级(兜底)、审批流(授权)
  3. 可观测是信任的前提:看到过程,才敢放手
  4. fail-closed:没人确认就不执行,宁可慢不可错

人机协作不是"AI 不行"的妥协,是"AI 可靠"的工程。 把人的判断力用在关键节点,Agent 的产能用在重复劳动——这才是 2026 年的正确姿势。