InertiaRSS Track and read blogs, news, and tech you care about
Read Original Open in InertiaRSS

Recommended Feeds

The GitHub Blog
The GitHub Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
Vercel News
Vercel News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 【当耐特】
博客园 - Franky
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
博客园 - 聂微东
Blog — PlanetScale
Blog — PlanetScale
雷峰网
雷峰网
L
LangChain Blog
腾讯CDC
GbyAI
GbyAI
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
罗磊的独立博客
Engineering at Meta
Engineering at Meta

博客园 - iTech

7万星的AI交易框架:让大模型模拟投行多空辩论,自动做交易决策 71000颗星的AI交易团队:让大模型模拟投行分工,自动做交易决策 13400颗星的开源项目:输入一句话,AI全自动帮你做短视频 102颗星的沙盒:当AI学会自己写代码、跑测试、做部署 AI 技术日报 - 2026-05-08 29k 星的 PageIndex:不用向量数据库,靠推理就能做 RAG 每天花两小时刷信息?这个开源项目帮你全自动搞定 读源码像读小说?试了 DeepWiki 和 Zread,我再也不想裸读 GitHub 了 Matt Pocock 开源的这套 .claude 技能,为什么让工程师集体上头? Cursor Team Kit:Cursor 官方团队在用的 17 个 AI 工作流 AI 技术日报 - 2026-05-07 AI 技术日报 - 2026-05-06 AI 技术日报 - 2026-05-05 Anthropic CEO 说 12 个月内程序员要失业,我扒完他的底牌,发现事情没那么简单 把工程师的肌肉记忆装进 Claude Code,这个 4300 Star 的项目我后悔没早用 AI 技术日报 - 2026-05-04 AI 技术日报 - 2026-05-03 AI 技术日报 - 2026-05-02 六大 Agent 框架横评:谁支持 Skills?谁能自动创建 Agent?MCP 呢? Wechatsync:一个 Chrome 插件,一键把文章同步到 31 个平台 LangChain 开源了 Open SWE:Stripe、Ramp、Coinbase 内部都在造的编程 Agent Cockpit:把 Claude Code 从终端里搬出来,装进浏览器 Cursor 把自家的 AI Agent 开放了:写几行 TypeScript 就能调 Cursor 干活 AI 技术日报 - 2026-05-01 AI 写代码每次结果都不一样?Archon 用 YAML 工作流把 AI 编程变成流水线 AI 写代码比你快了,但你还是得学编程——只不过学法得换 腾讯的龙虾特工队:4 个 AI Agent 同日更新,全家桶正式成型 Agno 不做更聪明的 Agent,它要把所有 Agent 框架包进同一个操作系统 Hermes Agent 终于有了像样的 Web 界面,而且还支持远程访问 Datawhale 出了一套 29 学科知识地图,把 AI 的底牌全掀了 Hermes Agent 在聊天框里就能用的 20 种高级功能 一份 AGENTS.md 能顶一次模型升级?Augment Code 用数据说了算 NVIDIA 开源了一个「AI 沙箱」,20K Star,让 Agent 跑代码不再裸奔 60ms 冷启动、5MB 内存:腾讯开源的这个沙箱让 Docker 安全隔离像笑话 AI 技术日报 - 2026-04-30 AI 技术日报 - 2026-04-29 AI 技术日报 - 2026-04-28 Goose:Linux 基金会亲儿子,能撼动 Claude Code 和 OpenCode 吗? AI 技术日报 - 2026-04-27 AI 技术日报 - 2026-04-26 Google 把价值20美元/月的东西免费了,102K人已经抢到了 OpenClaw 和 Claude Code 网络搜索配置指南 AI 技术日报 - 2026-04-25 Anthropic 为什么遥遥领先:从 Cat Wu 专访看AI霸主的底层逻辑 Mac 本地跑大模型完全指南:你的苹果电脑就是 AI 工作站 同样 70B 参数,为什么 MoE 只激活 13B 就能打平 Dense? DeepSeek-V4 技术报告里藏着一条线:华为昇腾 NPU 已完成推理验证 DeepSeek-V4 深夜炸场:1M 上下文、384K 输出、双模型,API 定价直接卷到底 MacBook Air 跑大模型实测:Ollama、llama.cpp、LM Studio 谁才是本地推理之王? AI 技术日报 - 2026-04-24
CCA-F real question: Design customer service agents with Agent SDK (upgrade logic is the key to getting points)
iTech · 2026-06-21 · via 博客园 - iTech

