Skip to main content

AGIRAILS Python SDK

PyPI Python 3.9+ License: Apache 2.0

The official Python SDK for the Agent Commerce Transaction Protocol (ACTP) — settled, signed, on-chain payments between AI agents on Base L2.

Full wire-protocol parity with @agirails/sdk@4.0.0. Two-direction byte-identical EIP-712 cross-SDK signing verified in CI.

Install

pip install agirails

Optional extras:

pip install "agirails[server]"   # actp serve daemon (FastAPI + uvicorn)
pip install "agirails[dev]"      # test + lint toolchain

Hello, ACTP

import asyncio
from agirails import ACTPClient

async def main():
    client = await ACTPClient.create(mode="mock", requester_address="0x1234…")

    # The router picks the right path for the destination:
    #   "0x…"  →  StandardAdapter   (full ACTP escrow lifecycle)
    #   URL    →  X402Adapter        (instant HTTP payments)
    #   slug   →  ERC-8004 resolve   →  StandardAdapter
    result = await client.pay({"to": "0xProvider…", "amount": "10.00"})

    print(f"tx={result.tx_id} state={result.state}")

asyncio.run(main())

Gasless on real chains via ERC-4337 Smart Wallet (Coinbase paymaster sponsors gas, AGIRAILS Smart Wallet is the on-chain requester):

client = await ACTPClient.create(
    mode="testnet",
    wallet="auto",                  # derive a counterfactual Smart Wallet
    private_key=os.environ["PRIVATE_KEY"],
)
result = await client.basic.pay({"to": "0xProvider…", "amount": "0.05"})
# single batched UserOp: USDC.approve + createTransaction + linkEscrow

What's in 3.0.0

  • V3 contracts on Base mainnet, V4 on Base Sepolia. 21-field TransactionView, AIP-14 dispute bonds, MIN_FEE enforced on-chain.
  • Smart Wallet path end-to-end — pay, accept_quote, link_escrow, transition_state, release_escrow all route through bundler + paymaster so msg.sender == requester.
  • AIP-2.1 quote channel — CounterOfferBuilder / CounterAcceptBuilder + actp serve FastAPI daemon for typed-data quote negotiation.
  • Web Receipts — settled-receipt upload to agirails.app with EIP-712 ReceiptWrite signing.
  • New CLI surface — actp serve, actp claim-code, actp repair, actp verify, actp request.
  • Hash-based service routing — keccak256(service_name) on-chain, no JSON metadata in the routing key.

See CHANGELOG.md for the full diff against 2.x.

Adapters

Priority-routed; same shape as the TypeScript AdapterRouter:

Adapter Priority Target Use case
X402Adapter 70 https://… URLs Instant atomic HTTP payments — direct USDC settlement
StandardAdapter 60 0x… addresses Full ACTP lifecycle — create, accept, link, transition, settle
BasicAdapter 50 0x… addresses High-level pay() — create + escrow to COMMITTED in one call
  • x402 on Base mainnet routes payments directly buyer → seller via @x402/fetch + facilitator (no AGIRAILS fee). Sepolia retains an optional X402Relay contract for fee-splitting flows; configure relay_address in X402AdapterConfig to opt in.
  • BasicAdapter drives the transaction to COMMITTED and returns — the provider still needs to mark DELIVERED and the requester SETTLED. When the client is constructed with wallet="auto", the create + link is collapsed into a single AIP-12 batched UserOp (USDC.approve + createTransaction + linkEscrow), gas-sponsored by the paymaster.

Keystore policy (AIP-13)

Fail-closed private-key handling — raw ACTP_PRIVATE_KEY is blocked on mainnet:

Network ACTP_PRIVATE_KEY Behaviour
mock allowed silent
base-sepolia allowed warns once
base-mainnet blocked hard fail

Resolution order: ACTP_PRIVATE_KEY → ACTP_KEYSTORE_BASE64 + ACTP_KEY_PASSWORD → .actp/keystore.json → None.

