Skip to main content
Pre-release

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

ARDGuard

PyPI DOI 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.0b4 Beta 3 patch release. The deterministic v1 path remains supported. The extensible v2 kernel and its protocol packs are experimental. See the support matrix before production use.

python -m pip install ardguard==0.1.0b4
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.
ardguard providers list Describe provider and policy-pack extension boundaries.
ardguard serve Run the experimental loopback-only JSON decision service.

Extensible kernel

Beta 3 includes an experimental v2 kernel for third-party fact types, typed requirements, decision receipts, stdin/stdout integration, and a loopback HTTP API. Beta 2 v1 contracts remain unchanged. Start with the existing commands above; advanced integrators can read the extensibility guide and eligibility-pack matrix.

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.0b4

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.0b4
File Size Uploaded
ardguard-0.1.0b4.tar.gz 71.1 kB Details

Built distribution (wheel)

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

Total release size: 141.7 kB

Release files / ardguard-0.1.0b4.tar.gz

Download URL ardguard-0.1.0b4.tar.gz
Size 71.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8cbfca4efd6b6eff255075be2ea2a1eb56b915c041aca4b5247c1453981de7e2
BLAKE2b-256 checksum
How to use checksums
c9fc3cfee1430dbf3a4e42e5496c8be93bb8b39ec6bd3657defa48b28a2c8afa
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.0b4-py3-none-any.whl

Download URL ardguard-0.1.0b4-py3-none-any.whl
Size 70.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9766d5f1396385f1b119a4a8fe5f313a2a12d457208b9bf8d8309bd1c94a81e2
BLAKE2b-256 checksum
How to use checksums
de3dcbcbda61a32ca3614bcee720ca61646f21b19f61506a9b613fe32c7208d0
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