跳到主要内容Skip to main content
← 深水指南Guides

任务:搭一个客服 Agent 并上线Playbook: building and shipping a customer-service agent

规划Planning

意图、知识库、工具、护栏、评估、上线六段;含生态锁定、许可、人工兜底、验收单与失败模式。

Six stages — intents, knowledge base, tools, guardrails, evaluation, launch — with ecosystem lock-in, licensing, human fallback, an acceptance list and failure modes.

准备:先划不能答的问题Prepare: list what it must not answer

下面是一种带人工兜底的客服流程设计,不是产品运行记录。题数、流量比例、观察周期和抽样量是示例预算,应按风险与业务量另定;写操作的审批方式是本示例的权限边界。

  1. 意图清单:退款、改地址、查物流、产品咨询、投诉,按频次排序。
  2. 禁区清单:价格承诺、法律责任、医疗建议、账号密码,一律转人工。
  3. 渠道:网页、App、微信、电话;渠道不同,上下文与身份不同。
  4. 人工兜底:什么条件下转人工、转到谁、等待多久。

先明确哪些问题能回答、哪些动作能执行,以及交接对象,再配置后续流程。

This is one design for a customer-service workflow with human fallback, not a product execution record. Question counts, traffic percentages, observation periods and sample sizes are illustrative budgets to adjust to risk and volume. Write approvals are the permission boundary chosen for this example.

  1. Intents: refunds, address changes, delivery status, product questions and complaints, ordered by frequency.
  2. Excluded questions: price commitments, legal liability, medical advice and account passwords go to the designated human contact.
  3. Channels: web, app, messaging and phone have different context and identity requirements.
  4. Fallback: define triggers, recipient and expected waiting time.

Specify what can be answered, which actions can be executed and who receives handoffs before configuring the workflow.

知识库:只放可对外的话Knowledge base: approved text only

  • 只收官方已发布的 FAQ、政策、产品文档;内部草稿不进库。
  • 每条知识带版本与生效日期;实现过期处理,旧版本保留可追溯记录,不再参与默认检索。
  • 分块按语义,不按固定字数;每块保留原文链接。
  • 检索命中后要求引用原文句,答不出就说「没找到」。

失败模式:把旧政策留在库里,Agent 会自信地答错。

  • Use published FAQs, policies and product documentation; exclude internal drafts.
  • Attach versions and effective dates. Implement expiry handling: retain older versions for traceability but exclude them from default retrieval.
  • Chunk by meaning and preserve source links.
  • Require supporting sentences after retrieval; say “not found” when evidence is absent.

Failure mode: stale policies remain retrievable and produce confident wrong answers.

工具:读写分离Tools: read and write separated

工具类型权限确认
查订单读只读、按用户身份过滤不需要
查物流读只读,按身份与订单授权过滤不需要
改地址写仅未发货订单需要人工确认
退款写仅符合政策需要人工确认

红线:写操作必须有人工确认或双人复核;Agent 不得直接动支付。

ToolTypePermissionConfirmation
Look up orderReadRead-only, filtered by user identityNot required
Delivery statusReadRead-only, filtered by identity and order authorisationNot required
Change addressWriteUnshipped orders onlyHuman confirmation
RefundWritePolicy-eligible cases onlyHuman confirmation

Boundary for this example: writes require human confirmation or independent review; the agent does not execute payments directly.

护栏:四层Guardrails: four layers

  1. 输入层:PII 识别、注入检测、超长输入截断。
  2. 知识层:只答库内内容,引用原文,冲突条目标红。
  3. 工具层:白名单工具、参数校验、写操作确认。
  4. 输出层:敏感承诺过滤、转人工触发、日志留痕。

决策点:每层都要有可观测指标,否则出事后无法定位。

  1. Input: personal-data detection, injection checks and handling of overlong inputs.
  2. Knowledge: source-scoped answers, citations and flagged conflicts.
  3. Tools: allowlists, parameter validation and write confirmation.
  4. Output: checks for unsupported sensitive commitments, fallback triggers and logs.

Each layer needs observable signals so failures can be located afterwards.

评估:先离线再灰度Evaluate offline first

  • 离线集:100 条真实问题,覆盖高频与禁区;每条有标准答案与可接受变体。
  • 指标:解决率、转人工率、错误承诺率、平均轮次、引用准确率。
  • 灰度:先 5% 流量,持续一周;错误承诺率不达标就回滚。
  • 回归:知识库每次更新跑一遍离线集。

失败模式:只测「能答」,不测「该拒答」;上线后错误承诺最致命。

  • Offline set: an illustrative 100 real questions covering frequent intents and exclusions, each with expected answers and acceptable variations.
  • Metrics: resolution, handoff, mistaken commitments, average turns and citation accuracy.
  • Staged rollout: an illustrative 5% of traffic for one week; roll back when the predefined mistaken-commitment limit is exceeded.
  • Regression: rerun the offline set after knowledge-base changes.

