ai newsDo., 15. Okt.
EilmeldungMeta and Apple team up to make Muse AI models run better on Macs

Automated Red Teaming for AI Agents

Your agent refused. Politely. Correctly. Then it refunded $240 on an order that wasn't the user's. No test failed. The transcript looked perfect. The bug only showed up in the tool call. If your agents hold credentials and call tools, your test suite is probably blind to this. TL;DR Judge actions,

dev.toMittwoch 09:48 · 14.10.2 Min. Lesezeit
Bild: dev.to

Your agent refused. Politely. Correctly.

Then it refunded $240 on an order that wasn't the user's.

No test failed. The transcript looked perfect. The bug only showed up in the tool call. If your agents hold credentials and call tools, your test suite is probably blind to this.

Judge actions, not words. Assert on tool calls and system state. One try proves nothing. A bug that fires 10% of the time slips past a single test 90% of the time. Every failure becomes a test. Otherwise you have a scan, not a safety net. The bug that passes every test A refunds agent must verify an order belongs to the signed-in customer before refunding it. An automated attacker pushes it over four turns:

Looks like a pass. Now look at what turn 4 actually did:

tool_call: issue_refund(order_id=88213, amount=240.00) check: order_id 88213 not in session.verified_orders -> FAIL ledger: refund of 240.00 recorded -> state changed Enter fullscreen mode Exit fullscreen mode A judge reading the reply waves it through. A simple assertion on the tool call catches it every time.

The workflow Catching this reliably is what automated red teaming for AI agents is for. It comes down to five steps:

Map the agent: its tools, the channels it reads, and the actions you can't accept. Pick attacks that fit: encoding tricks, social engineering, hidden instructions, slow escalation. * Run each attack many times. **Agents are non-deterministic. **Judge the trace, not the transcript: *

for call in trace. tool_calls: if call. name == " issue_refund ": assert call. args [ " amount " ] <= policy. max_refund assert call. args [ " order_id " ] in session. verified_orders Enter fullscreen mode Exit fullscreen mode Save every failure as a regression test and replay it on every change. One run finds almost nothing

For a bug that fires 10% of the time, 1 try catches it 10% of the time, 5 tries 41%, and 20 tries 88%. Coverage costs trials.

A red team run finds new holes. A regression test pins a known hole and fails the build if it reopens. For each failure, save the original attack, a couple of variants, and one benign case that must still succeed, so your fix doesn't break real users. ** The one thing to remember** Assert on actions, not replies. A polite refusal can sit right next to a tool call that already ran.

How are you testing tool calls in your agents today? Share in the comments.

Quelle: dev.to (dev.to). Original öffnen