CCA-F real question: Design customer service agents with Agent SDK (upgrade logic is the key to getting points)

This question is not about writing code, but about determining when to stop the Agent.

Customer Support Resolution Agent is one of the six scenarios in the CCA-F (Claude Certified Architect Foundations) exam and the scenario with the highest frequency. It connects all five knowledge areas for testing: Agenda loop, MCP tool integration, upgrade logic, context management, and Human-in-the-loop.

Main idea of the original title:

Customer Support Resolution Agent
Design a customer service Agent to handle user inquiries, solve problems, and upgrade to manual personnel in complex situations. Assessment points: Agent SDK, MCP tools, escalation logic.

Many people answer this question in the same place: focus on "how to get agents to solve problems" and ignoreHow to let agents know they should upgrade。The core of CCA-F's scoring is precisely the latter. Below, click the exam points in Exam Guide to break them down layer by layer.

Outline of this article

  1. What exactly is this question taking?
  2. Level 1: Agenda Loop design
  3. Level 2: Boundary design of MCP tools
  4. Level 3: Escalation-the key to getting points
  5. Complete code implementation
  6. Three traps that are easy to lose points
  7. One sentence answer

What exactly is this question taking?

Compared with the five major knowledge domain weights of Exam Guide, the score distribution for this question is roughly:

test sites Corresponding Domain weight Points for this question
Agentic loop design Domain 1 (27%) high core
Tool interfaces and boundaries Domain 2 (18%) 核心
何时升级人工 Domain 1 + 5 拉分项
MCP server 集成 Domain 2 区分项
上下文与会话状态 Domain 5 (15%) 加分项
Human-in-the-loop Domain 5 in plus item

Exam Guide's exact words for this scenario are: Agents mustKnow when to use tools and when to upgrade to humans(knows when to use a tool versus when to escalate to a human)。Note that it is "versus"-this is an alternative judgment, not the default process of "try the tool first and then upgrade".

There are three clear escalation triggers, which are listed in the Exam Guide:

  1. Policy upper limit exceeded(policy limits exceeded)-such as refunds exceeding the $50 automatic limit
  2. Customer proactive request(customer request)--The customer said,"I want to find labor"
  3. could not be advanced(Inability to make progress)--The Agent tried several rounds but failed to solve the problem

Remember these three, they must be explicitly implemented in the code and cannot be judged by the model itself.

Level 1: Agenda Loop design

The core of customer service Agent is aAutonomous execution cycle: Understand user intent → select tool → execute → observe results → decide next step (continue/upgrade/complete). Implementing this cycle with the Claude Agent SDK is the core assessment point of Domain 1.

There are two principles emphasized in Exam Guide when designing loops:

First, the cycle must have clear termination conditions。It cannot be an infinite loop of "trying until success". Each round requires the maximum number of attempts, and if you exceed it, you will upgrade. Infinite loop is the number one production accident in Agent systems.

Second, tool calls must be observable and interceptable。The Agent SDK's hooks mechanism allows you to insert logic before and after each tool call-logging, auditing, and forcing parameter verification. Customer service scenarios involve sensitive operations such as refunds and account changes and must be auditable.

from claude_agent_sdk import Agent, tool

# 客服 Agent 的 agentic loop
@tool
def check_order_status(order_id: str) -> dict:
    """Check the status of a customer order.

    Use when: customer asks about order status, shipping, or delivery.
    Do NOT use when: customer wants to cancel (use cancel_order instead).
    """
    # 查订单系统(通常通过 MCP server 暴露)
    return {"order_id": order_id, "status": "shipped", "eta": "2 days"}

@tool
def issue_refund(order_id: str, amount: float) -> dict:
    """Issue a refund for an order.

    Use when: customer requests a refund AND amount <= 50.0.
    HARD LIMIT: refuses any refund above $50 automatically.
    For amounts above $50, the agent MUST escalate to human.
    """
    if amount > 50.0:
        return {"error": "REFUND_LIMIT_EXCEEDED", "max_auto": 50.0}
    # 执行退款
    return {"order_id": order_id, "refunded": amount, "status": "done"}