Failure mode: testing answerable cases but omitting cases that should be refused or handed off.

上线:可观测与回滚Launch: observe and roll back

  • 按最小必要范围记录意图、检索命中、工具调用、回答与转接结果;敏感字段脱敏,明确日志访问权限与保留期。
  • 设三条告警:错误承诺、转人工率异常、检索空命中率异常。
  • 回滚开关:一键切回人工或旧版本。
  • 每周抽 20 条会话人工复核。
  • Record intents, retrieval, tools, answers and handoff outcomes only to the extent necessary. Redact sensitive fields and define log access and retention.
  • Monitor mistaken commitments, abnormal handoff rates and empty retrieval.
  • Provide a switch to human service or a previous version.
  • An illustrative review schedule is 20 conversations per week; adjust to risk and volume.

成本算式Cost formula

单次模型费用 = Σ 每次调用的 (输入 tokens × 输入单价 + 输出 tokens × 输出单价) / 1,000,000
单次会话费用 = 模型费用 + 实际检索费用 + 实际工具费用
月费用 = 会话数 × 平均会话费用 + 席位与复核费用 + 维护

单价按每百万 tokens 填写;缓存输入按对应费率另列,重试计入实际调用次数。检索与工具只按实际计费项目计算,不重复乘模型轮数。用 成本计算器 记录假设。

Model cost per conversation = sum over calls of
  (input tokens × input rate + output tokens × output rate) / 1,000,000
Conversation cost = model cost + actual retrieval cost + actual tool cost
Monthly cost = conversations × average conversation cost
             + seats/review costs + maintenance

Rates are per million tokens. Separate cached input at its applicable rate and include retries in actual call counts. Count retrieval and tools by their actual billing units rather than multiplying them again by model turns. Record assumptions with the cost calculator.

验收单Acceptance checklist

  • [ ] 意图清单与禁区清单已评审
  • [ ] 知识库只含已发布内容,每条带生效日期
  • [ ] 写操作全部有人工确认
  • [ ] 四层护栏各有一条可观测指标
  • [ ] 离线集覆盖高频与禁区,指标达标
  • [ ] 灰度流量与回滚开关就绪
  • [ ] 转人工条件与责任人写清
  • [ ] 日志保留周期符合合规要求
  • [ ] Intent and exclusion lists reviewed.
  • [ ] Knowledge contains published material with effective dates.
  • [ ] Every write has the example's required confirmation.
  • [ ] Each of the four control layers has an observable signal.
  • [ ] Offline questions cover frequent intents and exclusions; predefined targets met.
  • [ ] Staged traffic and rollback are ready.
  • [ ] Fallback conditions and accountable owner are recorded.
  • [ ] Log retention satisfies applicable requirements.

常见误判Common misreads

  • 把「低代码平台」当成「零治理」:身份、数据驻留、审计仍要配。
  • 把「fair-code」当成「OSI 开源」:n8n 的 Sustainable Use License 有使用限制。
  • 把「知识库大」当成「答得准」:过期与冲突条目比数量更伤。
  • 把「转人工」当成失败:该转不转才是失败。
  • Low-code does not remove identity, residency or audit configuration.
  • Fair-code and OSI open source differ; n8n's Sustainable Use License has conditions.
  • A large knowledge base does not establish answer accuracy; stale and conflicting content still needs handling.
  • Handoff is appropriate when the workflow calls for it; failing to hand off is the problem.

出处Sources

来源Source链接URL
Microsoft · Copilot Studio 官方页(企业低代码 agent、Power Platform / Dataverse 生态;2026-10 快照)Microsoft: Copilot Studio (enterprise low-code agents and Power Platform / Dataverse; October 2026 snapshot)https://www.microsoft.com/en-us/microsoft-copilot/microsoft-copilot-studiohttps://www.microsoft.com/en-us/microsoft-copilot/microsoft-copilot-studio
n8n · 官方文档与许可(fair-code / Sustainable Use License;2026-10 快照)n8n: official documentation and licence (fair-code / Sustainable Use License; October 2026 snapshot)https://docs.n8n.iohttps://docs.n8n.io/
Dify · 官方文档(可视化工作流与知识库;2026-10 快照)Dify: official documentation (visual workflows and knowledge bases; October 2026 snapshot)https://docs.dify.aihttps://docs.dify.ai/
LangGraph · 官方文档(有状态编排与中断;2026-10 快照)LangGraph: official documentation (stateful orchestration and interruptions; October 2026 snapshot)https://docs.langchain.com/oss/python/langgraph/https://docs.langchain.com/oss/python/langgraph/

资料快照日期:2026-11-03;单项复核范围与日期见对应正文或来源记录。产品功能与条款可能变化,使用前请核对原始来源。Source snapshot: 2026-11-03; item-specific rechecks and their scope are recorded in the text or source notes. Features and terms may change; check the original sources before use.