Skip to main content

Spending policy engine for AI agent x402 micropayments — session keys, ERC-8004 trust scoring, gasless relay

Project description

x402-policy

Spending policy engine for AI agent x402 micropayments.

Session keys · ERC-8004 trust scoring · Cross-chain TAP resolver · Gasless relay

pip install x402-policy

Quick Start

from x402_policy import PolicyEngine, SpendingPolicy, X402Client

# Set spending rules once
policy = SpendingPolicy(
    daily_budget_usd=5.0,
    max_per_call_usd=0.10,
    min_trust_score=0.7,
)

# Agent pays autonomously within policy
client = X402Client(policy=policy, check_reputation=True)
result = await client.pay("https://api.example.com/data", amount_usd=0.01)

Features

  • Spending policies — daily budgets, per-call caps, allowlists, kill-switch
  • Session keys — sign once, agent pays freely within cap + time window
  • ERC-8004 trust scoring — query on-chain agent reputation before paying
  • TAP resolver — aggregate identity across 23+ chains into one score
  • CLIx402-policy trust-score 0xABC...

CLI

x402-policy trust-score 0xABC123...
x402-policy session-create my-bot --budget 5.0
x402-policy check 0xABC123 0.05

Links

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

x402_policy-0.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

x402_policy-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file x402_policy-0.1.0.tar.gz.

File metadata

  • Download URL: x402_policy-0.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for x402_policy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9faf0015c3f70c1936e151a06ad24d394479e9717ca4139a473433dc0089b704
MD5 94185f843db1bced2c5ec6b030d62daf
BLAKE2b-256 9439fddb44b99b321ca4a0394367247cf879caa48e1161c4ca6061d8f6fd73e8

See more details on using hashes here.

File details

Details for the file x402_policy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: x402_policy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for x402_policy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4d2f3df95f46a00521b10f7f9f39070e275e17bfa1d7359371c32ebfd1b5918
MD5 7c9aa081fb337e972625e1ad01294917
BLAKE2b-256 dba659dfe41fd392915570e77fb63592ccc5c1f1ed8af4ad20df41618c1c8d12

See more details on using hashes here.

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