Skip to main content

A warrant daemon for agent actions — earned autonomy with an audit trail.

Project description

warrantd

PyPI version Python versions CI License: MIT

A warrant daemon for agent actions — earned autonomy with an audit trail.

warrantd answers one question for an agent that wants to take an action: ALLOW, REQUIRE_APPROVAL, or BLOCK? — and governs how an action class earns more autonomy over time. It is a standalone, framework-agnostic trust primitive: it knows nothing about Slack, Stripe, OpenAI, Anthropic, FastAPI, or any transport/provider/store. Your app supplies those by implementing three small protocols.

See warrantd-spec.md for the authoritative design.

Install

uv add warrantd        # or: pip install warrantd

Define a policy

from decimal import Decimal
from warrantd import (
    ActionClass, AutonomyState, GraduationThresholds, RiskTier, TrustPolicy,
)

policy = TrustPolicy(
    actions={
        "read_ledger": ActionClass(name="read_ledger", risk=RiskTier.READ),
        "issue_refund": ActionClass(
            name="issue_refund",
            risk=RiskTier.REVERSIBLE_WRITE,
            auto_cap=Decimal("100"),    # auto-approve at/below this
            hard_cap=Decimal("1000"),   # never auto-approve above this
        ),
    },
    thresholds=GraduationThresholds(
        pass_rate={AutonomyState.SUPERVISED: 0.80, AutonomyState.AUTONOMOUS: 0.95},
        adversarial_pass_rate={AutonomyState.SUPERVISED: 0.70, AutonomyState.AUTONOMOUS: 0.90},
        min_samples={AutonomyState.SUPERVISED: 50, AutonomyState.AUTONOMOUS: 200},
    ),
)

Gate an action

Implement MetricsProvider and AuditSink (and optionally ApprovalGate), then call evaluate() before every tool execution and record() after:

from warrantd import ActionRequest, TrustLayer, Verdict

trust = TrustLayer(policy=policy, metrics=my_metrics, audit=my_audit)

decision = trust.evaluate(ActionRequest("issue_refund", tenant_id="acme", value=Decimal("250")))
if decision.verdict is Verdict.ALLOW:
    ...  # execute
elif decision.verdict is Verdict.REQUIRE_APPROVAL:
    ...  # route to your ApprovalGate
else:
    ...  # BLOCK

A runnable end-to-end example with in-memory stubs lives in examples/quickstart.py.

How autonomy is earned

Each action class advances MANUAL → SUPERVISED → AUTONOMOUS only when its eval metrics clear the thresholds for the target state, subject to a per-class policy ceiling (max_state) and a risk ceiling for CONSEQUENTIAL actions. The graduation function is pure and deterministic — no LLM, no randomness — so the same metrics always yield the same allowed state.

Documentation

A comprehensive, self-contained reference lives at docs/warrantd-notebooklm.md. It explains the concepts, the graduation model, the decision flow, the full API, worked examples, a glossary, and an FAQ in prose form — written to be dropped into NotebookLM (or any RAG system) as a single knowledge source.

Development

uv sync --all-extras --dev
uv run ruff check .
uv run mypy --strict warrantd
uv run pytest --cov=warrantd

Releasing

Releases publish to PyPI via OIDC trusted publishing — no API tokens are stored. One-time setup: register the warrantd trusted publisher on PyPI (repo moritzkazooba-wq/warrantd, workflow release.yml, environment pypi). Then:

  1. Bump the version in pyproject.toml and warrantd/__init__.py, update CHANGELOG.md, and tag (vX.Y.Z).
  2. (Optional) Run the release workflow manually with target testpypi to rehearse the upload.
  3. Cut a GitHub Release — the workflow builds, runs twine check, and publishes to PyPI.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

warrantd-0.1.0.tar.gz (72.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

warrantd-0.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file warrantd-0.1.0.tar.gz.

File metadata

  • Download URL: warrantd-0.1.0.tar.gz
  • Upload date:
  • Size: 72.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for warrantd-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b4a336066e25c433359bf0f7a0568b9f40f253fde0f2042a769f460a2b882ed3
MD5 1876cabd6bfec249fc9654099aa72c9a
BLAKE2b-256 f78d27599150eb20ddf9df741f7c02347fa303a2b5ad181b7cc74b4eb1fb0781

See more details on using hashes here.

Provenance

The following attestation bundles were made for warrantd-0.1.0.tar.gz:

Publisher: release.yml on moritzkazooba-wq/warrantd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file warrantd-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: warrantd-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for warrantd-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c755c09978a1269459c62beac97c9c57075b85bb912659184d32d612b1784a0
MD5 27bcffdffda50d847c9de320e64fdc9e
BLAKE2b-256 1b57e8a31d1f74f5e426cbbc1ebe7f26be154340fe2e45c3f6669a3a2b30d2d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for warrantd-0.1.0-py3-none-any.whl:

Publisher: release.yml on moritzkazooba-wq/warrantd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page