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,792 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,792 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.04792
Opus 5 $0.00066 $0.02396
Sonnet 5 $0.00026 $0.00958
Haiku 4.5 $0.00013 $0.00479

Measured 12d ago against content hash 0b3eadf7c797, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, 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 12d 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-trust/real-time-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. 12d 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 (24 stars, last pushed yesterday), licensed Apache-2.0. It adds 131 tokens to every session and 4,792 once invoked, about $0.0007 per session on Opus 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

Other skills, from other repositories

embeddings

Vector embeddings with HNSW indexing, sql.js persistence, and hyperbolic support. 75x faster with agentic-flow integration. Use when: semantic search, pattern matching, similarity queries, knowledge retrieval. Skip when: exact text matching, simple lookups, no semantic understanding needed.

ruvnet/ruflo · 62 tokens

agent-platform-rag-engine-management

Manage and query Agent Platform RAG Engine Corpora and retrieve grounded contexts using the Google GenAI SDK. Use when listing RAG corpora or files, inspecting a corpus, retrieving contexts, or generating content grounded in a RAG corpus. Do not use for standard database queries (use SQL/Spanner skills), Google…

google/skills · 85 tokens

llm-app-patterns

Production-ready patterns for building LLM applications. Covers RAG pipelines, agent architectures, prompt IDEs, and LLMOps monitoring. Use when designing AI applications, implementing RAG, building agents, or setting up LLM observability.

davila7/claude-code-templates · 54 tokens

9router-embeddings

Generate vector embeddings via 9Router /v1/embeddings using OpenAI / Gemini / Mistral / Voyage / Nvidia / GitHub embedding models for RAG, semantic search, similarity. Use when the user wants embeddings, vectors, RAG, semantic search, or to embed text.

decolua/9router · 66 tokens

azure-search-documents-dotnet

Azure AI Search SDK for .NET (Azure.Search.Documents). Use for building search applications with full-text, vector, semantic, and hybrid search. Covers SearchClient (queries, document CRUD), SearchIndexClient (index management), and SearchIndexerClient (indexers, skillsets). Triggers: "Azure Search .NET"…

microsoft/skills · 102 tokens

browserwing-admin

Manage and operate BrowserWing — an intelligent browser automation platform. Install dependencies, configure LLM, create/manage/execute automation scripts, use AI-driven exploration to generate scripts, browse the script marketplace, and troubleshoot issues.

MemTensor/MemOS · 47 tokens