agent-guardrails

agent-guardrails is a skill for Claude Code, Codex from MLOps-Courses/agentops-open-course. It costs 71 tokens per session (609 once invoked), scanned A, original, MIT.

A set of safety controls for an AI agent that can read data or use tools. It adds checks around user input, model decisions, tool results, and final output.

In plain words
What is it for?
Redacting personally identifying information, checking tool arguments, highlighting untrusted tool output, requiring approval for state-changing actions, and freezing agent writes when needed.
Why use it?
It reduces the risk that private information is exposed, malicious instructions in tool results are followed, or an agent changes important data without approval. It also provides a configuration-controlled way to stop writes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Redacting personally identifying information, checking tool arguments, highlighting untrusted tool output, requiring approval for state-changing actions, and freezing agent writes when needed.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mlops-courses/agentops-open-course/agent-guardrails
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add MLOps-Courses/agentops-open-course --skill agent-guardrails
Clone the repo
git clone --depth 1 https://github.com/MLOps-Courses/agentops-open-course

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for agent-guardrails

README.md
[![agentmods](https://agentmods.dev/badge/skills/mlops-courses/agentops-open-course/agent-guardrails/github.svg)](https://agentmods.dev/skills/mlops-courses/agentops-open-course/agent-guardrails)
Your own site
<a href="https://agentmods.dev/skills/mlops-courses/agentops-open-course/agent-guardrails"><img src="https://agentmods.dev/badge/skills/mlops-courses/agentops-open-course/agent-guardrails/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for agent-guardrails

Your own site · 80×15
<a href="https://agentmods.dev/skills/mlops-courses/agentops-open-course/agent-guardrails"><img src="https://agentmods.dev/badge/skills/mlops-courses/agentops-open-course/agent-guardrails.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 71 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 609 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00071 $0.00609
Opus 5.5 $0.00028 $0.00244
Sonnet 5.5 $0.00014 $0.00122
Haiku 4.5 $0.00007 $0.00061

Measured 29d ago against content hash 5ffaf7f082f4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

agent-guardrails scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 29d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/agent-guardrails/SKILL.md · 37 lines

How it starts

The opening of the file, as written. The whole thing — 37 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent Guardrails

Put a guardrail at each boundary an untrusted signal can cross: input, model, tool, and output. No single layer is trusted alone — the containment story holds because they overlap.

When to use

  • The agent can call tools that change state (restart, resolve, refund, deploy).
  • Tool or retrieval output is attacker-influenceable and could carry injected instructions.
  • User prompts or tool results may contain PII that must not reach the model or storage.
  • You need an incident lever to freeze all writes through a fast process or configuration rollout.

Steps

  1. Validate tool arguments at the boundary. Parse and reject malformed or out-of-policy arguments before a tool runs — never pass raw model output straight into an action.
  2. Redact PII before the model and before persistence. Run a local redactor (e.g. Presidio) on outbound model requests, inbound responses, tool output, and anything you persist. Treat streaming as a weaker boundary (entities can span chunks).
  3. Spotlight untrusted tool output. Normalize (NFKC), neutralize known injection markers, and wrap free-text tool results in a marked prefix so the model treats them as data, not instructions. This is best-effort defense-in-depth, not a guarantee.
  4. Require attributable human approval for writes. Gate every state-changing tool on a human confirmation that carries the approver's identity and rationale, and record who approved, why, and the decision context in the same transaction as the mutation.
  5. Ship a kill-switch. Read one flag (e.g. AGENT_WRITES_DISABLED) at process startup and refuse every model-callable write before persistence; guarded actions should stop before approval. Document the restart or workload rollout needed to apply it.

Reference implementation

From the AgentOps Open Course (agent modules live under agents/python/src/agent/):

  • guardrails.py — argument validation, injection neutralization, spotlighting, safe error handlers.
  • pii.py — Presidio-based redaction at each boundary.
  • actions.py — attributable HITL approval and the AGENT_WRITES_DISABLED kill-switch.
  • Course chapters 4.5. Guardrails and 4.6. Security.

Read the full file on GitHub · 37 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 29d ago Changed 5ffaf7f082f4
  2. 1mo ago First seen · 37 lines · 71 tokens per session scan A 114998370dc1

Subscribe to this mod's changes

agent-guardrails is a skill published in the GitHub repository MLOps-Courses/agentops-open-course (2 stars, last pushed yesterday), licensed MIT. It adds 71 tokens to every session and 609 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories