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.0b3 Beta 3. 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.0b3
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.0b3

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

Built distribution (wheel)

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

Total release size: 141.3 kB

Release files / ardguard-0.1.0b3.tar.gz

Download URL ardguard-0.1.0b3.tar.gz
Size 70.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bf53cca260b4c1dda5935058e7ff91f5bf62bed1ad4907a4ab0b73e7b119f296
BLAKE2b-256 checksum
How to use checksums
d0718307d183939ccec187966c1b09ffc632c25d12831ff4861bd2cde034527c
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.0b3-py3-none-any.whl

Download URL ardguard-0.1.0b3-py3-none-any.whl
Size 70.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5bd2ff692263006002d62e342e6a06f203995f925b78000edabc0b5801260d6a
BLAKE2b-256 checksum
How to use checksums
90bb45bb3746ce917fe43067fd4c22b843d5ed3203beff9614500739edfd2b54
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