Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f8c4b12
feat(dispute): AIP-14b dispute client surface (Python SDK) — M1.5 + M…
DamirAGI Jun 22, 2026
5e1b927
chore(abi): re-vendor BondEscalation ABI for dispute-audit surface
DamirAGI Jun 22, 2026
00d04b4
chore(abi): re-vendor BondEscalation ABI for prompt-CID governance
DamirAGI Jun 25, 2026
bba4d41
feat(py): 4.9.0 parity bump — F-6 surface + new Sepolia addresses (TS…
DamirAGI Jun 25, 2026
aa43345
fix(py): F-5 pre-escrow price-band guard + version metadata (4.9.0 pa…
DamirAGI Jun 25, 2026
e40123e
test(py): direct F-6 helper + SDK-2 escrow_id tests; close audit notes
DamirAGI Jun 25, 2026
7df3ba1
feat(py): AgentRegistry.connect read-only factory + wire F-5 into neg…
DamirAGI Jun 25, 2026
17087e5
test(py): read-only AgentRegistry.connect factory (F-5 wiring)
DamirAGI Jun 25, 2026
d4af7d7
fix(py): F-5 second check — re-band final negotiated amount in _commi…
DamirAGI Jun 26, 2026
8ef6d24
fix: F-5 quote_initial_bond clamps to MAX_ESCALATION_BOND ($500)
DamirAGI Jul 3, 2026
50250b0
feat: base-sepolia dispute addresses (bond_escalation + composite_med…
DamirAGI Jul 3, 2026
f4be3ca
feat: AIP-14c v2 parity — 9-field AIRuling, 64-byte delivery proof, 5…
DamirAGI Jul 13, 2026
97b517f
config: Base Sepolia → AIP-14c kernel-v2 + D7 dispute stack (2026-07-13)
DamirAGI Jul 13, 2026
e01e635
feat: Python EvidenceArtifactV2 (Schema-2.0.0) serializer — byte-iden…
DamirAGI Jul 16, 2026
fd06335
fix(disputes): align testnet payments and async event clients
DamirAGI Nov 7, 2026
cc08626
merge: preserve upstream main fixes in reviewed testnet integration
DamirAGI Nov 7, 2026
f800877
test: vendor exact shared dispute fixtures for standalone CI
DamirAGI Nov 7, 2026
6ac2bbe
fix(ci): preserve Python 3.9 matrix on supported Ubuntu runner
DamirAGI Nov 7, 2026
7279106
fix(ci): declare read-only workflow token permissions
DamirAGI Nov 7, 2026
1342dc3
test(cli): isolate publish dry-run from live slug service
DamirAGI Nov 7, 2026
2a6a3ee
test(cli): isolate messaging tests and preserve benchmark token scope
DamirAGI Nov 7, 2026
a635f24
test(protocol): construct async event providers within an event loop
DamirAGI Nov 7, 2026
a426c56
fix: verify Python operator exits, proofs and async registry writes
DamirAGI Nov 7, 2026
c8e748b
fix: require patched cryptography with Python 3.9 compatibility
DamirAGI Nov 7, 2026
a978128
fix: distinguish legacy and canonical delivery signature schemas
DamirAGI Nov 7, 2026
6ccff70
fix: resolve providers through directory and verify failure recovery
DamirAGI Nov 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ on:
# `if: github.event_name == ...` guards on each job.
- cron: '0 3 * * 1'

permissions:
contents: read

env:
PYTHON_VERSION: '3.11'
COVERAGE_THRESHOLD: 85
Expand All @@ -32,7 +35,7 @@ jobs:
# =============================================================================
test-fast:
name: Unit Tests
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 10

strategy:
Expand Down Expand Up @@ -296,6 +299,8 @@ jobs:
# =============================================================================
test-benchmarks:
name: Performance Benchmarks
permissions:
contents: write
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to AGIRAILS Python SDK will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Resolve omitted providers through the actual local service-directory API,
rejecting missing provider addresses before funding a request.
- Verify both legacy and AIP-4 delivery signatures without their shared type name
selecting the wrong schema; reject ambiguous or incomplete delivery payloads.
- Require patched `cryptography` 50.x while retaining Python 3.9 support.
- Preserve successful `actp watch` exit codes instead of reporting them as errors.
- Forward the `actp tx transition --proof` value to the runtime.
- Await asynchronous AgentRegistry transaction construction before signing.
- Restrict the standard-library HTTP fallback to HTTP(S), including redirects,
while preserving fractional request timeouts.

## [4.8.0] — 2026-06-19

> **Full 1:1 parity with `@agirails/sdk` (TypeScript) 4.8.0.** The Python SDK
Expand Down
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "agirails"
version = "4.8.0"
version = "4.9.0"
description = "AGIRAILS Python SDK - Agent Commerce Transaction Protocol"
readme = "README.md"
license = "Apache-2.0"
Expand Down Expand Up @@ -48,7 +48,7 @@ dependencies = [
"eth-hash[pycryptodome]>=0.7.0,<1.0.0",
# AIP-16 delivery channel crypto: X25519 ECDH, HKDF-SHA256, AES-256-GCM
# (byte-exact parity with the TS delivery surface). pyca/cryptography.
"cryptography>=46.0.7,<49.0.0",
"cryptography>=50.0.0,<51.0.0",
"pydantic>=2.6.0,<3.0.0",
"python-dateutil>=2.8.0,<3.0.0",
"httpx>=0.27.0,<1.0.0",
Expand All @@ -58,6 +58,11 @@ dependencies = [
"pyyaml>=6.0,<7.0",
# CLI .env auto-load (AIP-18 §4.6.2) — parity with the TS CLI dotenv load.
"python-dotenv>=1.0.0,<2.0.0",
# Evidence-bundle token cap (DISPUTE SYSTEM schema §4 / OQ-9). The cap is
# enforced over the canonical bytes with the cl100k_base tokenizer and MUST
# never be silently skipped, so the tokenizer is a core runtime dep (parity
# with the TS SDK's js-tiktoken dependency).
"tiktoken>=0.7.0,<1.0.0",
"typing_extensions>=4.0.0,<5.0.0;python_version<'3.10'",
]

Expand Down
51 changes: 51 additions & 0 deletions src/agirails/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,419 +34,446 @@
- `storage`: Hybrid storage layer (AIP-7 §4) - IPFS (Filebase) + Arweave (Irys)
"""

from agirails.version import __version__, __version_info__

# Client
from agirails.client import (
ACTPClient,
ACTPClientConfig,
ACTPClientInfo,
ACTPClientMode,
)

# Adapters
from agirails.adapters import (
BaseAdapter,
BasicAdapter,
BasicPayParams,
BasicPayResult,
CheckStatusResult,
StandardAdapter,
StandardTransactionParams,
TransactionDetails,
TransactionStatus,
X402Adapter,
DEFAULT_DEADLINE_SECONDS,
DEFAULT_DISPUTE_WINDOW_SECONDS,
MIN_AMOUNT_WEI,
MAX_DEADLINE_HOURS,
MAX_DEADLINE_DAYS,
)

# Wallet providers (Tier 1 = AA gasless, Tier 2 = EOA)
from agirails.wallet import (
AutoWalletProvider,
EOAWalletProvider,
IWalletProvider,
WalletTier,
WalletInfo,
)

# ERC-8004 identity + reputation
from agirails.erc8004 import (
ERC8004Bridge,
ReputationReporter,
)

# Service discovery (agirails.app API)
from agirails.api import discover_agents

# Transaction ID computation (canonical hash used by Smart Wallet
# routing + AIP-2 quote anchoring)
from agirails.wallet.aa.transaction_batcher import compute_transaction_id

# Runtime Layer
from agirails.runtime import (
# Types
State,
TransactionStateValue,
MockTransaction,
MockEscrow,
MockAccount,
MockBlockchain,
MockEvent,
MockState,
STATE_TRANSITIONS,
is_valid_transition,
is_terminal_state,
MOCK_STATE_DEFAULTS,
# Interfaces
CreateTransactionParams,
TimeInterface,
IACTPRuntime,
IMockRuntime,
is_mock_runtime,
# Implementations
MockStateManager,
MockRuntime,
)

# Errors
from agirails.errors import (
ACTPError,
TransactionNotFoundError,
InvalidStateTransitionError,
EscrowNotFoundError,
DeadlinePassedError,
DeadlineExpiredError,
DisputeWindowActiveError,
ContractPausedError,
InsufficientBalanceError,
ValidationError,
InvalidAddressError,
InvalidAmountError,
NetworkError,
TransactionRevertedError,
SignatureVerificationError,
StorageError,
InvalidCIDError,
UploadTimeoutError,
DownloadTimeoutError,
FileSizeLimitExceededError,
StorageAuthenticationError,
StorageRateLimitError,
ContentNotFoundError,
NoProviderFoundError,
ACTPTimeoutError,
ProviderRejectedError,
DeliveryFailedError,
DisputeRaisedError,
ServiceConfigError,
AgentLifecycleError,
QueryCapExceededError,
MockStateCorruptedError,
MockStateVersionError,
MockStateLockError,
)

# Utilities - Security
from agirails.utils import (
timing_safe_equal,
validate_path,
validate_service_name,
is_valid_address,
safe_json_parse,
LRUCache,
Logger,
Semaphore,
RateLimiter,
# PARITY: SecureNonce
generate_secure_nonce,
is_valid_nonce,
generate_secure_nonces,
# PARITY: UsedAttestationTracker
IUsedAttestationTracker,
InMemoryUsedAttestationTracker,
FileBasedUsedAttestationTracker,
create_used_attestation_tracker,
# PARITY: ReceivedNonceTracker
NonceValidationResult,
IReceivedNonceTracker,
InMemoryReceivedNonceTracker,
SetBasedReceivedNonceTracker,
create_received_nonce_tracker,
)

# Utilities - Helpers
from agirails.utils.helpers import (
USDC,
Deadline,
Address,
Bytes32,
StateHelper,
DisputeWindow,
ServiceHash,
ServiceMetadata,
parse_usdc,
format_usdc,
shorten_address,
hash_service_metadata,
)

# Utilities - Validation
from agirails.utils.validation import (
validate_address,
validate_amount,
validate_deadline,
validate_tx_id,
validate_endpoint_url,
validate_dispute_window,
validate_bytes32,
)

# Utilities - Canonical JSON
from agirails.utils.canonical_json import (
canonical_json_dumps,
compute_type_hash,
hash_struct,
compute_domain_separator,
)

# Level 0 API - Low-level primitives
from agirails.level0 import (
ServiceDirectory,
ServiceEntry,
ServiceQuery,
Provider,
ProviderConfig,
ProviderStatus,
provide,
ProvideOptions,
request,
RequestOptions,
RequestResult,
)

# Level 1 API - Agent abstraction
from agirails.level1 import (
Agent,
AgentConfig,
AgentBehavior,
AgentStatus,
AgentStats,
AgentBalance,
Job,
JobContext,
JobHandler,
JobResult,
ServiceConfig,
ServiceFilter,
RetryConfig,
PricingStrategy,
CostModel,
PriceCalculation,
calculate_price,
)

# Types
from agirails.types import (
AgentDID,
DIDDocument,
Transaction,
TransactionState,
TransactionReceipt,
TransactionFilter,
EIP712Domain,
ServiceRequest,
ServiceResponse,
DeliveryProof,
DeliveryProofMessage,
DeliveryProofMetadata,
SignedMessage,
TypedData,
compute_result_hash,
)

# Protocol Layer (PARITY: Match TS SDK exports)
from agirails.protocol import (
# Messages
MessageSigner,
SignatureComponents,
hash_typed_data,
create_typed_data,
HAS_MESSAGES,
# Proofs
ProofGenerator,
ContentProof,
MerkleProof,
verify_merkle_proof,
hash_service_input,
hash_service_output,
# DID
DIDManager,
DIDResolver,
VerificationMethod,
ServiceEndpoint,
create_did_from_address,
did_to_address,
)

Check failure on line 292 in src/agirails/__init__.py

View workflow job for this annotation

GitHub Actions / Lint & Type Check

ruff (I001)

src/agirails/__init__.py:37:1: I001 Import block is un-sorted or un-formatted help: Organize imports

# Protocol modules (conditional, require web3)
try:
from agirails.protocol import (
# Kernel
ACTPKernel,
TransactionView,
# Escrow
EscrowVault,
CreateEscrowParams,
EscrowInfo,
generate_escrow_id,
# Events
EventMonitor,
EventFilter,
EventType,
ACTPEvent,
TransactionCreatedEvent,
StateTransitionedEvent,
EscrowCreatedEvent,
EscrowPayoutEvent,
# Nonce
NonceManager,
NonceManagerPool,
# EAS
EASHelper,
Attestation,
DeliveryAttestationData,
Schema,
DELIVERY_SCHEMA,
ZERO_BYTES32,
# Agent Registry
AgentRegistry,
AgentProfile,
ServiceDescriptor,
compute_service_type_hash,
)

Check failure on line 329 in src/agirails/__init__.py

View workflow job for this annotation

GitHub Actions / Lint & Type Check

ruff (I001)

src/agirails/__init__.py:296:5: I001 Import block is un-sorted or un-formatted help: Organize imports
HAS_WEB3_PROTOCOL = True
except ImportError:
HAS_WEB3_PROTOCOL = False

# Builders
from agirails.builders import (
CounterAcceptBuilder,
CounterAcceptMessage,
CounterAcceptParams,
CounterOfferBuilder,
CounterOfferJustification,
CounterOfferMessage,
CounterOfferParams,
DeliveryProofBuilder,
LegacyQuoteBuilder,
MessageNonceManager,
QuoteBuilder,
QuoteMessage,
QuoteParams,
AIP2QuoteTypes,
)

# Web Receipts (AIP-7 §6 — agirails.app public receipt artifact)
from agirails.receipts import (
ReceiptUploadFailure,
ReceiptUploadOptions,
ReceiptUploadPayload,
ReceiptUploadResult,
ReceiptUploadSuccess,
upload_receipt,
push_receipt_on_settled,
format_settled_line,
PushReceiptArgs,
PushReceiptResult,
)

# Storage Layer (AIP-7 §4 - Hybrid Storage)
from agirails.storage import (
# Clients
FilebaseClient,
ArweaveClient,
# Builders
ArchiveBundleBuilder,
compute_content_hash,
compute_json_hash,
validate_archive_bundle,
PROTOCOL_VERSION,
ARCHIVE_SCHEMA_VERSION,
# Types - Filebase
FilebaseConfig,
# Types - Arweave
ArweaveConfig,
IrysCurrency,
IrysNetwork,
# Types - Archive Bundle
ArchiveBundle,
ArchiveChainId,
ArchiveFinalState,
ArchiveParticipants,
ArchiveReferences,
ArchiveHashes,
ArchiveSignatures,
ArchiveAttestation,
ArchiveSettlement,
EscrowRelease,
ArchiveTags,
ARCHIVE_BUNDLE_TYPE,
# Types - Results
IPFSUploadResult,
ArweaveUploadResult,
DownloadResult,
# Types - Circuit Breaker
CircuitBreakerConfig,
)

# Dispute Module — Evidence Bundle canonical serializer (AIP-14b / PRD P2-3)
from agirails.dispute import (
serialize_bundle,
serialize_bundle_to_string,
bundle_hash,
compute_bundle_hash,
validate_bundle,
assert_supported_version,
count_bundle_tokens,
enforce_token_cap,
set_bundle_tokenizer,
pin_evidence_bundle,
EVIDENCE_BUNDLE_SCHEMA_VERSION,
SUPPORTED_BUNDLE_MAJOR,
MAX_BUNDLE_TOKENS,
EvidenceBundle,
EvidenceBundleSpec,
EvidenceBundleDelivery,
EvidenceBundleDispute,
EvidenceBundleTimelineEvent,
EvidenceBundleReasoning,
PinEvidenceBundleResult,
BundleTooLargeError,
UnsupportedBundleVersionError,
InvalidBundleError,
)

# Negotiation Module (autonomous buyer-side negotiation)
from agirails.negotiation import (
DEFAULT_WEIGHTS,
PolicyEngine,
BuyerPolicy,
Constraints,
MaxUnitPrice,
MaxDailySpend,
Negotiation,
Selection,
QuoteOffer,
PolicyViolation,
PolicyResult,
DecisionEngine,
ScoringWeights,
CandidateStats,
ScoredCandidate,
ScoreBreakdown,
SessionStore,
SessionMapping,
BuyerOrchestrator,
NegotiationResult,
RoundResult,
OrchestratorConfig,
RequoteGuardViolation,
ProviderPolicyEngine,
verify_quote_hash_on_chain,
VerifyOnChainResult,
)

# AIP-16 secure delivery channel (encrypted envelopes, EIP-712, Mock/Relay).
from agirails.delivery import (
DeliverySetupBuilder,
BuildSetupParams,
DeliveryEnvelopeBuilder,
BuildPublicEnvelopeParams,
BuildEncryptedEnvelopeParams,
MockDeliveryChannel,
MockDeliveryChannelOptions,
RelayDeliveryChannel,
RelayDeliveryChannelOptions,
DeliveryChannel,
DeliverySubscription,
build_envelope_aad,
)

Check failure on line 476 in src/agirails/__init__.py

View workflow job for this annotation

GitHub Actions / Lint & Type Check

ruff (I001)

src/agirails/__init__.py:335:1: I001 Import block is un-sorted or un-formatted help: Organize imports

__all__ = [
# Version
Expand Down Expand Up @@ -754,6 +781,30 @@
"DownloadResult",
# Types - Circuit Breaker
"CircuitBreakerConfig",
# Dispute — Evidence Bundle serializer (AIP-14b / PRD P2-3)
"serialize_bundle",
"serialize_bundle_to_string",
"bundle_hash",
"compute_bundle_hash",
"validate_bundle",
"assert_supported_version",
"count_bundle_tokens",
"enforce_token_cap",
"set_bundle_tokenizer",
"pin_evidence_bundle",
"EVIDENCE_BUNDLE_SCHEMA_VERSION",
"SUPPORTED_BUNDLE_MAJOR",
"MAX_BUNDLE_TOKENS",
"EvidenceBundle",
"EvidenceBundleSpec",
"EvidenceBundleDelivery",
"EvidenceBundleDispute",
"EvidenceBundleTimelineEvent",
"EvidenceBundleReasoning",
"PinEvidenceBundleResult",
"BundleTooLargeError",
"UnsupportedBundleVersionError",
"InvalidBundleError",
# Negotiation Module
"DEFAULT_WEIGHTS",
"PolicyEngine",
Expand Down
Loading
Loading