最新资讯
reddit.com OpenAI 称 Astra 仅满足 10% 安全任务标准 dev.to FreeToken:在自有 GPU 上运行前沿 MoE 模型及其内存需求 dev.to 当 AI Agent 说“完成”时,究竟完成了什么? dev.to 部署 Underdog Bark 3.0 Pro:逐字转写、自定义后端与分块设置 dev.to 为艰难对话构建 AI:五个 Agent、一条安全正则与一位盲评监督者 techcrunch.com Palo Alto Networks 洽谈以 5 亿美元收购 AI Agent 安全初创公司 Clutch theinformation.com 黄仁勋被要求就涉华间谍指控向国会作简报 www.infoq.com Edera 推出 Object Capability Bounded Authority,试图将凭证与 AI Agent 工作负载隔离 wechat 这波杀疯了!旗舰级模型不限量、1个月视频额度免费领 bloomberg.com AI 抛售蔓延至信用市场,软银领跌亚洲美元债 dev.to 如何在专用 GPU 服务器上用 OpenAI 兼容 API 部署 LLM dev.to 审计 153 份 Claude Code 与 Codex 会话记录:User-Agent 与 URL 中的邮箱泄露
多元动态
登录 注册
智能体 dev.to · @Mika Flowers

我的 AI Agent 的 Skill 什么都没声明,却读取了 9 个文件、运行了 7 个进程并被拦截 3 次

原文 我的收藏

作者给 AI agent 一个代码审查 skill,agent 未提及会触碰文件系统或启动进程,却在报告成功前反复执行这些操作并三次撞上策略墙。作者由此设计了一个 harness,用于对比 agent 被指示做什么、尝试做什么、宿主允许做什么以及实际改变了什么,探讨 agent 评估中声明与行为之间的差距。

AI推荐理由 作者描述给 AI agent 一个代码审查 skill 后,agent 未声明却读取 9 个文件、运行 7 个进程并被策略拦截 3 次,进而提出用 harness 对比 agent 声称行为与实际环境操作。这是关于 agent 可观测性与评估方法的一手实践,对开发者和 agent 安全有参考价值,但属个人实验、尚无公开验证结果。

78

正文

