Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ARDGuard

PyPI Python compatibility Python License

ARDGuard adds an eligibility boundary between agentic resource discovery and final use.

It consumes ranked discovery results, evaluates independently established task-specific capability, evidence, and authority observations, and selects the highest-ranked eligible resource or returns an explicit defer, abstain, or error decision. It never installs or invokes the selected resource.

Status: 0.1.0b2 Beta 2. The deterministic core and static observation path are supported. The sandboxed PyPI and Sigstore command provider is experimental. See the support matrix before production use.

python -m pip install ardguard==0.1.0b2
ardguard demo
ARDGuard offline demo (illustrative)
rank 1: relevant but capability-ineligible
rank 2: eligible
top-ranked-only validation: ABSTAIN
ARDGuard: SELECT urn:air:example.org:tool:rank-two
reason: selection.fallback_to_lower_ranked_eligible
invocation: NOT PERFORMED

Relevance answers which resource looks useful. Eligibility answers which resource may this agent use for this task.

Put it after discovery

ARD-compatible discovery backend
              |
              v
       ranked candidates
              |
              v
          ARDGuard
  facts + policy + fallback
              |
              v
 SELECT / DEFER / ABSTAIN / ERROR
              |
              v
      caller owns invocation

ARDGuard does not replace ARD, hf-discover, relevance ranking, Sigstore, OAuth, or Kubernetes RBAC. It makes the consumer's final eligibility decision explicit.

JSON in, decision JSON out

Prepare a task contract, policy, and observations, then evaluate any supported ARD SearchResponse:

hf-discover search "read customer records" --json > discovery.json

ardguard evaluate \
  --adapter hf-discover \
  --discovery-response discovery.json \
  --task task.json \
  --policy policy.json \
  --facts facts.json \
  --output decision.json

ardguard explain decision.json

Example decision:

{
  "outcome": "SELECT",
  "reason": "selection.fallback_to_lower_ranked_eligible",
  "selected_candidate_id": "urn:air:example.org:tool:rank-two",
  "selected_rank": 2
}

The actual decision document also contains every candidate verdict, stable reason codes, provider identities, preserved backend scores, and a deterministic body hash.

Python integration

from ardguard import FactSet, Policy, TaskContract, evaluate
from ardguard.adapters import parse_search_response

candidates = parse_search_response(discovery_response)
decision = evaluate(
    candidates=candidates,
    task=TaskContract.from_mapping(task_document),
    policy=Policy.from_mapping(policy_document),
    facts=FactSet.from_mapping(fact_document),
)

if decision.outcome.value == "SELECT":
    # The caller may now decide whether and how to invoke the resource.
    print(decision.selected_candidate_id)

Why fallback matters

A top-ranked-only validator can reject an ineligible first result, but it also abandons the task when a lower-ranked candidate is eligible. ARDGuard evaluates the configured candidate set, preserves the backend's rank among eligible candidates, and returns the highest-ranked eligible candidate. It does not manufacture or reinterpret relevance scores.

Contracts, not self-asserted eligibility

Public callers supply observations, not eligible: true. ARDGuard derives candidate verdicts from versioned contracts:

  • TaskContract states required operations, evidence, and authority limits.
  • FactSet binds typed observations to candidate and provider identities.
  • Policy controls required checks, uncertainty, and fallback.
  • Decision reports SELECT, DEFER, ABSTAIN, or ERROR with stable reasons.

Missing facts, unavailable verifiers, and operational errors fail closed. An operational verifier failure is never reported as an invalid signature. Authentic evidence for artifact A never makes candidate B eligible.

Commands

Command Purpose
ardguard demo Run the deterministic offline fallback example.
ardguard doctor Report package, schema, adapter, and provider readiness.
ardguard validate Validate task, fact, policy, decision, ARD, or hf-discover JSON.
ardguard evaluate Produce a deterministic decision without invocation.
ardguard explain Validate the decision hash and explain its reason.
ardguard support Print the tested support matrix.
ardguard adapters Print exact adapter compatibility records.

Documentation

Examples

Development

python3.12 -m venv .venv
.venv/bin/pip install -e '.[dev]'
.venv/bin/pytest
.venv/bin/ruff check .
.venv/bin/mypy src/ardguard

Small compatibility fixtures, provider implementations, reason-code improvements, and reproducible interoperability reports are welcome. Read CONTRIBUTING.md and SECURITY.md first.

License

Apache License 2.0. See LICENSE and NOTICE.

Release files for ardguard 0.1.0b2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ardguard 0.1.0b2
File Size Uploaded
ardguard-0.1.0b2.tar.gz 40.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ardguard 0.1.0b2
File Interpreter ABI Platform
ardguard-0.1.0b2-py3-none-any.whl Python 3 none any Details

Total release size: 77.8 kB

Release files / ardguard-0.1.0b2.tar.gz

Download URL ardguard-0.1.0b2.tar.gz
Size 40.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dbe972f041b25a34036f95c24c088a047354e0719ef4870ed8bf90360626f2f3
BLAKE2b-256 checksum
How to use checksums
9448d30289ad220a1b702a05daedb0addb4f22a8d9646c32b80572e7b730f2a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.

Transparency log

Release files / ardguard-0.1.0b2-py3-none-any.whl

Download URL ardguard-0.1.0b2-py3-none-any.whl
Size 37.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a313fe0c9c6e99ae171c8cfae8fa59d62b345a7a2a7416915ccca28bc7ede55a
BLAKE2b-256 checksum
How to use checksums
55ec788396ad1f1c186b8fc0234703cd4fba232fc47b2de8d956161cdb4780fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page