--- title: Agent Security Contract emoji: 📜 colorFrom: yellow colorTo: green sdk: static pinned: false license: apache-2.0 short_description: Fail-closed agent tool-call gate, runs in your browser tags: - ai-security - agents - policy-engine - owasp --- # Agent Security Contract — policy engine demo This is a **policy engine demo**, not a trained model. It runs the open-source [Agent Security Contract](https://github.com/justrunme/agent-security-contract) evaluator (release **v0.2.1**, commit `768853bde5a56fcc6c9b486f52848761db1b0ef1`) against the project's own demo policy and corpus traces. No model is loaded, and no tool is executed. **This page runs entirely in your browser.** After the first load, traces and policies you enter are evaluated locally by the bundled library and are not sent to a server. The page loads the [Pyodide 0.29.5](https://cdn.jsdelivr.net/pyodide/v0.29.5/full/) runtime and its built-in PyYAML package from that pinned CDN; the ASC wheel, demo policy, and corpus are bundled in this Space. Pyodide 0.29.5 states a minimum of Safari 16.4 (27 March 2023). On an older browser the live engine does not start, and the page shows precomputed official-corpus results instead of a raw runtime error. Open the page on a current desktop browser to evaluate a custom trace yourself. ASC is a deny-by-default, pre-execution gate for agent and MCP tool calls. A YAML capability contract is pinned by SHA-256 catalog digest. Each proposed tool-call trace is evaluated before anything would run, and the library returns one of three verdicts: - `ALLOW` - `BLOCK` - `REQUIRE_APPROVAL` Those map to OWASP Agent Control Standard dispositions `ALLOW` / `DENY` / `ASK`. Malformed policy, malformed trace, digest mismatch, unknown tool, or evaluator error all resolve to `BLOCK` (fail-closed). Every decision emits an integrity-checked JSON **evidence envelope** (`policy_sha256`, `trace_id`, `commit_sha`, `envelope_sha256`). The digest is unkeyed: it is hash-checked, not signed. The page is styled as an audit certificate. Above the interactive decision, an **Audit at a glance** section shows the official corpus run as a verdict ledger (expected vs actual, one stamp per scenario), a severity breakdown, the attack classes, and the contract clauses that decided each attack. All of it is drawn from the bundled precomputed v0.2.1 corpus run (`data/insights.json` is derived from `data/precomputed.json`). The demo opens on an official corpus case, with a color-coded verdict, the tool-call sequence, and the evidence envelope. You can browse the official v0.2.1 corpus (66 scenarios: 33 attack, 33 benign) in the gallery, run all 66 scenarios in the browser, or paste a custom trace and policy under Advanced. A tamper control edits one envelope field and calls `verify_envelope` so you can see the library reject a hash mismatch. License: Apache-2.0 (see `LICENSE` and `NOTICE`). ## Links - Research preprint: [Fail-Closed Authorization for Tool-Using AI Agents](https://justrunme.com/research/fail-closed-authorization-ai-agents/) - Case write-up: [Agent Security Contract](https://justrunme.com/cases/agent-security-contract/) - Source: [github.com/justrunme/agent-security-contract](https://github.com/justrunme/agent-security-contract) - Zenodo DOI: [10.5281/zenodo.24075886](https://doi.org/10.5281/zenodo.24075886) - Author ORCID: [0009-0004-7583-4314](https://orcid.org/0009-0004-7583-4314) - Related work by the same author, Airlock (in-browser policy-gate demo): [justrunme/airlock](https://huggingface.co/spaces/justrunme/airlock) - Airlock corpus: [justrunme/airlock-agent-security-corpus](https://huggingface.co/datasets/justrunme/airlock-agent-security-corpus) - Collection: [Agent security: fail-closed authorization](https://huggingface.co/collections/justrunme/agent-security-fail-closed-authorization-6b01b4fdba60e6db8d51009c) - Book: [Prove It Before Production](https://justrunme.com/book/) Claims about corpus results belong to that release and that corpus only. This demo does not restate or extend them.