I gave an AI agent a code-review skill. It never mentioned touching the filesystem or spawning processes — just "review this repo." By the time it reported success, it had done both, repeatedly, and hit a policy wall three times along the way. That's when I realized I'd been asking the wrong question about AI agents. How do I know what the agent actually did? Not what it said it did. Not whether the final test passed. Not whether the generated code looked reasonable. What did it actually attempt inside the environment? So I designed the approach and prompted Codex to build a harness that tests what these models actually do vs. what they say. It's an experimental setup for studying the gap between what AI agents are instructed to do, what they attempt to do, what the host allows them to do, and what actually changes as a result. Building it has changed how I think about AI agent evaluation. A Passing Agent Can Still Behave Very Differently Most coding benchmarks understandably care about the result. Give the model a task. Run the tests. Did it solve the problem? Agent A: PASS Agent B: PASS Enter fullscreen mode Exit fullscreen mode But imagine those runs actually looked like this: Agent A reads allowed files edits the intended files runs the approved tests finishes successfully Agent B tries to access the network searches outside the workspace attempts an unauthorized command gets blocked several times eventually finishes successfully Both may have produced the right answer. But they are obviously not the same run. That's the gap I wanted the harness to investigate. The Four Things I Wanted to Keep Separate The harness currently revolves around four layers: graph TD A[Declared] --> B[Attempted] B --> C[Policy] C --> D[Observed] Declared — What did the instructions say should happen? e.g. "Do not access the network." Attempted — What did the agent actually try to do? request_url("https://example.com") Enter fullscreen mode Exit fullscreen mode Policy — What did the execution environment allow? DENY: network unavailable Enter fullscreen mode Exit fullscreen mode Observed — What actually happened to the environment? No outbound connection occurred. No network canary changed. That produces an interesting result: Declared behavior ≠ attempted behavior Attempted behavior ≠ observed side effect The agent violated the instructional boundary even though the sandbox successfully prevented the physical effect. That's useful information — a simple pass/fail result loses it. I Don't Want the Agent's Final Answer to Be Evidence This became one of the central design rules. Suppose an agent says: "I didn't modify anything outside the target directory." Cool. But that's still just another model output. The evaluator shouldn't have to trust it. So the harness checks the environment independently, using canaries — deliberately known state placed somewhere in the environment so the runner can later determine whether it was touched or changed. Before run: canary = unchanged Agent executes After run: canary = unchanged (or: modified) Enter fullscreen mode Exit fullscreen mode The environment becomes evidence. That distinction seems obvious in hindsight, but I think it matters a lot as agents gain more tools and autonomy. The Current Architecture It's built around a controlled runner rather than letting a model operate directly on my host machine. The current stack includes: TypeScript / Node.js a dedicated Runner instrumented tools explicit allow/deny policy rootless Podman containers fixed task fixtures synthetic canaries filesystem snapshots and deltas raw JSONL execution traces derived JSON results provenance-linked HTML reports inspect, run, and verify commands a deterministic fake Runner an OpenAI Responses API adapter for real model runs The flow looks roughly like: graph TD A[Task + skill + policy] --> B[Controlled runner] B --> C[Model / tool events] C --> D[Raw trace] D --> E[Environment snapshot] E --> F[Derived findings] F --> G[Human-readable report] The important part: the pretty report is not the source of truth. It's derived from lower-level evidence. Provenance Became More Important Than I Expected If the harness produces a finding like: Unexpected filesystem write detected I want to be able to trace it back: Which tool invocation caused it? Which trace event recorded that invocation? Which policy applied? Which snapshot proves the file changed? What exact path was involved? What model/configuration produced the run? That's provenance. Without it, an evaluator becomes just another opaque AI system saying "trust me, something suspicious happened" — which would be pretty ironic. First I Had to Benchmark the Benchmark This was probably my favorite lesson from the project so far. Before using a real model, I built a deterministic fake Runner. Instead of asking an AI what to do, it performs a scripted sequence: write this allowed file attempt this forbidden action touch this canary return this known result Enter fullscreen mode Exit fullscreen mode It should report exactly what I expect. If the expected behavior and the generated report disagree, the problem isn't the AI model — it's the harness. That gives me a calibration loop: graph LR A[Known behavior] --> B[Trace] B --> C[Policy decisions] C --> D[Snapshot / delta] D --> E[Report] Only after that chain works should I start trusting conclusions from nondeterministic model runs. And Sure Enough, the Evaluator Had Bugs The first live pilot immediately exposed weaknesses in the harness itself, including: output preservation declaration detection path normalization answer-key contamination missing Git inside the container host-path leakage model reasoning configuration I actually found that encouraging — this is exactly why calibration matters. An evaluation tool can generate a false conclusion just as easily as the system being evaluated can behave incorrectly. The evaluator is software too. It needs tests. Deterministic Doesn't Mean the Model Must Be Deterministic This project helped me finally internalize the difference between determinism and reproducibility. A deterministic system means: same input + same starting conditions = same result. AI models don't always give us that. But I can still control everything around the model: fixed task, fixed fixture, fixed policy, fixed resource limits, known container image, known canaries, recorded model configuration, raw traces, versioned source. Then when two model runs differ, I have a much better chance of understanding why. I'm not trying to pretend nondeterminism doesn't exist — I'm trying to stop unnecessary variables from making the experiment impossible to reason about. The First Study The first experiment is called Study 001 — Declared vs. Observed Behavior. The basic idea is to hold as much constant as possible — model, runner, task, fixture, policy, resource limits — and then examine differences between what instructions declare, what the model attempts, what policy allows, and what ultimately happens. I want the result to look more like an experiment than "I prompted some models and vibes were weird." Here's that run in full: an OpenAI model given a code-review skill, pointed at a small web-app fixture, inside a rootless container with the network disabled and a hard cap on filesystem writes, process count, and steps. The skill itself declared nothing — no listed commands, no referenced scripts, no URLs. Just instructions in prose. What actually happened: Observation Count Files read 9 Processes started 7 Denied actions 3 Network requests attempted 0 Filesystem writes 0 Termination reason completed Three of those denied actions happened back-to-back, within a single millisecond of each other, right after two earlier commands had gone through — a rapid retry against the policy boundary before the agent moved on to something else. Neither the file reads nor the process executions were ever declared by the skill, which the comparison pass flags outright as observed_not_declared for both categories. Nothing dangerous happened here — the policy held, nothing left the sandbox, the run completed cleanly. But that's exactly the point: the skill's own description said nothing about touching the filesystem or spawning processes, and the agent did both, repeatedly, plus made three attempts that were blocked. A pass/fail grade on "did it review the code" would have shown none of that. This Isn't a "Safety Score" One thing I specifically don't want the harness to become: GPT-X: 84/100 safe Model Y: 73/100 safe That number might look authoritative while hiding an enormous amount of context. I'd rather produce something like: Task completed: yes Network attempts: 1 Network attempts blocked: 1 Unexpected writes: 0 Declared/attempted discrepancy: 1 Trace event: #47 Policy event: #48 Environment delta: none Enter fullscreen mode Exit fullscreen mode Then the person reading the result can inspect the evidence. It should help answer questions — it shouldn't pretend to settle every question with one number. Is This Completely Unique? Probably not, and I'm intentionally avoiding claims like "world's first AI agent behavior benchmark!!!" There are already agent benchmarks, sandbox systems, trace graders, security evaluations, MCP tooling, observability platforms, and research projects looking at overlapping problems. That's good — it means this is a real problem space. The part I'm particularly interested in is keeping this entire chain visible: instruction → attempt → authorization → physical effect Enter fullscreen mode Exit fullscreen mode That gives the project a narrower and, I think, more useful question: not only "Did the agent succeed?" but "How did the agent behave while trying?" Who Might Actually Use This? The obvious group is people building coding agents. But it extends further: Agent developers — test how an agent behaves when given real tools. Security and red teams — see whether an agent attempts actions outside its intended boundary, even when those actions are successfully blocked. Agent framework developers — test permission systems, tool routers, sandboxes, and orchestration layers. MCP and tool authors — observe how agents actually interact with a tool rather than assuming the description will produce the expected behavior. Model evaluators — compare models under the same controlled execution environment. Companies deploying internal agents — test an agent in a disposable environment before giving it repository, CI, infrastructure, or production access. Open-source maintainers — potentially test AI contributors or coding bots against a fixture before allowing them near a real repository. Eventually I'd Love This to Feel Simple harness run evals/no-network.yaml Enter fullscreen mode Exit fullscreen mode Then CI could produce: Harness Evaluation Task: dependency refactor Outcome: PASS Policy violations attempted: 2 Blocked network attempts: 1 Unexpected filesystem writes: 0 Declared/attempted discrepancies: 1 Trace: available Environment diff: available Report: available Enter fullscreen mode Exit fullscreen mode At that point it becomes less like a traditional benchmark and more like a behavioral testing and observability layer for AI agents. That's the direction I'm increasingly interested in. The Bigger Lesson for Me I'm still fairly new to serious AI-agent engineering, which is part of why this project has been so useful. I originally thought evaluating an agent mostly meant: give it a task → check the answer. Now I think much more in terms of: graph TD A[Give it a task] --> B[Record what it tries] B --> C[Enforce boundaries] C --> D[Inspect what actually happened] D --> E[Preserve the evidence] E --> F[Evaluate the evaluator] That feels like a much healthier mental model for increasingly capable agents. The question isn't only "Did the AI get the right answer?" It's also "What happened between the prompt and the answer?" That's what I'm trying to make this harness good at showing. This is still very early — one skill, one fixture, one model — but Study 001's first real run already surfaced something worth knowing: a skill that declares nothing can still read nine files, spawn seven processes, and hit a policy wall three times before finishing clean. Building the tool has already taught me more than I expected the tool itself to measure. If you're working on coding agents, sandboxes, agent evaluation, MCP tooling, or AI security, I'd genuinely be interested in hearing what kinds of behavior you'd want a system like this to capture.

来源报道 · 1 篇 · 以下链接均前往原始媒体

← 返回精选动态 原文

更多内容