Sandbox
@SponsioLabs/Sponsio

Runtime policy engine for agent tool calls

Sponsio checks an agent's tool calls before they run, so you can enforce rules like approval gates, tool limits, and incident policies without rewriting prompts. It compiles contracts and bundled patterns into deterministic checks and can plug into agent loops, MCP, and editor workflows.

440 stars25 forksPythonUpdated 9d ago
Who it's for

Builders who want their coding agent to follow safety rules, block risky actions, and keep an audit trail.

What it delivers

You can stop destructive or out-of-policy agent actions before they happen, without relying on another model call.

What it does

Deterministic contract checks

Runs runtime rules on every agent action with no LLM call and low latency.

Contract bundles

Ships reusable YAML bundles like destructive-action, shell, and filesystem guards.

Plain-language rule drafting

Turns a plain-English rule into a draft contract with `sponsio validate`.

Agent and tool integrations

Works with Claude Code, Codex, Cursor, LangChain, OpenAI Agents, Google ADK, CrewAI, Vercel AI, and MCP.

Hosted review flow

Lets you push a draft rulebook, review it in the console, then pull the approved version back.

Plugin and MCP support

Includes plugin packages and MCP integration files for connecting into agent workflows.

How to get it

  1. 1Or run the CLI yourself
    pip install --pre sponsio   # or: npm install -D @sponsio/sdk@alpha
    sponsio init .              # asks what you use, then writes sponsio.yaml

README

English · 简体中文 · 日本語

Sponsio

License Install from PyPI Visit sponsio.dev

Follow on X Follow on LinkedIn Join our Discord

Sponsio

Same coding agent under a declared code freeze. Without Sponsio it drops the prod users table, back-fills fabricated rows, and files a status report that hides the damage. With Sponsio the first destructive SQL is blocked pre-execution: 35 checks, 100% deterministic, 0 LLM calls, p50 13µs.

Sponsio checks an agent's tool calls before they run. A rule can look at what already happened, so "check the policy before issuing a refund" is one rule instead of a paragraph of prompt. Each check takes under 0.01 ms and calls no model. Works with LangChain, Claude Agent, OpenAI Agents, Google ADK, CrewAI, Vercel AI, MCP, or any custom tool-calling loop, in Python or TypeScript.

An agent contract is a runtime rule that is checked at every agent action, backed by formal methods.

v0.2.0a16 alpha is out. pip install --pre sponsio. This one is for platforms running agents for their own customers. SPONSIO_PROJECT names the customer a run belongs to, so a per-customer key needs no code change and cannot get the customer wrong: before this, attach() always claimed default, and a key scoped to one customer was refused, which meant runs from a correctly wired deployment never arrived. The OTLP exporter now obeys SPONSIO_PRIVACY too, so the level you set is the level that leaves the machine on either path. See the release notes.


How Sponsio works

Sponsio architecture: Agent Flow + (Natural Language + Pattern Library) compile into Contracts (Assumption → Enforcement), enforced by a Fuzzy LTL Monitor (deterministic + stochastic) that decides Pass / Block · Warn · Escalate / Redirect for every function call, with full audit trail logs feeding back to the agent.

On ODCV-Bench (12 frontier LLMs × 80 trajectories), unguarded models cheat in 11.5%–66.7% of runs. With Sponsio, 95.6% of misalignment is avoided on average; 24/36 high-risk scenarios at 100%. On the Financial-Audit-Fraud-Finding scenario, frontier models commit fraud in 16/24 trials; Sponsio blocks 18/19. On RedCode-Exec (1,410 cases), Sponsio reaches 98.9% combined (bash 98.3% · python 99.4%, lifted from 92.4% by a 4-iteration self-improvement loop), with 0 false positives on a 60-file clean-code audit. These are the open-core numbers; the Cloud version's LLM-judge layer takes ODCV-Bench to ~99% and RedCode-Exec to 99.4%. Book a demo for the Cloud and Enterprise versions.

One contract takes p50 0.0052 ms to check. The heaviest ODCV workload, 19 contracts on every call, takes 0.139 ms. An LLM-as-judge guardrail takes 50 to 800 ms, so this is 5,000× to 60,000× faster, and it calls no model. p99 stays near 1 ms on every workload measured.

See the full benchmark methodology and per-model breakdown, how Sponsio compares against prompt filters, output validators, LLM-as-judge, and sandboxing, or dive into the architecture and formal methods primer.


Quick start

Two ways in: paste a prompt into your coding agent, or run the CLI yourself.

