guardrail-sim
byJeff Green

Introduction

Policy simulation engine for AI agent pricing governance

guardrail-sim

guardrail-sim tests AI pricing policies before they cost you millions. Define discount caps, margin floors, and volume tiers—then let deterministic rules govern what AI agents can approve.

The Problem

You're deploying an AI sales agent. It can negotiate discounts. But:

  • Will it honor your margin floors? Or give 40% off to anyone who asks nicely?
  • How does it behave at scale? One bad discount is a rounding error. 10,000 is a crisis.
  • Can you prove compliance? When finance asks, "what are the rules?", show them—don't guess.

The Solution

Define policies declaratively. Evaluate discounts deterministically.

import { PolicyEngine, defaultPolicy } from '@guardrail-sim/policy-engine';
import type { Order } from '@guardrail-sim/policy-engine';
 
const engine = new PolicyEngine(defaultPolicy);
 
const order: Order = {
  order_value: 5000,
  quantity: 100,
  product_margin: 0.4,
  customer_segment: 'gold'
};
 
const result = await engine.evaluate(order, 0.15);
 
// result.approved: true or false
// result.violations: [{ rule: '...', message: '...' }]
// result.calculated_margin: 0.25

Features

  • Deterministic policies: json-rules-engine ensures predictable, auditable outcomes
  • MCP integration: 5 tools for AI agent integration via Model Context Protocol
  • UCP alignment: Compatible with Universal Commerce Protocol for agentic commerce
  • Policy insights: Health checks and recommendations for policy optimization
  • Type-safe: Full TypeScript support with inference

Packages

PackageDescription
@guardrail-sim/policy-engineCore policy evaluation engine
@guardrail-sim/mcp-serverMCP server for AI agent integration
@guardrail-sim/ucp-typesUCP type definitions and converters
@guardrail-sim/insightsPolicy health checks and recommendations

Next Steps

On this page