SASY: Agent Policies in Declarative Logic SASY Labs released SASY, an open-source Apache-2.0 tool that checks every AI agent tool call against policies written in Datalog before the call executes, blocking actions whose history includes both untrusted and sensitive inputs. The SASY SDK records agent reads and outputs and hooks automatically into LangChain, Google ADK and Langroid, while custom agents use sasy.record and sasy.check_tool_call; a companion SASY Guard checks coding-agent tool calls and requires Claude Code v2.1.289 or later for its Claude Code mod. In the documented example, an agent asked to email a summary of a confidential report reads an untrusted note redirecting the summary and follows it, and the policy denies the send because it depends on both the note and the report. OPEN SOURCE · APACHE-2.0 Agent policies in declarative logic, enforced on every action. SASY checks each action an AI agent takes, such as sending an email or running a command, before it happens. You write the policy as rules in Datalog, a declarative logic language. Each decision takes into account everything that led to that action, from what the agent read to the tools it called. Both runs below give an agent the same task: summarize a report and email the summary to reviewer@example.net. In the second run, the agent also reads an untrusted note telling it to send the summary somewhere else. A check before every tool call. Your agent runs as before. The SASY SDK records what it reads and produces, and the SASY engine checks each tool call against your policy and that history before it runs. A denied call does not run, and the agent gets the reason. The SDK hooks into LangChain, Google ADK and Langroid automatically. Custom agents use sasy.record and sasy.check tool call . DocsArchitecture → https://docs.sasy.ai/architecture/ BlogAgentic Security: An Aspect-Oriented Programming Perspective → https://blog.sasy.ai/agentic-security-aop/ Install SASY. Let a coding agent set SASY up for you, or install it by hand in a Python project. The documentation explains how to write policies and add SASY to each framework. WITH A CODING AGENT npx skills add sasy-labs/sasy Then ask your agent to set SASY up in your project. BY HAND uv venv --python 3.11 source .venv/bin/activate uv add sasy sasy engine start In a Python project with uv and Docker installed. See it run. A real run of the message-flow example. An agent is asked to email a reviewer a summary of a confidential report. On the way, it reads an untrusted note telling it to send the summary elsewhere, and follows it. That email depends on both the note and the report, and the policy blocks it. DocsMore examples → https://docs.sasy.ai/examples/ BlogClaude Code has your shell. What's watching it? → https://blog.sasy.ai/claude-code-guard/ SASY Guard for coding agents. SASY Guard brings SASY to the coding agent on your machine. It checks every tool call against a policy and the session's history. Guard blocks things like destructive commands, piping a downloaded script into a shell, or sending data out after reading secrets. The quickest setup: run npx skills add -g sasy-labs/sasy-guard then ask your coding agent to set up SASY Guard. It installs everything and tells you how to test it. The tabs show the same steps by hand. 1. INSTALL THE RUNTIME uv tool install sasy-guard sasy-guard install 2. ADD THE CLAUDE CODE MOD claude plugin marketplace add sasy-labs/sasy-guard claude plugin install sasy-guard-mod Needs Claude Code v2.1.289 or later. The mod shows each decision in the session. 1. INSTALL THE RUNTIME uv tool install sasy-guard sasy-guard install 2. ADD THE PI EXTENSION pi install git:github.com/sasy-labs/sasy-guard 1. INSTALL SASY GUARD uv tool install sasy-guard 2. ADD THE CODEX HOOK sasy-guard enable --codex Then start Codex and trust the hook when it asks. Rules you can read. These rules from the example's policy allow sending, but deny a send whose history includes both the untrusted note and the sensitive report, however many steps came between: DependsOnUntrusted :- CurrentDepends id , ToolResult id, "read document", args , @json get str args, "name" = "external-note". DependsOnSensitive :- CurrentDepends id , ToolResult id, "read document", args , @json get str args, "name" = "sensitive-report". IsAuthorized idx :- Actions idx, a , IsTool a, "send summary" . // @deny message: This summary depends on both untrusted and sensitive documents Unauthorized idx :- Actions idx, a , IsTool a, "send summary" , DependsOnUntrusted , DependsOnSensitive . PaperFormal Policy Enforcement for Real-World Agentic Systems → https://arxiv.org/abs/2602.16708 DocsPolicy language → https://docs.sasy.ai/policy-language/ BlogAgentic Security Policies as Compiled Logic → https://blog.sasy.ai/policies-as-logic-programs/ BlogEvaluating Logic-Based Policies via Fixpoints → https://blog.sasy.ai/policies-as-fixpoints/ Find conflicts before they matter. A policy is a set of logic rules, and SASY can analyze it as a whole. Here, someone adds rule 3 to stop any summary of the sensitive report from going out. That also blocks the ordinary case: a summary sent to the reviewer. The analyzer warns that rule 3 cuts into what rule 1 allows without being marked as an exception, the way rule 2 is with its deny message. It also finds that rule 2 is now redundant. DocsChecking a policy → https://docs.sasy.ai/policy-language/ BlogAgentic Security Policies as Compiled Logic → https://blog.sasy.ai/policies-as-logic-programs/ 1. IsAuthorized idx :- Actions idx, a , IsTool a, "send summary" . 2. // @deny message: This summary // depends on both untrusted // and sensitive documents Unauthorized idx :- Actions idx, a , IsTool a, "send summary" , DependsOnUntrusted , DependsOnSensitive . 3. ADDED LATERUnauthorized idx :- Actions idx, a , IsTool a, "send summary" , DependsOnSensitive . - CONFLICT Rule 3 denies sends that rule 1 allows, and nothing marks it as an intended exception. This is likely unintended. - REDUNDANT Rule 2 is redundant: rule 3 already blocks every send that rule 2 blocks. SASY Features - Policies in logicWrite rules in Datalog, a small logic language. Rules can be recursive: one rule can follow a chain of any length. - A dependency graph, not a logSASY records what each tool call was computed from, through summaries, rewrites and hand-offs between agents. A rule can ask whether an email depends on an untrusted note, however many steps back. - Compiled to native codeWhen you install a policy, SASY compiles the Datalog to native code. Every check then runs compiled code in the policy engine, fast enough to sit in front of each tool call. - Checked before any tool call runsThe check runs outside the LLM, before the tool does anything. A prompt injection cannot argue its way past it. - Deterministic decisionsNo LLM-based decision: the rules decide, and the same history always gets the same result. - Deny with a reason, or askA blocked call comes back with the rule's reason and an optional suggestion. Mark a rule @ask and it pauses the call for a person to approve. - Policy analysisSASY checks a policy as a whole. It finds rules that conflict, rules that add nothing, and the conditions under which each rule fires. - Plain-English helpDescribe a policy and the write-policy skill drafts the Datalog. When a call is blocked, sasy-why-blocked explains why. - Works with your agentLangChain, Google ADK, Langroid, or your own agent loop. SASY Guard brings the same checks to Claude Code. SASY vs LLM Guardrails Deterministic protection instead of prompt-and-pray. These frameworks often ask another LLM whether something looks unsafe, and a well-crafted prompt can fool that LLM. SASY's logic rules make the decision, and no prompt can talk them out of it. | | SASY | Invariant | NeMo Guardrails | Llama | Guardrails AI | |---|---|---|---|---|---| | Decides without an LLM judge | ✓ | Sometimes ML | Often an LLM | Often an LLM | Often an LLM | | Tracks how data flows between tool calls | ✓ | Order only | ✗ | ✗ | ✗ | | Tracks multi-agent handoffs | ✓ | ✗ | ✗ | ✗ | ✗ | | Checks the policy for conflicts | ✓ | ✗ | ✗ | ✗ | ✗ | SASY vs Policy Engines Protection that sees the whole session. Cedar and OPA also use logic rules, but they judge one request at a time, from whatever your code passes in. SASY records the session's history itself and checks every call against it. | | SASY | Cedar | OPA | |---|---|---|---| | Policies are logic rules | ✓ | ✓ | ✓ | | Records the session's history itself | ✓ | ✗ | ✗ | | You can write recursive rules | ✓ | ✗ | ✗ | | Formal policy analysis | ✓ | ✓ | Tests and linting | SASY vs Information-Flow Control A policy you can check before you deploy it. These systems also track where data came from. SASY's policy is logic, which lets SASY find conflicting and redundant rules before they cause trouble.