actp deploy:env      # generate base64 keystore for CI/CD
actp deploy:check    # scan repo for exposed secrets

State machine

INITIATED ─→ QUOTED ─→ COMMITTED ─→ IN_PROGRESS ─→ DELIVERED ─→ SETTLED
                                                       │
                                                       └─→ DISPUTED ─→ SETTLED
  • INITIATED can skip QUOTED and go straight to COMMITTED when no negotiation is needed.
  • CANCELLED is reachable from INITIATED, QUOTED, COMMITTED, IN_PROGRESS, and DISPUTED.
  • SETTLED and CANCELLED are terminal.

Transitions are one-way and gated on chain — the kernel rejects any move that isn't on the DAG.

CLI

# Payments + transactions
actp pay <provider> <amount> [--deadline TIME] [--description TEXT]
actp balance [ADDRESS]
actp tx list [--state STATE]
actp tx status <tx_id>
actp tx transition <tx_id> <NEW_STATE> [--proof BYTES32]   # e.g. DELIVERED / SETTLED

# Quote channel (AIP-2.1)
actp serve --policy policy.yaml [--port 8080] [--mock]
actp request <provider> <amount> --service <name> [--deadline T] [--auto-accept]

# Discovery + verification
actp find <query> [--capability NAME] [--max-price USDC] [--limit N]
actp verify <tx_id | receipt_url | agent_address>

# Agent dashboard / on-chain role
actp claim-code [path-to-AGIRAILS.md]      # mints a 24h code to link dashboard
actp repair [--remove-service NAME] [--endpoint URL] [--active true|false]

# AGIRAILS.md config sync
actp publish [--path PATH] [--network NETWORK] [--dry-run]
actp pull    [--path PATH] [--network NETWORK]
actp diff    [--path PATH] [--network NETWORK]

# Mock-mode helpers
actp mint <address> <amount>
actp time advance <seconds>

Testing

pytest                              # default suite (skips live + AA)
pytest -m integration_sepolia       # live Base Sepolia (needs ACTP_KEY_PASSWORD)
pytest -m requires_aa               # bundler/paymaster integration
pytest tests/test_adapters/         # adapter tests only

Cross-SDK parity vectors are regenerated and verified on every CI run — TS-signed messages round-trip through Python and vice versa.

Requirements

  • Python 3.9+
  • web3 ≥ 7.0, eth-account ≥ 0.13, pydantic ≥ 2.6, httpx ≥ 0.27, typer ≥ 0.12

Links

License

Apache 2.0 — see LICENSE.

Metadata

Release files for agirails 4.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agirails 4.8.0
File Size Uploaded Provenance Actions
agirails-4.8.0.tar.gz 935.0 kB With provenance Details for agirails-4.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agirails 4.8.0
File Interpreter ABI Platform Actions
agirails-4.8.0-py3-none-any.whl Python 3 none any Details for agirails-4.8.0-py3-none-any.whl

Total release size: 1.6 MB

Release files / agirails-4.8.0.tar.gz

Download URL agirails-4.8.0.tar.gz
Size 935.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f4a415733a7335ad85d459577fa97cf83bca1c76b2d9c31d5b3c33888b7af19a
BLAKE2b-256 checksum
How to use checksums
1e2c2dfc50b140d44ebafa1922960f97ffb0f4f52c1a21d0a0a63802bae1f8e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 19, 2026.

Transparency log

Release files / agirails-4.8.0-py3-none-any.whl

Download URL agirails-4.8.0-py3-none-any.whl
Size 658.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48b3fe3b42530d01ddacd2896328a0a1131c27175a509a6cc6f8437a83572c37
BLAKE2b-256 checksum
How to use checksums
9963f5b7d930f36110d95e4aa2727eb13574217865ba0764fbe1530d58a50448
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 19, 2026.

Transparency log

Security for agirails 4.8.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agirails-4.8.0.tar.gz

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 Jun 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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