ai newsSa., 24. Okt.
EilmeldungAnthropic überträgt den Agent-Skills-Standard an die Linux Foundation

AgentGuard soll personenbezogene Daten vor KI-Agenten schützen

Ausgehend von einer unsicheren Erfahrung mit einem lokal laufenden Coding-Agenten auf Basis von Qwen 2.5 via Ollama entstand AgentGuard, ein Ansatz zum Schutz persönlicher Daten vor autonomen KI-Agenten.

dev.toSamstag 07:09 · 24.10.DE5 Min. Lesezeit
Bild: dev.to

Vor ein paar Wochen hatte ich einen dieser Momente, die einem als Entwickler den Atem stocken lassen. Ich habe mit einem lokalen autonomen Coding-Agenten experimentiert, der auf einem kleinen Open-Source-Modell lief (Qwen 2.5 via Ollama). Ich gab ihm Zugriff auf ein bash-Tool, damit es Abhängigkeiten installieren, Testsuiten ausführen und Build-Artefakte aufräumen konnte. Alles lief reibungslos, bis ich es bat, einige alte Logs aufzuräumen. Im Terminal sah ich zu, wie es gelassen vorschlug: bash rm -rf /var/log/mongodb

Und direkt danach begann es, in Dateien außerhalb seines Projektordners herumzustöbern. Ich habe Ctrl+C so schnell gedrückt, dass ich fast die Tastatur zerbrochen hätte. Die „Polite Prompt“-Falle Wie die meisten Entwickler war mein erster Instinkt, das Problem mit Prompt Engineering zu lösen: „Du bist ein sorgfältiger Assistent. Bitte berühre NUR Dateien in./workspace. Verwende NIEMALS sudo. Lösche NIEMALS Systemordner. Bitteschön.“ Und was glaubt ihr, was beim aller nächsten Lauf passierte?

Das ist die Sache, über die wir nicht genug sprechen: Kleine Open-Source-Modelle (3B, 7B, 14B) haben nicht die massiven Alignment-Schichten, die GPT-4 oder Claude 3.5 haben. Wenn ein Open-Source-Agent verwirrt ist, halluziniert oder auf einen Edge Case stößt, ist dein höflicher System-Prompt das erste, was über Bord fliegt.

Wenn eine KI beschließt, deinen privaten Kontoauszug oder eine.env-Datei voller Production-Tokens zu lesen, solltest du das Modell nicht von gutem Verhalten überzeugen müssen.

Man würde einer nicht vertrauenswürdigen Webanfrage auch nicht sagen, sie möge „bitte keine SQL-Injection machen“; man verwendet parametrisierte Queries.

Wieso betteln wir also KI-Agenten an, unsere Festplatten nicht in die Luft zu jagen?

Ich wollte eine einfache Regel: Der Agent darf denken, was er will, aber bevor irgendein Tool mein Betriebssystem berührt, wird an der Tür sein Ausweis kontrolliert.

Wenn der Agent beschließt, bank_statement.pdf zu lesen, sollte das System nicht mit der KI verhandeln. Es sollte den Dateiaufruf abfangen, „Nein, passiert nicht“ sagen und sicherstellen, dass 0 Bytes dieser Datei je gelesen werden.

AgentGuard ist im Wesentlichen ein Türsteher, der zwischen deinem KI-Agenten und deinem Betriebssystem sitzt. Er erledigt drei unkomplizierte Dinge:

[ AI Agent / Ollama / OpenDevin ] │ │ 1. "Hey, ich möchte ausführen: cat bank_statement.pdf" ▼ ┌───────────────────────────┐ │ AgentGuard Gateway │ ◄── [ Backboard.io ] └───────────────────────────┘ (Merkt sich frühere Blockierungen) │ │ [ BLOCK ] [ APPROVE ] │ │ │ └──► Läutet an deinem Dashboard: │ "Agent möchte etwas per pip install installieren. Erlauben?" ▼ Ablehnung zurück an den Agenten: "Zugriff auf Banking-Datei blockiert. Bleib in./workspace." │ ▼ Agent korrigiert sich selbst: "Mein Fehler! Lese stattdessen./workspace/logs/debug.log."

Wenn ein Agent ein Tool aufruft (Shell-Befehl, Datei-Lesen, Datei-Löschen), prüft AgentGuard die Anfrage synchron, bevor sie ausgeführt wird.

Versuch,.env, id_rsa oder eine Datei zu berühren, die auf bank oder tax passt? → Blockiert.

Verlassen von./workspace mit../../? → Blockiert. Das File-Handle wird nie geöffnet. Der Shell-Befehl wird nie gestartet.

Was ist mit Aktionen in der Grauzone? Angenommen, der Agent möchte pip install pymongo ausführen.

Man will Paketinstallationen nicht komplett blockieren, aber man will auch nicht, dass eine KI stillschweigend unbekannte Wheels von PyPI zieht.

