Quest 01 / 03 · Project
Guard and red-team a local tool agent with NeMo Guardrails and garak
- Python
- agent guardrails
- LLM red-teaming
- MCP tool safety
- MLflow tracking
Why now Google set a February 2027 MCP mandate for Workspace agents in the same week that AWS reported Cairn agents finding a zero-day from operator-supplied targets. Pairing NVIDIA NeMo Guardrails with garak tests input filters and tool-call rules through repeatable detector reports on local hardware.
Build it Build a local mock workspace assistant backed by an open model in LM Studio and wrapped in NVIDIA NeMo Guardrails policies for prompt screening and tool-call limits. Run garak probes plus split attack and benign prompt suites against both raw and guarded endpoints, then log every score in a local MLflow server.
From the news
- garak makes model failure reports repeatable and inspectable 2026-11-26 · source
- NeMo Guardrails adds agent checks with defined inspection limits 2026-11-26 · source
- Google sets an MCP requirement for Workspace agents 2026-11-26 · source
- AWS says Cairn agents helped attackers exploit a zero-day 2026-11-26 · source
Tools
- LM Studio
The LM Studio desktop application is proprietary and free for personal and internal business use under its terms. Optional Bionic cloud plans use subscriptions and credits; model weights and separately published SDKs have their own licenses.
- NVIDIA NeMo Guardrails
The NeMo Guardrails library uses Apache 2.0 and has no software subscription requirement. Model-based checks and deployment infrastructure have separate costs and licenses. NVIDIA commercial services are outside the license grant for this library.
- garak
garak is free Apache-2.0 software. Running it requires suitable compute and access to the selected target or model provider. External model services and test infrastructure can incur their own charges.
- MLflow
The MLflow project is free Apache 2.0 software and can run on a local server. Managed hosting, storage and external model calls have separate charges.
Data
- AI Agent Cybersecurity Dataset 2026 Kaggle
Supplies AI agent and MCP security attack scenarios for custom adversarial test cases and guardrail policy authoring.
- deepset/prompt-injections Hugging Face
Supplies labeled prompt-injection and benign prompts to measure both attack block rates and false refusals on normal requests.
Steps
- Install LM Studio on its free personal route to pull a small open-weight instruction model and expose its local OpenAI-compatible HTTP endpoint.
- Download both public datasets and inspect their file layout before assembling a stratified 400-prompt split mixing benign requests with MCP and prompt-injection attacks.
- Write a mock Python workspace tool server with three read-only functions plus one restricted export function gated behind an explicit allowlist check.
- Run baseline garak prompt-injection probes and your 400-prompt split against the unguarded assistant, saving raw JSONL transcripts and detector outputs.
- Configure NVIDIA NeMo Guardrails with input and output rails plus tool-call inspection rules that block restricted exports and secret-extraction attempts.
- Re-run the identical garak probe suite and 400-prompt evaluation against the guarded endpoint while capturing latency and every triggered rail name.
- Start a local MLflow tracking server and log model identifier, guardrail config hashes, attack block rates, benign refusal rates, and sample failure traces for each run.
- Tighten one failing guardrail rule from the logged bypass transcripts before rerunning both evaluation suites for a third MLflow comparison run.
Deliverables
- Python repository holding the mock workspace tool server paired with NeMo Guardrails Colang rules and repeatable garak runner scripts, attributing both datasets per their licenses.
- MLflow experiment export comparing the unguarded baseline against two guarded policy revisions across both datasets.
- Ten-case plain-text failure log documenting concrete bypasses or false refusals alongside the policy edits made in response.
How to measure it
Measure adversarial block rate, benign false-refusal rate, garak detector pass rates, and per-request latency overhead in milliseconds against the unguarded local model baseline. Target a revised policy that cuts successful attack executions by at least 50 percentage points while holding benign false refusals below 10 percent.
Done when
- The local LM Studio endpoint answers tool-calling requests without any paid cloud API key.
- garak writes separate JSONL report files for the unguarded and guarded assistant endpoints using matching probe configs.
- The guarded assistant blocks every unauthorized call to the restricted export function across the evaluation split.
- MLflow displays at least three logged runs with side-by-side metrics for blocked attacks, safe-prompt refusals, garak probe scores, and median response time.
- A saved error-analysis CSV lists at least ten missed attacks or safe-prompt blocks together with the exact guardrail rail that fired or stayed silent.
Stretch goals
- Add a Microsoft PyRIT multi-turn attack script to test whether gradual conversational framing bypasses single-turn NeMo Guardrails checks.
- Export a second guardrail profile using Guardrails AI PyPI validators and compare its latency and false-refusal rate in MLflow.
- Package the mock tool server behind a local MCP transport so external desktop clients can run against the same guarded rules.
