Skip to content

AI Safety Guardrails

Input/output safety filters for AI systems. Pluggable filter pipeline that sits between user and LLM boundaries, inspecting and filtering both directions. Ships with prompt-injection detection, PII redaction, content-policy enforcement, and token-limit guards. The filter registry pattern makes it trivial to add custom safety filters.

Nameguardrails
Version0.1.0
Categoryai-systems
LicenseApache-2.0
Personaengineering
Tagsai, safety, guardrails, filters, typescript
Sourcetemplates/guardrails

Render it

Three front doors, one catalog. Pick whichever suits the caller.

# CLI
npx @nanohype/sdk render guardrails --out ./my-app

# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "guardrails", variables);

# MCP — from an agent
get_template({ name: "guardrails" })

Prerequisites

ToolVersionWhy
node>=22Node.js runtime for the guardrails module

Variables

Required

ProjectName string
Kebab-case project name, used as package name and directory Must be lowercase kebab-case starting with a letter.

Optional

Description string — defaults to AI safety guardrails
Short project description for package.json and README
IncludePii bool — defaults to true
Include PII detection filter
IncludeContentPolicy bool — defaults to true
Include content policy filter
IncludeTests bool — defaults to true
Include test suite

What it produces

22 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.

.env.example
.gitignore
biome.json
package.json
README.md
src/guardrails/bootstrap.ts
src/guardrails/filters/__tests__/pii.test.ts
src/guardrails/filters/__tests__/pipeline.test.ts
src/guardrails/filters/__tests__/prompt-injection.test.ts
src/guardrails/filters/content-policy.ts
src/guardrails/filters/index.ts
src/guardrails/filters/pii.ts
src/guardrails/filters/prompt-injection.ts
src/guardrails/filters/registry.ts
src/guardrails/filters/token-limit.ts
src/guardrails/filters/types.ts
src/guardrails/index.ts
src/guardrails/pipeline.ts
src/guardrails/types.ts
src/logger.ts
tsconfig.json
vitest.config.ts

Composes with

Composites that use it

  • Enterprise AI Infrastructure — Full enterprise AI stack with agents, tool servers, safety guardrails, evaluation, prompt management, observability, and Kubernetes deployment..
  • AI Evaluation Suite — Standalone evaluation infrastructure with test harness, versioned prompts, and guardrails validation.
  • Multi-Agent System — Multi-agent architecture with A2A protocol peers, MCP tool servers, and an orchestrating agent.
  • Safe AI Agent — AI agent with safety guardrails, evaluation harness, and prompt management.