Skip to main content

Policy evaluation helpers for the ARP Standard.

Project description

arp-policy

A minimal policy evaluator for the ARP Tool Registry.

Policy format

Top-level keys:

  • Version: optional version string.
  • Statement: list of statements.

Statement keys:

  • Sid: optional statement id for audit/debug.
  • Effect: Allow or Deny.
  • Action: string or list of strings.
  • Resource: string or list of strings.
  • Condition: optional map of operator to key/value map.

Supported condition operators:

  • StringEquals
  • StringLike (wildcards with *)

Usage

from arp_policy import Enforcer, Policy, emit_decision

policy = Policy.load("./config/policy/policy.dev.json")
enforcer = Enforcer(policy)

context = {
    "principal": "user:alice",
    "tenant": "acme",
    "environment": "dev",
    "request_id": "req-123",
}

decision = enforcer.authorize("tool:Invoke", "tool:finance/pay", context)
if not decision.allowed:
    raise Exception("policy denied")

# Audit event
record = emit_decision(
    decision,
    context,
    action="tool:Invoke",
    resource="tool:finance/pay",
    policy_hash=policy.policy_hash,
)

Auth and identity

arp-policy is auth-agnostic. It does not validate credentials or issue identities.

The host service (Tool Registry, Runtime, Daemon) must:

  • authenticate the caller using your chosen scheme (JWT, mTLS, API key, etc.)
  • map verified identity attributes into the context dict (e.g., principal, tenant)
  • avoid passing raw credentials into policy context

Tool discovery filtering

tools = [{"tool_id": "finance.pay", "metadata": {"labels": {"tier": "gold"}}}]
allowed = enforcer.filter_tools(tools, context)

Context keys

Typical keys used in policy conditions:

  • principal
  • tenant
  • environment
  • request_id
  • tool.id
  • tool.tags (tool labels/annotations)

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

arp_policy-0.1.1.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

arp_policy-0.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file arp_policy-0.1.1.tar.gz.

File metadata

  • Download URL: arp_policy-0.1.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arp_policy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 87a2f5a75b9b6fc9ea53558d0872744c55ece2369aac6bffe45e5cd6d0725c0d
MD5 7bffef0f54c6111a66eca5d73a0e1670
BLAKE2b-256 15edf4152af4b776ceea940f989d05c5ee7f5ed1c2c6b31c0702aa96574e8284

See more details on using hashes here.

Provenance

The following attestation bundles were made for arp_policy-0.1.1.tar.gz:

Publisher: release.yml on AgentRuntimeProtocol/ARP_Policy

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

File details

Details for the file arp_policy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: arp_policy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arp_policy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 003f3a732418cd1f1fd8de8f1b6e2d4acb8e656abaebe49892eab7da4f4c777c
MD5 bb71edd9471b6083142d4101ff5e4b67
BLAKE2b-256 5db17cd8cd80a88a7d5ca437b83dd5d8cc4ee2e418eecff734df4c723caa015a

See more details on using hashes here.

Provenance

The following attestation bundles were made for arp_policy-0.1.1-py3-none-any.whl:

Publisher: release.yml on AgentRuntimeProtocol/ARP_Policy

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