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.2.tar.gz (10.2 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.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: arp_policy-0.1.2.tar.gz
  • Upload date:
  • Size: 10.2 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.2.tar.gz
Algorithm Hash digest
SHA256 09ca84cfc54be14b12ea0c49b3622b2d75e678ad92f0fc511a94cf3f5f700e68
MD5 8a8cdf890f7e955aebf027aa61c75be2
BLAKE2b-256 6dcbfeacc463cf1758424c09876fb1cecfb497869f17623b5812befc3aae62ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for arp_policy-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: arp_policy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 49a153edd06dcbf26ac20c520c4d9eb0f9fb3d04185ce3bc19c61fbcfab4bed4
MD5 a3d298e2ee7fb45cdc72ff552175a130
BLAKE2b-256 9fa686e807a21e49f39e3c5713486f64c099d94d08346e5df4b6405f5592a49b

See more details on using hashes here.

Provenance

The following attestation bundles were made for arp_policy-0.1.2-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