@tool
def escalate_to_human(reason: str, summary: str) -> dict:
    """Hand the conversation to a human agent.

    Use when: ANY of these is true:
      - policy limit exceeded (e.g. refund > $50)
      - customer explicitly requests human
      - agent made 3+ attempts without resolution
    """
    return {"escalated": True, "ticket_id": "TKT-7821", "reason": reason}

agent = Agent(
    model="claude-sonnet-4-5",
    tools=[check_order_status, issue_refund, escalate_to_human],
    max_turns=10,  # 明确的循环上限,超过由兜底逻辑处理
)

Pay attention to the docstring for each tool. Exam Guide repeatedly emphasizes that tool descriptions must be clear "when to use"and"When not to use", rather than just writing functions. the above issue_refund It is clearly written amount <= 50.0 Only use it, and upgrade it if it exceeds it-this is the tool boundary.

Level 2: Boundary design of MCP tools

In the real customer service system, data such as orders, refunds, and accounts are stored in the back-end system, and the Agent uses the MCP(Model Context Protocol)server Visit them. Domain 2 teaches you how to design and integrate these tools.

MERMAID_BLOCK_0

MCP tool design has four key requirements in Exam Guide:

Structured error response。Tool error cannot return an ambiguous string. Instead, a structure with an error category and a retriable flag should be returned. For example, if the refund exceeds the limit, the refund will be returned {"error": "REFUND_LIMIT_EXCEEDED", "max_auto": 50.0, "retryable": false}At a glance, the Agent knows that this is not a temporary failure, but a hard limit, and that it should be upgraded rather than retried.

Tool authority allocation across agents。A customer service Agent should not have the authority to delete an account. The principle of minimum authority-the toolset given to the Agent must accurately match its responsibility boundaries.

Tool descriptions distinguish similar toolscancel_order and issue_refund Both involve orders, and the trigger conditions must be clearly stated in the description, otherwise the model will be selected incorrectly. In the code above check_order_status It clearly states "Do not use it to cancel orders" to prevent this.

MCP server 集成进 Agent loop。Instead of treating MCP as an independent service, it registers its tools into the tools list of the Agent SDK, allowing the Agent to choose and call them independently in the loop.

Level 3: Escalation-the key to getting points

This is where this question really gets points. Most people can write loops and tools, but the upgrade logic is vague. Exam Guide wantsExplicit, decidable, with triggersThe upgrade is not a black box like "Agents upgrade if they feel that they can't handle it."

def run_support_loop(agent, user_message: str, history: list):
    attempts = 0
    MAX_ATTEMPTS = 3  # 无法推进的硬阈值

    while attempts < MAX_ATTEMPTS:
        result = agent.run(user_message, history=history)

        # 触发器 1:客户主动要求人工
        if "escalate" in result.tool_calls:
            return {"outcome": "escalated", "reason": "customer_request"}

        # 触发器 2:策略上限超出(工具返回硬限制错误)
        for call in result.tool_calls:
            if call.result.get("error") == "REFUND_LIMIT_EXCEEDED":
                agent.run_tool(escalate_to_human,
                    reason="refund_limit_exceeded",
                    summary=result.summary)
                return {"outcome": "escalated", "reason": "policy_limit"}

        # 触发器 3:问题已解决
        if result.is_complete:
            return {"outcome": "resolved", "answer": result.answer}

        attempts += 1
        history.append(result)

    # 触发器 4:达到最大尝试次数仍无进展
    agent.run_tool(escalate_to_human,
        reason="max_attempts_exceeded",
        summary="Agent tried 3 times without resolution")
    return {"outcome": "escalated", "reason": "no_progress"}

This code explicitly implements all three upgrade triggers in Exam Guide, plus a "maximum attempt" indication. The examiner saw thisDeterministic upgrade logic, it will determine that you understand the limits of an Agent-this is the watershed where the CCA-F wants to distinguish between "being able to use tools" and "being able to design security systems."

There are two more details not to lose points when upgrading:

Upgrade requires a contextual summary。put escalate_to_human the summary Parameters are filled-previous conversations, solutions tried, why they failed. There is no need to ask the customer again when taking over manually. This is about Domain 5 context management.

Upgrade is a final state, not a branch。Once you decide to upgrade, the Agent should not continue to try. After the upgrade, loop must be terminated and control must be completely handed over to humans. Many people write "Keep running while upgrading", which is wrong.