AgentGuard pausiert den Agenten und stellt die Anfrage in eine Human Review Queue: Du bekommst eine Benachrichtigung auf einem übersichtlichen Web-Dashboard. Jede Anfrage hat einen kryptografischen Timer von 5 Minuten, damit alte, verfallene Befehle nicht versehentlich Stunden später ausgeführt werden.

Du klickst auf [ AUTHORIZE & RUN ], und der Befehl wird direkt vor deinen Augen in einer kontrollierten Sandbox ausgeführt.

Eine Sache, die mich bei lokalen Modellen zur Weißglut getrieben hat, war die Amnesie. Wenn man einem Agenten sagt „lösche diesen Ordner nicht“, entschuldigt er sich... und versucht es zwei Dialoge später wieder.

Um das zu beheben, habe ich Backboard.io für persistenteren Cloud-Vector-Memory eingebunden.

Wann immer AgentGuard einen Befehl blockiert, schreibt es eine kurze Lektion in Backboard:

"Vorfall: Agent versuchte, 'sudo rm -rf' auszuführen. Blockiert durch die Policy shell.destructive_commands."

Beim nächsten Start einer Aufgabe zieht AgentGuard die relevanten Erinnerungen aus Backboard und speist sie in den Kontext des Agenten ein. Der Agent erinnert sich buchstäblich daran, was ihn gestern in Schwierigkeiten gebracht hat, und schlägt von vornherein keine schlechten Befehle mehr vor.

Ich wollte kein sperriges Nur-Terminal-Tool, also habe ich ein industrielles Dark-Mode-Cockpit mit React und Tailwind gebaut:

Top-KPI-Karten: Live-Zähler für blockierte Angriffe, insgesamt überwachte Aktionen und gelernte Backboard-Erinnerungen.

Review Queue: Tabs für Pending, Approved und Expired Aktionen mit Inline-Terminal-Ausgabe.

Threat Lab: Eine integrierte Sandbox, in der man Red-Team-Szenarien mit einem Klick testen kann (Ransomware-Simulationen, Credential-Exfiltration, Path Traversal), um zu sehen, ob das lokale Modell ausbrechen kann. Spoiler: 0 Ausbrüche.

Als NPM-Paket veröffentlichen: Bring Your Own Keys (BYOK)

Aktuell kann man das Repository klonen und es lokal mit FastAPI und MongoDB ausführen.

Aber mir wurde klar, dass das immer noch zu viel Reibung für Entwickler ist, die einfach etwas per npm install installieren und loslegen wollen.

Deshalb verpacke ich das als eigenständiges Bring-Your-Own-Keys (BYOK) NPM SDK:

Man fügt seinen eigenen Backboard-API-Key (für Cloud-Memory) und seinen eigenen LLM-Key (oder einen Ollama-Endpoint) ein:

typescript import { AgentGuard } from 'agentguard'; const guard = new AgentGuard({ backboardApiKey: process.env.BACKBOARD_API_KEY, workspace: './workspace', }); // Beliebigen Agent-Tool-Aufruf umschließen: const check = await guard.inspect(proposedCommand); if (check.isBlocked) { // Safety-Feedback zurück an das LLM geben, damit es sich selbst korrigiert! console.log( Blocked: ${check.explanation} ); } else { await guard.execute(proposedCommand); }

Keine Server zu betreiben. Keine Hintergrund-Datenbanken zu verwalten. Nur purer Schutz.

Wir treten in eine Ära ein, in der KI-Agenten nicht mehr nur Autocomplete-Engines sind; sie sind aktive Operateure auf unseren Computern. Sie schreiben Code, verwalten Dateien und führen bash-Skripte aus.

Wir müssen aufhören, KI-Sicherheit als philosophisches Prompt-Problem zu behandeln, und anfangen, sie als Problem der Systemarchitektur zu sehen.

Überzeuge nicht das Modell, sich zu benehmen. Bau einfach eine Schutzvorrichtung an die Leitung.

Wenn ihr autonome Agenten entwickelt oder mit lokalen Modellen experimentiert, würde ich gerne hören, wie ihr sie absichert. Hatte schon einmal ein KI-Agent auf eurem Rechner etwas Erschreckendes getan?

Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.

Original (Englisch) anzeigen

A few weeks ago, I had one of those heart-stopping developer moments. I was tinkering with a local autonomous coding agent running on a small open-source model (Qwen 2.5 via Ollama). I gave it access to a bash tool so it could install dependencies, run test suites, and clean up build artifacts. Everything was going smoothly until I asked it to clean up some old logs. In the terminal output, I watched it calmly propose: bash rm -rf /var/log/mongodb

And right after that, it started poking around files outside its project folder.I hit Ctrl+C so fast I almost snapped my keyboard. The "Polite Prompt" Trap Like most developers, my first instinct was to fix it with prompt engineering: "You are a careful assistant. Please ONLY touch files in./workspace. NEVER use sudo. NEVER delete system folders. Pretty please." And you know what happened on the very next run?

