惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Engineering at Meta
Engineering at Meta
宝玉的分享
宝玉的分享
有赞技术团队
有赞技术团队
Last Week in AI
Last Week in AI
博客园 - Franky
云风的 BLOG
云风的 BLOG
D
Docker
The Register - Security
The Register - Security
V
V2EX
The GitHub Blog
The GitHub Blog
B
Blog
N
Netflix TechBlog - Medium
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
Microsoft Security Blog
Microsoft Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
Google Online Security Blog
Google Online Security Blog
U
Unit 42
K
Kaspersky official blog
MongoDB | Blog
MongoDB | Blog
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
B
Blog RSS Feed
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Blog — PlanetScale
Blog — PlanetScale
T
Threat Research - Cisco Blogs
Recent Announcements
Recent Announcements
小众软件
小众软件
Stack Overflow Blog
Stack Overflow Blog
I
Intezer
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 【当耐特】
Recorded Future
Recorded Future
Scott Helme
Scott Helme
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Cloudflare Blog
AI
AI
G
GRAHAM CLULEY
L
LangChain Blog
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Why AI Agent Policies Must Be Deterministic, Not Probabilistic
PolicyLayer · 2026-06-16 · via DEV Community

There's a philosophical split in how the AI industry thinks about agent safety. One camp says the model should govern itself — better prompts, better training, better alignment. The other says external enforcement is necessary because models are inherently probabilistic and shouldn't be trusted to enforce their own constraints.

Both camps are partially right — but in practice, almost every production MCP agent today relies entirely on the first approach. Safety rules live in the system prompt. The model interprets them. The model decides whether to follow them. There's no external check. This post argues for deterministic AI agent policies: rules evaluated outside the model, at the transport layer, on every tool call.

What "Deterministic" Means Here

A deterministic policy produces the same result for the same input, every time. Given a tool call with args.amount = 60000 and a rule that says args.amount <= 50000, the call is denied. No interpretation. No context. No probability.

Compare this to how a language model evaluates the same constraint. The system prompt says "do not allow charges over $500." The model sees a tool call for $600. In most cases, it will refuse. But its decision is influenced by conversation history, prompt injection, context window length, temperature, and the specific phrasing of the instruction. The outcome is probabilistic.

For many agent behaviours, probabilistic is fine. You want the model to use judgment about which tools to call, how to interpret user requests, and when to ask for clarification. These are inherently fuzzy decisions.

But safety constraints are not fuzzy decisions. "Don't exceed $500 per charge" has a definitive answer for any given amount. "Don't call delete_repository" is either enforced or it isn't. "Maximum 5 issues per hour" requires exact counting, not estimation.

Deterministic policies handle the definitive cases. The model handles everything else.

The Prompt Enforcement Problem

Consider a concrete example. You're running an agent with access to a Stripe MCP server. Your system prompt says:

You must not create charges exceeding $500.
You must not create more than $10,000 in charges per day.
You must only charge in USD or EUR.

Three rules. All seem clear. Here's where they break down:

Rule 1 works reasonably well for single calls. The model can see amount: 60000 and recognise it exceeds $500. But what about amount: 50001? The model needs to convert cents to dollars, apply the comparison, and decide. It usually gets this right. Not always.

Rule 2 is where things get interesting. To enforce a daily spend cap, the model needs to track cumulative spending across all create_charge calls in the current day. This requires maintaining a running total in its context window. After 20 calls, the model is summing numbers from earlier in the conversation. After 50 calls, some of those earlier calls may have been compressed or summarised. The model is now estimating its cumulative spend, not calculating it.

Rule 3 seems simple until the model encounters an edge case. What about "USD"? "us_dollar"? "dollars"? The model interprets these flexibly. A deterministic policy using the in operator matches exact strings — "usd" and "eur" — with no ambiguity.

What Deterministic Enforcement Looks Like

The same three rules as a deterministic policy:

version: "1"
description: "Stripe spending controls"

tools:
  create_charge:
    rules:
      - name: "max single charge"
        conditions:
          - path: "args.amount"
            op: "lte"
            value: 50000
        on_deny: "Single charge cannot exceed $500.00"

      - name: "daily spend cap"
        conditions:
          - path: "state.create_charge.daily_spend"
            op: "lte"
            value: 1000000
        on_deny: "Daily spending cap of $10,000.00 reached"
        state:
          counter: "daily_spend"
          window: "day"
          increment_from: "args.amount"

      - name: "allowed currencies"
        conditions:
          - path: "args.currency"
            op: "in"
            value: ["usd", "eur"]
        on_deny: "Only USD and EUR charges are permitted"

Each rule evaluates against the raw tool call arguments and persistent state. The daily spend counter is maintained in a state store (SQLite or Redis), not in the model's context window. It's exact, not estimated. It survives context compression. It survives process restarts.

The increment_from: "args.amount" directive tells the counter to add the actual charge amount, not just count calls. A $50 charge increments by 5000. A $200 charge increments by 20000. The arithmetic is precise because a computer is doing it, not a language model. See How to Add Spending Controls to Any MCP Agent for a full walkthrough of building these policies.

