real-time-guardrails

real-time-guardrails is a skill for Claude Code, Codex from ibm-self-serve-assets/building-blocks. It costs 131 tokens per session (4,786 once invoked), scanned B, original, Apache-2.0.

Runtime safety and quality checks for AI and retrieval-augmented generation agents, using IBM watsonx.governance.

In plain words
What is it for?
Use it to check user input, retrieved information, generated answers, and output in FastAPI or Flask applications.
Why use it?
It gives an application defined points where requests or results can pass, be flagged, or be blocked, with thresholds and audit records.

Skill for Claude CodeCodex

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

Good fit Use it to check user input, retrieved information, generated answers, and output in FastAPI or Flask applications.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ibm-self-serve-assets/building-blocks/real-time-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 ibm-self-serve-assets/building-blocks --skill real-time-guardrails
Clone the repo
git clone --depth 1 https://github.com/ibm-self-serve-assets/building-blocks

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 real-time-guardrails

README.md
[![agentmods](https://agentmods.dev/badge/skills/ibm-self-serve-assets/building-blocks/real-time-guardrails/github.svg)](https://agentmods.dev/skills/ibm-self-serve-assets/building-blocks/real-time-guardrails)
Your own site
<a href="https://agentmods.dev/skills/ibm-self-serve-assets/building-blocks/real-time-guardrails"><img src="https://agentmods.dev/badge/skills/ibm-self-serve-assets/building-blocks/real-time-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 real-time-guardrails

Your own site · 80×15
<a href="https://agentmods.dev/skills/ibm-self-serve-assets/building-blocks/real-time-guardrails"><img src="https://agentmods.dev/badge/skills/ibm-self-serve-assets/building-blocks/real-time-guardrails.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 131 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,786 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00131 $0.04786
Opus 5.5 $0.00052 $0.01914
Sonnet 5.5 $0.00026 $0.00957
Haiku 4.5 $0.00013 $0.00479

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

Security

Grade B, and why

real-time-guardrails scanned grade B with 1 finding 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 24d ago.

The scan reads SKILL.md. This mod also ships 10 executable files (examples/backend_guardrails_proxy.py, examples/custom_metric_example.py, examples/decorator_example.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

**RULE 1 — Never paste live credentials into chat.** Guide the user to set `WATSONX_APIKEY` and `WXG_SERVICE_INSTANCE_ID` in a `.env` file (`chmod 600`). Use `read -s` to enter the key without leaving it in shell history
ibm-bob/skills/real-time-guardrails/SKILL.md · 245 lines

How it starts

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

Real-Time Guardrails

This skill helps developers wire production-grade safety and quality guardrails into AI agents using IBM's real-time-guardrails package (backed by watsonx.governance). The package ships 28 metrics across safety, RAG-generation, RAG-retrieval, quality, topic, pattern, and tool-call categories, with a 3-state Pass/Flag/Block action model, threshold policy as code, and audit logging.


Mandatory Rules

Read every time. Violating any of these causes silent or costly failures in production.

RULE 1 — Never paste live credentials into chat. Guide the user to set WATSONX_APIKEY and WXG_SERVICE_INSTANCE_ID in a .env file (chmod 600). Use read -s to enter the key without leaving it in shell history. If a user pastes a key into chat, interrupt and tell them to rotate it at IBM Cloud → Manage → Access (IAM) → API keys.

RULE 2 — WXG_PROJECT_ID is optional. The package runs 25 metrics with just WATSONX_APIKEY + WXG_SERVICE_INSTANCE_ID. WXG_PROJECT_ID unlocks 3 LLM-as-judge metrics (Answer Completeness, Conciseness, Tool Call Relevance). Don't force watsonx.ai on partners who don't want LLM-judge cost.

RULE 3 — Python 3.11–3.13 only. The IBM SDK chain doesn't support 3.14 yet. If the user is on 3.14, rebuild their venv with 3.11/3.12/3.13.

RULE 4 — Install from source with the [all] extra; use a dedicated venv. The package is not on PyPI today — partners install from a building-blocks repo clone via pip install -e "<repo>/ai/govern/guardrails/assets/sdk[all]". The quotes are required on zsh (macOS default) — without them, the shell parses [all] as an array subscript, silently produces an empty path, and pip errors with is not a valid editable requirement. The bundled setup.sh quotes correctly. Without [metrics,llmaj] (always part of base install), registry build fails with ModuleNotFoundError: No module named 'unitxt'. If the user reports ResolutionImpossible during install, their existing venv has stricter pins than the SDK can accept (typically on pydantic or httpx) — load reference/setup-and-credentials.md for the conflict matrix + dry-run recipe.

Read the full file on GitHub · 245 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. 24d ago Changed d069743708dc
  2. 1mo ago Changed 2d1bc88398dc
  3. 1mo ago Changed 262e92965894
  4. 2mo ago First seen · 245 lines · 131 tokens per session scan B 0b3eadf7c797

Subscribe to this mod's changes

real-time-guardrails is a skill published in the GitHub repository ibm-self-serve-assets/building-blocks (28 stars, last pushed yesterday), licensed Apache-2.0. It adds 131 tokens to every session and 4,786 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

real-time-guardrails compared with skills from other repositories

real-time-guardrails next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
real-time-guardrailsibm-self-serve-assets/building-blocksSkill28yesterdayApache-2.0B131Claude Code, Codex
embeddingsruvnet/rufloSkill81kyesterdayMITA62Claude Code
agent-platform-rag-engine-managementgoogle/skillsSkill22kyesterdayApache-2.0A85Claude Code, Codex
llm-app-patternsdavila7/claude-code-templatesSkill33kyesterdayMITA54Claude Code, Codex
9router-embeddingsdecolua/9routerSkill32k9d agoMITA66Claude Code, Codex
embedding-strategiesforyourhealth111-pixel/Vibe-SkillsSkill3.8k3d agoApache-2.0A37Claude Code, Codex
similarity-search-patternsforyourhealth111-pixel/Vibe-SkillsSkill3.8k3d agoApache-2.0A30Claude Code, Codex