Complete code implementation

Combine the three layers to create a complete skeleton of customer service Agent that conforms to the CCA-F standard:

from claude_agent_sdk import Agent, tool, hook

SYSTEM_PROMPT = """You are a customer support agent.
Resolve customer issues using the provided tools.
You MUST escalate to a human when:
1. A refund request exceeds $50 (policy limit)
2. The customer explicitly asks for a human agent
3. You cannot resolve the issue after 3 attempts

Never attempt workarounds for policy limits. Never promise
refunds above $50 without human approval."""

@hook(event="before_tool_call")
def audit_sensitive_calls(call):
    """Log every refund and account change for compliance audit."""
    if call.tool_name in ("issue_refund", "update_account"):
        audit_log.record(call.tool_name, call.params, call.timestamp)
    return call  # 放行

agent = Agent(
    model="claude-sonnet-4-5",
    system_prompt=SYSTEM_PROMPT,
    tools=[
        check_order_status,   # MCP: order system
        issue_refund,         # MCP: billing, $50 hard limit
        update_account,       # MCP: CRM, scoped permissions
        escalate_to_human,    # native: human queue
    ],
    hooks=[audit_sensitive_calls],
    max_turns=10,
)

# 运行时
result = run_support_loop(agent, user_message, history=[])

Four noteworthy designs:

Write dead upgrade rules in system prompt。Instead of expecting the model to infer from the tool description, it uses system prompts to clearly inform the three upgrade rules. This is the test point of Domain 4 (Prompt Engineering)-high-risk judgments must be solidified in system prompt.

hook conducts compliance audits。For operations such as refunds and account modifications, an audit log is recorded for each call. This is standard for enterprise-level Agents, and Exam Guide emphasizes observability in Domain 5 (Reliability).

Mixed tool sourcescheck_order_status From MCP server (accessing backend systems),escalate_to_human is a native tool (a queue built into the Agent SDK). The mixed source is a real scene, and the test is your understanding of the boundary between MCP and native tool.

max_turns as the last line of defense。Even if the upgrade logic has a bug, the loop will not run endlessly. This is defensive design-any Agent system should have a hard upper limit.

Three traps that are easy to lose points

Trap 1: Write upgrades as "last resort"。The error is "Agent tries its best to solve it first, and then upgrades it if it is really impossible." The correct way to write it is to upgrade with a clear trigger, and upgrade immediately after hitting the trigger, regardless of order. Refunds exceeding $50 are not a "last resort" but the "first response."

Trap 2: Tools have no hard boundaries。The wrong thing is to let issue_refund Accept any amount and rely on system prompt to remind the model not to refund too much. The correct way is to verify the tool internally, and an error will be returned directly if the limit is exceeded. Models make mistakes, code does not.

Trap 3: Upgrade without context。The wrong way to do this is to just pass a reason string. The right thing to do is to bring a complete summary-customer issues, solutions tried, reasons for failure. The examiner is looking to see if you understand the cost of "taking over manually".

One sentence answer

Design a customer service Agent based on the Claude Agent SDK, integrating MCP tools into the agency loop to access the order/billing/CRM system; each tool has clear usage boundaries and hard quotas (For example, the $50 limit for refunds); three types of upgrade triggers are explicitly implemented-the policy limit exceeds, the customer proactively requests, and the inability to advance-the loop is terminated when hit and transferred to manual with a context summary; sensitive operations are subject to compliance audit through hooks, and the max_turns hard upper limit is set as the last resort of defense.

Remember this passage and the code skeleton above, and this scene question is basically stable. The core is not how beautiful the code is, but to let the examiner see youUnderstand where the boundaries of Agent capabilities are and how to use deterministic logic to defend that boundary

Reference documents and links

To prepare for CCA-F, have you mastered the upgrade logic of this customer service Agent scenario question? Tell me your solution in the comment area, and I will answer any questions. If you think it is useful, just like it so that more people who prepare for the exam can see it.


author: itech001
source: Public Account: AI Artificial Intelligence Era
website: _ _ JHSNS _ URL _ 0 _ _
Share the most cutting-edge AI news and technical research every day.

This article was first published in the era of AI artificial intelligence. Please indicate the source for reprinting.