Here’s the thing we don't talk about enough: Small, open-source models (3B, 7B, 14B) don't have the massive alignment layers that GPT-4 or Claude 3.5 have. When an open-source agent gets confused, hallucinates, or hits an edge case, your polite system prompt is the first thing out the window.

If an AI decides to read your private banking statement or a.env full of production tokens, you shouldn't have to convince the model to behave.

You wouldn't ask an untrusted web request to "please not do SQL injection"—you use parameterized queries.

So why are we begging AI agents not to nuke our hard drives?

I wanted a simple rule: The agent can think whatever crazy thought it wants, but before any tool touches my operating system, someone checks its badge at the door.

If the agent decides to read bank_statement.pdf, the system shouldn't plead with the AI. It should intercept the file call, say "Nope, not happening", and ensure 0 bytes of that file are ever read.

AgentGuard is essentially a bouncer sitting between your AI agent and your OS. It does three straightforward things:

[ AI Agent / Ollama / OpenDevin ] │ │ 1. "Hey, I want to run: cat bank_statement.pdf" ▼ ┌───────────────────────────┐ │ AgentGuard Gateway │ ◄── [ Backboard.io ] └───────────────────────────┘ (Remembers previous blocks) │ │ [ BLOCK ] [ APPROVE ] │ │ │ └──► Rings your dashboard bell: │ "Agent wants to pip install something. Allow?" ▼ Refusal sent back to Agent: "Access to banking file blocked. Stay in./workspace." │ ▼ Agent self-corrects: "My bad! Reading./workspace/logs/debug.log instead."

When an agent calls a tool (shell command, file read, file delete), AgentGuard inspects the request synchronously before execution.

Trying to touch.env, id_rsa, or a file matching bank or tax? → Blocked.

Escaping./workspace with../../? → Blocked. The file handle is never opened. The shell command is never spawned.

What about grey-area actions? Say the agent wants to run pip install pymongo.

You don't want to completely block package installs, but you don't want an AI silently pulling unknown wheels from PyPI either.

AgentGuard pauses the agent and puts the request into a Human Review Queue: You get a notification on a clean web dashboard. Each request has a 5-minute cryptographic timer so old, stale commands can't accidentally execute hours later.

You click [ AUTHORIZE & RUN ], and it runs inside a controlled sandbox right in front of your eyes.

One thing that drove me crazy about local models was amnesia. If you tell an agent "don't delete that folder", it apologizes... and then tries again two turns later.

To fix this, I plugged in Backboard.io for persistent cloud vector memory.

Whenever AgentGuard blocks a command, it writes a short lesson into Backboard:

"Incident: Agent tried to run 'sudo rm -rf'. Blocked by policy shell.destructive_commands."

Next time you start a task, AgentGuard pulls the relevant memories from Backboard and feeds them into the agent's context. The agent literally remembers what got it in trouble yesterday and stops proposing bad commands in the first place.

I didn't want a clunky terminal-only tool, so I built an industrial, dark-mode cockpit with React and Tailwind:

Top KPI Cards: Live count of blocked attacks, total actions governed, and learned Backboard memories.

Review Queue: Tabs for Pending, Approved, and Expired actions with inline terminal output.

Threat Lab: A built-in sandbox where you can test 1-click red-team scenarios (ransomware simulations, credential exfiltration, path traversal) to see if your local model can break out. Spoiler: 0 escapes.

Making It an NPM Package: Bring Your Own Keys (BYOK)

Right now, you can clone the repo and run it locally with FastAPI and MongoDB.

But I realized that's still too much friction for developers who just want to npm install something and start coding.

So I'm packaging this as a standalone Bring-Your-Own-Keys (BYOK) NPM SDK:

You drop in your own Backboard API key (for cloud memory) and your own LLM key (or Ollama endpoint):

typescript import { AgentGuard } from 'agentguard'; const guard = new AgentGuard({ backboardApiKey: process.env.BACKBOARD_API_KEY, workspace: './workspace', }); // Wrap any agent tool call: const check = await guard.inspect(proposedCommand); if (check.isBlocked) { // Feed safety feedback back to the LLM so it self-corrects! console.log( Blocked: ${check.explanation} ); } else { await guard.execute(proposedCommand); }

Zero servers to host. Zero background databases to manage. Just pure protection.

We are entering an era where AI agents aren't just autocomplete engines anymore—they are active operators on our computers. They write code, manage files, and execute bash scripts.

We have to stop treating AI safety as a philosophical prompt problem and start treating it as a systems architecture problem.

Don't convince the model to behave. Just put a guard on the wire.

If you're building autonomous agents or playing with local models, I'd love to hear how you're keeping them safe. Have you had an AI agent do something terrifying on your machine yet?

Originaltitel: "AgentGuard", Way to secure your personal data from AI agentsQuelle: dev.to (dev.to). Original öffnen