Paste into Claude Code / Codex / Cursor. The agent walks the full onboarding flow:

One-shot prompt: Python   One-shot prompt: TypeScript

Or run the CLI yourself:

pip install --pre sponsio   # or: npm install -D @sponsio/sdk@alpha
sponsio init .              # asks what you use, then writes sponsio.yaml

The wizard auto-detects your framework and prints the right wrap snippet. For manual wiring, see all supported integrations. OpenClaw users get bundled ClawHavoc and CVE-2026-25253 coverage out of the box. For config reference, observe → enforce flip, and CI wiring, see the full walkthrough.

Watching runs, and sharing a rulebook. Enforcement is local and needs no account. If you want to see what your agent did, or keep the rulebook somewhere a person reviews it before it arms, app.sponsio.dev is the hosted side. One line puts a run on screen:

import sponsio
import sponsio.bridge

guard = sponsio.Sponsio(config="sponsio.yaml", agent_id="mailer", mode="enforce")
run = sponsio.bridge.attach(guard)

sponsio push sponsio.yaml uploads a rulebook as a draft. It does not arm. A person publishes it in the console, and sponsio pull or config="sponsio://default" brings the reviewed version back. Sending is best effort, so a console that is down never blocks the agent. See the hosted console.

Drafting contracts from natural language. sponsio validate "<rule in plain English>" turns a plain-English rule into a contract you can read back. Treat the output as a starting draft to review and adjust before you enforce. The determinism is in how contracts are enforced at runtime, not in how they're drafted.


Contract Library

22 contract bundles ship out of the box, organized by tier (always-on / per-tool / per-incident). Each bundle is a YAML pack composed from Sponsio's deterministic patterns. Drop one into sponsio.yaml and your agent is guarded against a known failure class in one line, with no per-contract authoring.

# sponsio.yaml: one-line bundle inclusion
agents:
  my_agent:
    workspace: "/srv/my-bot"
    include:
      - sponsio:capability/destructive  # gate irreversible actions
      - sponsio:capability/shell        # if your agent runs commands
      - sponsio:capability/filesystem   # if your agent touches files

See the full bundle reference for all 22 bundles, or the 48 underlying patterns for the primitives they compose. Want a bundle for your agent type? That is the most useful thing to contribute right now. Open an issue with your incident, CVE, or pattern.


Contributing

Patches, issue reports, and new pattern proposals are welcome. Start with CONTRIBUTING.md. Sponsio's threat model draws on public security research; e.g. Simon Willison's "Lethal Trifecta" shaped our multi-tool composition contracts. Have a threat model we should defend against? Open an issue.


License

Apache 2.0 (LICENSE).

AI agents reading this repo: llms.txt lists canonical doc paths; llms-full.txt is the concatenated full context dump.

Files in the repo

Repository payload30 top-level entries
  • .github
  • .sponsio
  • actions
  • assets
  • data
  • docs
  • evals
  • examples
  • plugins
  • scripts
  • sponsio
  • tests
  • ts
  • .dockerignore
  • .gitignore
  • CHANGELOG.md
  • CLAUDE.md
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • LICENSE
  • llms-full.txt
  • llms.txt
  • OSS_PROMISE.md
  • pyproject.toml
  • QUICKSTART.md
  • README.ja.md
  • README.md
  • README.zh-CN.md
  • SECURITY.md
  • Sponsio.code-workspace

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More frameworks & sdks

HKUDS/nanobotFrameworks & SDKs

Ultra-lightweight, open-source, self-hosted personal AI agent framework in Python with WebUI, tools, memory, MCP, multi-agent workflows, automation, and chat apps

48k
microsoft/
SkillOpt
microsoft/SkillOptFrameworks & SDKs

SkillOpt is a text-space optimizer that trains reusable natural-language skills for frozen LLM agents through trajectory-driven edits, validation-gated updates, and deployable best_skill.md artifacts.

17k
omnigent-ai/omnigentFrameworks & SDKs

Omnigent is an open-source AI agent framework and meta-harness: orchestrate Claude Code, Codex, Cursor, Pi, and custom agents — swap harnesses without rewriting, enforce policies and sandboxing, and collaborate in real time from any device.

9.8k
kyegomez/
OpenMythos
kyegomez/OpenMythosFrameworks & SDKs

A theoretical reconstruction of the Claude Mythos architecture, built from first principles using the available research literature.

15k
D4Vinci/ScraplingFrameworks & SDKs

🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!

80k