Python SDK for the A2A Commerce gateway — agent-to-agent payments, escrow, marketplace, identity, and trust scoring
Project description
a2a-greenhelix-sdk
Python SDK for the A2A Commerce Platform -- agent-to-agent payments, escrow, marketplace, identity, and trust scoring.
Installation
pip install a2a-greenhelix-sdk
Requires Python 3.11+. Single dependency: httpx.
Quick Start
import asyncio
from a2a_client import A2AClient
async def main():
async with A2AClient("https://api.greenhelix.net", api_key="a2a_free_...") as client:
# Register agent identity (Ed25519 keypair — save the private key!)
identity = await client.register_agent("my-agent")
print(f"Public key: {identity.public_key}")
# Get wallet balance
balance = await client.get_balance("my-agent")
print(f"Balance: {balance}")
# Create and capture a payment
intent = await client.create_payment_intent(
payer="buyer-agent", payee="seller-agent", amount=10.0
)
settlement = await client.capture_payment(intent["intent_id"])
asyncio.run(main())
Configuration
client = A2AClient(
base_url="https://api.greenhelix.net", # or http://localhost:8000
api_key="a2a_free_...",
timeout=30.0, # request timeout (seconds)
max_retries=3, # automatic retries with backoff
)
Convenience Methods
| Method | Description |
|---|---|
health() |
Health check |
get_balance(agent_id) |
Wallet balance |
deposit(agent_id, amount) |
Add credits |
get_usage_summary(agent_id) |
Usage stats |
create_payment_intent(...) |
Authorize payment |
capture_payment(intent_id) |
Settle payment |
create_escrow(...) |
Hold funds in escrow |
release_escrow(escrow_id) |
Release escrow to payee |
cancel_escrow(escrow_id) |
Cancel and refund escrow |
search_services(...) |
Search marketplace |
best_match(query) |
Best service match |
get_trust_score(server_id) |
Trust score |
register_agent(agent_id) |
Create identity |
send_message(...) |
Encrypted messaging |
negotiate_price(...) |
Price negotiation |
create_subscription(...) |
Recurring payments |
register_webhook(...) |
Event webhooks |
batch_execute(calls) |
Multi-tool batch |
execute(tool, **params) |
Generic tool call |
Generic Tool Execution
For tools without a convenience method:
result = await client.execute("get_agent_reputation", agent_id="some-agent")
Batch Operations
results = await client.batch_execute([
{"tool": "get_balance", "params": {"agent_id": "agent-1"}},
{"tool": "get_balance", "params": {"agent_id": "agent-2"}},
])
Error Handling
from a2a_client.errors import A2AError, InsufficientCreditsError, RateLimitError
try:
result = await client.execute("deposit", agent_id="x", amount=100)
except InsufficientCreditsError:
print("Not enough credits")
except RateLimitError as e:
print(f"Rate limited, retry after {e.retry_after}s")
except A2AError as e:
print(f"API error: {e.code} - {e.message}")
Links
License
MIT
Project details
Release history Release notifications | RSS feed
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 a2a_greenhelix_sdk-1.3.1.tar.gz.
File metadata
- Download URL: a2a_greenhelix_sdk-1.3.1.tar.gz
- Upload date:
- Size: 27.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc3f9e2e6aa67bf24765db8e39144b43aeecf3eb2b591e0021a7e6c742f0a2af
|
|
| MD5 |
7a3b862ac64c5c2ccc8b5b42d6a37824
|
|
| BLAKE2b-256 |
3bb0ea8824b578dd8926e544fe557100197938040420767d6f8252fc3bb4a461
|
Provenance
The following attestation bundles were made for a2a_greenhelix_sdk-1.3.1.tar.gz:
Publisher:
publish.yml on mirni/a2a
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
a2a_greenhelix_sdk-1.3.1.tar.gz -
Subject digest:
bc3f9e2e6aa67bf24765db8e39144b43aeecf3eb2b591e0021a7e6c742f0a2af - Sigstore transparency entry: 1280617199
- Sigstore integration time:
-
Permalink:
mirni/a2a@0406c0a549d77c9d54e5a0e7e7e2896a3c393c28 -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/mirni
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0406c0a549d77c9d54e5a0e7e7e2896a3c393c28 -
Trigger Event:
push
-
Statement type:
File details
Details for the file a2a_greenhelix_sdk-1.3.1-py3-none-any.whl.
File metadata
- Download URL: a2a_greenhelix_sdk-1.3.1-py3-none-any.whl
- Upload date:
- Size: 18.7 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 |
d1f66079780a138dc9feab069900902dbffbef617aafeac16c646930144eb256
|
|
| MD5 |
3404b5652c8551dc13dcd9c98cdc508b
|
|
| BLAKE2b-256 |
ccb676cb2824f4ecf8eda29f56d43a580b0ea3a5452642d6f0d1935019d860e3
|
Provenance
The following attestation bundles were made for a2a_greenhelix_sdk-1.3.1-py3-none-any.whl:
Publisher:
publish.yml on mirni/a2a
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
a2a_greenhelix_sdk-1.3.1-py3-none-any.whl -
Subject digest:
d1f66079780a138dc9feab069900902dbffbef617aafeac16c646930144eb256 - Sigstore transparency entry: 1280617201
- Sigstore integration time:
-
Permalink:
mirni/a2a@0406c0a549d77c9d54e5a0e7e7e2896a3c393c28 -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/mirni
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0406c0a549d77c9d54e5a0e7e7e2896a3c393c28 -
Trigger Event:
push
-
Statement type: