AGIRAILS Python SDK - Agent Commerce Transaction Protocol
Project description
AGIRAILS Python SDK
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("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_escrowall route through bundler + paymaster somsg.sender == requester. - AIP-2.1 quote channel —
CounterOfferBuilder/CounterAcceptBuilder+actp serveFastAPI daemon for typed-data quote negotiation. - Web Receipts — settled-receipt upload to
agirails.appwith EIP-712ReceiptWritesigning. - 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 HTTP payments, relay-fee splitting |
| StandardAdapter | 60 | 0x… addresses |
Full ACTP escrow lifecycle |
| BasicAdapter | 50 | 0x… addresses |
Pay-and-forget (batched Smart Wallet) |
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
↘ ↘ ↘
CANCELLED CANCELLED DISPUTED → SETTLED
Transitions are one-way and gated on chain — the kernel rejects any move that isn't on the DAG.
CLI
# Payments + transactions
actp pay <to> <amount> [--deadline TIME]
actp balance [ADDRESS]
actp tx list [--state STATE]
actp tx status <tx_id>
actp tx deliver <tx_id>
actp tx settle <tx_id>
# Quote channel (AIP-2.1)
actp serve --policy policy.yaml [--port 8080]
actp request --service <name> --to <addr> --amount <usdc>
# Verification + repair
actp verify <tx_id|receipt_url>
actp claim-code <code>
actp repair <tx_id>
# AGIRAILS.md config sync
actp publish [path]
actp pull [path] [--network NETWORK]
actp diff [path] [--network NETWORK]
# Mock-mode helpers
actp mint <address> <amount>
actp time advance <duration>
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agirails-3.0.0.tar.gz.
File metadata
- Download URL: agirails-3.0.0.tar.gz
- Upload date:
- Size: 625.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85f18b38469d00a8650c828aa98cbb79287f979942ac90b5463895607f0fdcd6
|
|
| MD5 |
667e97c352aac60d8cca1b4050b2b5d4
|
|
| BLAKE2b-256 |
bfe9a08d9bd04919b543bf055cf9f73656634e8f1a87679be9c58ab3a392c590
|
Provenance
The following attestation bundles were made for agirails-3.0.0.tar.gz:
Publisher:
release-pypi.yml on agirails/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agirails-3.0.0.tar.gz -
Subject digest:
85f18b38469d00a8650c828aa98cbb79287f979942ac90b5463895607f0fdcd6 - Sigstore transparency entry: 1615970944
- Sigstore integration time:
-
Permalink:
agirails/sdk-python@4f12e005a25ced7e011d34300c4957ac2e95052b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/agirails
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@4f12e005a25ced7e011d34300c4957ac2e95052b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file agirails-3.0.0-py3-none-any.whl.
File metadata
- Download URL: agirails-3.0.0-py3-none-any.whl
- Upload date:
- Size: 445.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e48cbbeb4f4f8d3ed4dbea272872ca01a1338e634ac03ad095a5352a42b19dcb
|
|
| MD5 |
14050be29c214c3d9fffea51703a6d85
|
|
| BLAKE2b-256 |
ceee4a99dd6487ebb7a4a6d6a23815b8423475438c69ff0de9c3d108eaada4c5
|
Provenance
The following attestation bundles were made for agirails-3.0.0-py3-none-any.whl:
Publisher:
release-pypi.yml on agirails/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agirails-3.0.0-py3-none-any.whl -
Subject digest:
e48cbbeb4f4f8d3ed4dbea272872ca01a1338e634ac03ad095a5352a42b19dcb - Sigstore transparency entry: 1615970971
- Sigstore integration time:
-
Permalink:
agirails/sdk-python@4f12e005a25ced7e011d34300c4957ac2e95052b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/agirails
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@4f12e005a25ced7e011d34300c4957ac2e95052b -
Trigger Event:
workflow_dispatch
-
Statement type: