Karpathy 说过一段话,如果你忽视了它,迟早会后悔:
“你依然要对你的软件负责,和以前一样。不能因为是 vibe coding 就可以引入漏洞。”
这是他在界定 vibe coding 与 agentic engineering(代理工程)的界限时说的。虽然现在 Agent 承担了更多代码编写工作,但这并不能免除你的责任。
这背后的假设是,只要读者足够细心就能发现问题。但有些失败是无法通过阅读内容看出来的。
例如,大家对 RAG Agent 普遍的担忧是:如果问题超出了语料库范围,它可能会产生幻觉。
但实际上,现在的优秀模型都能很好地处理这种情况——如果检索到的上下文不相关,模型就没有素材来构建答案,自然就不会乱说。
真正的失败大多发生在检索到的上下文“部分覆盖”时。
检索流水线返回的上下文在主题上是正确的,但没有覆盖问题的全部,于是模型就用自带的参数化知识补全了剩下的部分。
在输出中,并没有 token 级别的标签来区分哪些内容来自检索上下文,哪些来自模型权重。
它们的流式输出方式完全一样。
要为生产级应用检测出这一点,需要编写专门的评估指标,且该指标必须符合 agentic engineering 的原则。
而解决方案其实已经包含在 Google 的 Agents CLI 自带的 eval skill 中了。
我用大白话向 Claude Code 描述了我的担忧。它分析了 Agent 的代码,提出了一个我批准的计划。
接着它报告称现有的内置指标无法隔离这种行为,于是编写了一个名为 `corpus_abstention` 的自定义评分标准 (rubric)。
它为每个案例给出了明确的类别判定,而不是汇总成一个模糊的分数。因为内置评分器每次运行都会重生成标准,导致数据不具备可比性。
→ GROUNDED_ANSWER(有据回答)
→ CORRECT_ABSTENTION(正确拒绝)
→ UNGROUNDED_ANSWER(无据回答,完全脱离来源)
→ MIXED_LEAKAGE(混合泄露,有依据但掺杂了不支持的断言)
→ WRONG_ABSTENTION(错误拒绝,拒绝了文档中实际涵盖的内容)
随后,它自动生成了 33 个按失败点划分的场景,包括:
- 语料库内
- 领域外
- 语料库外但似乎可回答
- 边界案例(主题覆盖但细节缺失)
基准分只有 19/33。
- 领域外测试 3/3 通过,符合预期。
- 但 15 个语料库内案例中,有 6 个虽然检索正确、引用正确、回答准确,却额外增加了一个源文件从未提及的断言。
根源在于 Agent 指令中的一句话:“如果你已经知道简单问题的答案且无需查阅文档,可以直接回答,不用引用。”
eval skill 帮我发现了这个漏洞,随后 Claude 删除了这句话并强制每次都检索。
最终测试得分提升到 30/33,无据回答从 6 个降为 0。
我运行的全程录像在下面,这是我与 Google Cloud 团队合作完成的。
Agents CLI GitHub 仓库 → https://github.com/google/agents-cli?utm_source=fnf&utm_medium=x&utm_campaign=google-cloud-july2&utm_term=avi-chawla&utm_content=agents-cli-github
(别忘了点个星 🌟)
我写了一篇完整的实操指南,涵盖了从安装到企业级注册的六个步骤。
包含了评估记分卡、部署前捕捉到的指令漏洞,以及端到端部署的真实流程。
点击下方阅读。
“你依然要对你的软件负责,和以前一样。不能因为是 vibe coding 就可以引入漏洞。”
这是他在界定 vibe coding 与 agentic engineering(代理工程)的界限时说的。虽然现在 Agent 承担了更多代码编写工作,但这并不能免除你的责任。
这背后的假设是,只要读者足够细心就能发现问题。但有些失败是无法通过阅读内容看出来的。
例如,大家对 RAG Agent 普遍的担忧是:如果问题超出了语料库范围,它可能会产生幻觉。
但实际上,现在的优秀模型都能很好地处理这种情况——如果检索到的上下文不相关,模型就没有素材来构建答案,自然就不会乱说。
真正的失败大多发生在检索到的上下文“部分覆盖”时。
检索流水线返回的上下文在主题上是正确的,但没有覆盖问题的全部,于是模型就用自带的参数化知识补全了剩下的部分。
在输出中,并没有 token 级别的标签来区分哪些内容来自检索上下文,哪些来自模型权重。
它们的流式输出方式完全一样。
要为生产级应用检测出这一点,需要编写专门的评估指标,且该指标必须符合 agentic engineering 的原则。
而解决方案其实已经包含在 Google 的 Agents CLI 自带的 eval skill 中了。
我用大白话向 Claude Code 描述了我的担忧。它分析了 Agent 的代码,提出了一个我批准的计划。
接着它报告称现有的内置指标无法隔离这种行为,于是编写了一个名为 `corpus_abstention` 的自定义评分标准 (rubric)。
它为每个案例给出了明确的类别判定,而不是汇总成一个模糊的分数。因为内置评分器每次运行都会重生成标准,导致数据不具备可比性。
→ GROUNDED_ANSWER(有据回答)
→ CORRECT_ABSTENTION(正确拒绝)
→ UNGROUNDED_ANSWER(无据回答,完全脱离来源)
→ MIXED_LEAKAGE(混合泄露,有依据但掺杂了不支持的断言)
→ WRONG_ABSTENTION(错误拒绝,拒绝了文档中实际涵盖的内容)
随后,它自动生成了 33 个按失败点划分的场景,包括:
- 语料库内
- 领域外
- 语料库外但似乎可回答
- 边界案例(主题覆盖但细节缺失)
基准分只有 19/33。
- 领域外测试 3/3 通过,符合预期。
- 但 15 个语料库内案例中,有 6 个虽然检索正确、引用正确、回答准确,却额外增加了一个源文件从未提及的断言。
根源在于 Agent 指令中的一句话:“如果你已经知道简单问题的答案且无需查阅文档,可以直接回答,不用引用。”
eval skill 帮我发现了这个漏洞,随后 Claude 删除了这句话并强制每次都检索。
最终测试得分提升到 30/33,无据回答从 6 个降为 0。
我运行的全程录像在下面,这是我与 Google Cloud 团队合作完成的。
Agents CLI GitHub 仓库 → https://github.com/google/agents-cli?utm_source=fnf&utm_medium=x&utm_campaign=google-cloud-july2&utm_term=avi-chawla&utm_content=agents-cli-github
(别忘了点个星 🌟)
我写了一篇完整的实操指南,涵盖了从安装到企业级注册的六个步骤。
包含了评估记分卡、部署前捕捉到的指令漏洞,以及端到端部署的真实流程。
点击下方阅读。
Karpathy said something you'll regret ignoring:
"You are still responsible for your software, just as before. You are not allowed to introduce vulnerabilities because of vibe coding. "
He said it while drawing the line between vibe coding and agentic engineering. Agents write more of the code now, but none of that takes the responsibility off you.
The assumption underneath that is that a careful enough reader catches the problem. But some failures don't show up in anything there is to read.
For instance, a common fear with a RAG agent is that it could hallucinate when a question asks something outside its corpus.
But such cases are actually well handled by any competent model now. If nothing in the retrieved context looks relevant, there's no material to build an answer on.
Instead, the majority of failures originate when the retrieved context has partial coverage.
The retrieval pipeline returns context that's topically correct but doesn't cover the full question, and the model completes the remainder from parametric knowledge.
There are no token-level labels in the output to tell what was generated using retrieved context and what came from weights.
Both are streamed the same way.
Detecting this for production-grade apps needs a metric written for it, one that's also aligned with principles of agentic engineering.
And the solution is actually implemented in the eval skill that comes with Google’s Agents CLI.
I described the concern to Claude Code in plain English. It read the agent's code, came back with a plan I approved.
It then reported that no built-in metric isolates the behaviour and wrote a custom rubric called corpus_abstention.
It assigned a single categorical verdict per case rather than aggregating everything into one score, since the built-in raters regenerate their rubrics each run and leave no stable number to trend.
→ GROUNDED_ANSWER
→ CORRECT_ABSTENTION
→ UNGROUNDED_ANSWER (answered entirely from outside knowledge)
→ MIXED_LEAKAGE (grounded, but slips in one unsupported claim)
→ WRONG_ABSTENTION (refused something the docs actually covered)
After this, it automatically generated 33 scenarios partitioned by where the failure could occur, like:
- in-corpus
- off-domain
- out-of-corpus but plausibly answerable
- boundary cases where the topic is covered, but a specific detail isn't.
The baseline score was 19 of 33.
- Off-domain passed 3 of 3, as expected.
- But 6 of 15 in-corpus cases retrieved the right document, cited it correctly, answered accurately, and added a claim the source never made.
The root cause was one line in the agent's instruction: "If you already know the answer to a simple question and no document lookup is needed, you may respond directly without citations."
The eval skill helped flag this, and then Claude removed it and forced retrieval on every question.
This took the suite to 30 of 33, and ungrounded answers went from 6 to 0.
The full recording of my run is below, and I worked with the Google Cloud team on this.
Agents CLI GitHub repo → https://github.com/google/agents-cli?utm_source=fnf&utm_medium=x&utm_campaign=google-cloud-july2&utm_term=avi-chawla&utm_content=agents-cli-github
(don't forget to star 🌟)
I wrote up the full build covering all six steps from install to enterprise registration.
It includes the eval scorecard, the instruction loophole the eval caught before deployment, and what the deployment process actually looks like end-to-end.
Read it below.
"You are still responsible for your software, just as before. You are not allowed to introduce vulnerabilities because of vibe coding. "
He said it while drawing the line between vibe coding and agentic engineering. Agents write more of the code now, but none of that takes the responsibility off you.
The assumption underneath that is that a careful enough reader catches the problem. But some failures don't show up in anything there is to read.
For instance, a common fear with a RAG agent is that it could hallucinate when a question asks something outside its corpus.
But such cases are actually well handled by any competent model now. If nothing in the retrieved context looks relevant, there's no material to build an answer on.
Instead, the majority of failures originate when the retrieved context has partial coverage.
The retrieval pipeline returns context that's topically correct but doesn't cover the full question, and the model completes the remainder from parametric knowledge.
There are no token-level labels in the output to tell what was generated using retrieved context and what came from weights.
Both are streamed the same way.
Detecting this for production-grade apps needs a metric written for it, one that's also aligned with principles of agentic engineering.
And the solution is actually implemented in the eval skill that comes with Google’s Agents CLI.
I described the concern to Claude Code in plain English. It read the agent's code, came back with a plan I approved.
It then reported that no built-in metric isolates the behaviour and wrote a custom rubric called corpus_abstention.
It assigned a single categorical verdict per case rather than aggregating everything into one score, since the built-in raters regenerate their rubrics each run and leave no stable number to trend.
→ GROUNDED_ANSWER
→ CORRECT_ABSTENTION
→ UNGROUNDED_ANSWER (answered entirely from outside knowledge)
→ MIXED_LEAKAGE (grounded, but slips in one unsupported claim)
→ WRONG_ABSTENTION (refused something the docs actually covered)
After this, it automatically generated 33 scenarios partitioned by where the failure could occur, like:
- in-corpus
- off-domain
- out-of-corpus but plausibly answerable
- boundary cases where the topic is covered, but a specific detail isn't.
The baseline score was 19 of 33.
- Off-domain passed 3 of 3, as expected.
- But 6 of 15 in-corpus cases retrieved the right document, cited it correctly, answered accurately, and added a claim the source never made.
The root cause was one line in the agent's instruction: "If you already know the answer to a simple question and no document lookup is needed, you may respond directly without citations."
The eval skill helped flag this, and then Claude removed it and forced retrieval on every question.
This took the suite to 30 of 33, and ungrounded answers went from 6 to 0.
The full recording of my run is below, and I worked with the Google Cloud team on this.
Agents CLI GitHub repo → https://github.com/google/agents-cli?utm_source=fnf&utm_medium=x&utm_campaign=google-cloud-july2&utm_term=avi-chawla&utm_content=agents-cli-github
(don't forget to star 🌟)
I wrote up the full build covering all six steps from install to enterprise registration.
It includes the eval scorecard, the instruction loophole the eval caught before deployment, and what the deployment process actually looks like end-to-end.
Read it below.
13
16
179
23.1K











