跳到正文
DEV Community· Sean Maxwell·· 2 小時前AI 評分51

我的 Agent 故障注入測試框架在首次正式試驗前遇到的五個問題

Five problems my agent fault-injection harness had before its first real trial

AI 導讀

作者在首次正式試驗前記錄其 Agent 故障注入測試框架建置時發現的五個問題,這些問題若未處理,可能在不易察覺的情況下改變評測結果。框架使用本地模型操作 MCP 風格工具;作者將協議失敗、隨機種子是否可重播、評分器輸出無效 JSON,以及未提供工具的呼叫等情況納入記錄或保留在測試中。研究尚未正式執行,作者亦未對檢查器效果提出結論,並計劃以人工標註樣本比較評分器開啟與關閉思考時的表現。

正文

After my last post I started a bigger version of the study: more tools, more fault types, several local models as the agents, and an analysis written down before the run. It has not run yet. I am writing down what went wrong while building it, because each problem would have shifted the results without any sign that it had.

The setup: an agent calls MCP-style tools (filesystem, git, SQLite, fetch). A fault injector sometimes makes a call fail, half-apply, or time out. The agent then writes a final reply. A checker compares that reply with the tool receipts. A separate oracle knows what really happened, so I can score the checker. Other models act as raters and turn each reply into claims.

  1. The model called the tool, but only in text One local model sometimes wrote its tool call as text in its reply, in a harmony-style format, instead of using the structured tool-call field. Sometimes the JSON stopped before the closing brace.

A parser could repair that and carry on. I did not let it. If I repair a malformed call, I am measuring my repair code, not the agent. These episodes are recorded as protocol failures, counted, and reported by fault class.

  1. The server ignored my seed The plan has three seeds per scenario, so I checked that the server honours seed. At temperature 0 it returned the same output three times. At temperature 0.7 with the same seed, three calls gave three different outputs.

So the seeds give me variance, which is what I need, but not replay. The raw logged outputs are the record. The harness now probes the seed at the start of each run and writes the result into the run header, so a reader can see whether replay was possible.

  1. No constrained decoding, so no repair either My raters must return a strict JSON object. Some hosted APIs can enforce a schema. This local server rejects the request outright. The model has to produce valid JSON unaided, and the validator rejects anything else: no extra keys, no code fences, no trailing text, no repair and re-parse.

A rejection is data. If one rater rejects far more often than another, that says something about the rater. A repair step would hide it.

  1. A missing tool silently removed episodes This one was my bug. After a failed move, one model tried to call a delete tool the task never offered. My loop treated an unoffered tool name as a parse failure and threw the whole episode away.

That is a selection effect. An agent that reaches for the wrong tool after a failure is exactly the case a verifier has to handle, and I was dropping those episodes from every denominator. Now the call never reaches the server, the model gets "unknown tool" back as a tool error, and the episode continues. The count is logged.

I kept the strict behaviour for calls that arrive as free text. There, an unoffered name is more likely garbled output than a real request.

  1. The rater spent most of its tokens thinking A rating is a few lines of JSON, and the rater model spent most of its output on reasoning before writing them. Running requests in parallel helped. Turning thinking off cut the cost of a test prompt to a fraction.

I have not decided to turn it off. Thinking may make the rater more accurate, and I do not know yet. I will run both settings against a human-labelled sample and compare them before I commit to either in the pre-registration.

What I have not done
There are no results. I make no claim about how well any checker works on these models. The runs so far are small dry runs to find the problems above, and I am not quoting numbers from them. The study design and sample sizes get written down before the real run.

Two questions for people building agent evals on local models. How do you handle tool calls that arrive as text? And do you let your raters think?

來源:DEV Community · dev.to