Three Properties of Good Policies

Deterministic policies have three properties that prompt-based rules lack:

1. Verifiability

You can prove a policy does what it claims. Given a policy YAML file, you can enumerate every possible outcome for any tool call. There are no hidden states, no contextual dependencies, no model-specific behaviours.

Intercept's validate command checks policies statically:

intercept validate -c policy.yaml

This catches missing counters, invalid operators, type mismatches, and logical conflicts. You know the policy is correct before deploying it. Try proving the same thing about a system prompt.

2. Auditability

Every policy evaluation produces a deterministic trace. Tool X was called with arguments Y. Rule Z evaluated condition A against value B. Result: allow or deny.

This matters for compliance. When a regulator asks "how do you prevent agents from exceeding spending limits?", you can point to a policy file and its enforcement logs. The policy is the spec. The logs prove enforcement. There's no gap between intent and implementation.

3. Composability

Policies compose cleanly. A single YAML file can combine default-deny, tool hiding, per-tool argument validation, stateful counters, rate limits, and wildcard rules — each constraint independent, composable, and removable without affecting the others. Rules are evaluated independently and ANDed together.

For example, a policy can simultaneously say: deny everything by default, hide destructive tools, allow create_charge with spending limits, allow read_balance unconditionally, and cap total calls at 60 per minute. Each constraint is independent. Adding a new rule doesn't affect existing ones. Removing a rule doesn't break the others.

Try expressing this in a system prompt. It's possible, but the interaction between rules becomes ambiguous. Does "deny everything by default" override "allow create_charge with limits"? The model has to interpret the priority. A policy engine has explicit evaluation order.

The Separation of Concerns

The deeper argument for deterministic policies is about separation of concerns. Language models are good at reasoning, planning, and adapting to context. They're not good at exact arithmetic, precise state tracking, or consistent rule enforcement.

A well-designed agent system gives each component what it's good at:

The model decides which tools to call and what arguments to pass. It interprets user intent, plans multi-step workflows, handles errors gracefully, and communicates results clearly.

The policy engine decides whether each tool call is allowed. It checks arguments against constraints, tracks cumulative state, enforces rate limits, and blocks prohibited operations.

This separation means the model doesn't need perfect safety training to produce a safe system. It just needs to be good enough that it doesn't constantly trigger policy denials. The policies handle the rest.

"But What About Dynamic Policies?"

A common objection: deterministic policies are too rigid. Real-world scenarios need context-sensitive rules. "Allow $5,000 charges on weekdays but not weekends." "Rate limit based on the user's subscription tier." "Block certain tools only during incident response."

Some of this is addressable with static policies. Time-windowed counters already handle temporal patterns. Different policy files can be loaded for different contexts.

But the objection has merit. There's a spectrum between "fully static YAML" and "ask the model." The right answer is probably: static enforcement for safety-critical constraints (spending limits, destructive operation blocks, rate limits), with more flexible mechanisms for context-dependent rules.

The important principle is that the safety floor — the set of constraints that must never be violated — should be deterministic. Everything above the floor can be as dynamic and context-sensitive as needed.

Getting Started

If you're currently relying on prompt guardrails for MCP agent safety, here's a pragmatic migration path:

  1. Audit your system prompt for safety-relevant rules. Anything that says "do not," "never," "must not," or "limit to" is a candidate for a deterministic policy.

  2. Scan your MCP servers to see what tools are exposed:

   intercept scan -o policy.yaml -- npx -y @modelcontextprotocol/server-github

  1. Start with tool hiding and unconditional blocks. Remove tools the agent doesn't need. Block destructive operations. These are zero-risk, high-impact changes.

  2. Add rate limits next. Even conservative limits (50 calls/hour per tool, 200 calls/hour global) prevent the worst runaway scenarios.

  3. Add argument validation last. This requires understanding the tool's parameter schema, but it's where the highest-value constraints live — spending caps, region locks, permission boundaries.

  4. Keep your prompt guardrails. They're still useful as a first line of intent. But don't rely on them as the only line of enforcement.

The gap between "the model will probably follow this rule" and "this rule is enforced at the transport layer" is the gap between hope and engineering. Safety-critical constraints belong on the engineering side. See what happens when they're not.

FAQ

What does "deterministic" mean for AI agent policies?

A deterministic policy produces the same result for the same input, every time. Given a tool call with args.amount = 60000 and a rule that says args.amount <= 50000, the call is denied — no interpretation, no context, no probability. The policy engine evaluates conditions against raw values, not natural language.

Can deterministic policies handle dynamic or context-sensitive rules?

Safety-critical constraints (spending limits, destructive operation blocks, rate limits) should be deterministic. For context-dependent rules — like different limits by time of day or user tier — you can load different policy files for different contexts or use time-windowed counters. The important principle is that the safety floor is always deterministic.

How do deterministic policies work alongside prompt guardrails?

They're complementary. The system prompt sets behavioural intent (the model should respect limits). The deterministic policy enforces hard constraints (the policy will enforce limits). The model handles fuzzy decisions like which tools to call and how to interpret user requests. The policy handles definitive decisions like "is this amount under the cap?"