getaccord (Python)
Payments AI agents can't get wrong. Everyone's paid, or nobody is: an agent holds money with sellers, then one step pays them all or releases every hold. Within limits: they're enforced when money moves, so the agent can't talk its way past them. On the record: every purchase gets a public record that buyer and seller can both check. The same API as @getaccord/sdk, for Python 3.9+.
Test mode: test dollars only.
Quickstart
-
Make an agent key in your project folder. It's created on your machine and never leaves it:
npx @getaccord/cli init
This writes
ACCORD_AGENT_KEYto.env, which the Python SDK reads as is. -
Install:
pip install getaccord
-
Buy something: hold money with each seller, then commit.
from getaccord import Accord accord = Accord() # reads ACCORD_AGENT_KEY and ACCORD_URL from the env or ./.env intent = accord.intent(budget=4500) # whole cents; budget_micros= for exact sub-cent amounts intent.hold("skyfare", 3000, ref="SFO to JFK") intent.hold("stayco", 1500, ref="2 nights") result = intent.commit() # everyone is paid, or no one is print(result.status, result.intent["proofUrl"])
Amounts are whole cents (int) or exact micros (amount_micros=, millionths of a dollar). Floats are refused, so no amount is ever rounded.
Buying
accord.intent(budget, *, budget_micros, coin, mode, expires_in, key) |
Opens a purchase. coin: the usual dollar coin or "USDC". mode: "all" (everyone or no one) or "each". |
intent.hold(seller, amount, *, amount_micros, ref, type) |
Locks money with one seller. type: "reserve" or "deliver". |
intent.holds([...]) |
Several holds in one step (one transaction). |
intent.commit(wait="60s") |
Waits for every seller to confirm, then pays them all. In "all" mode a decline or timeout releases everything. |
intent.abort() |
Calls it off; every held dollar comes back. |
intent.results(), intent.accept(i), intent.reject(i) |
Deliver holds: check the work before anyone is paid. |
accord.resume(intent_id) |
A purchase made earlier, by its ID: commit, abort or add holds after a restart. |
accord.balance() |
What's available, and what's left of the key's weekly budget. |
Errors are AccordError with a stable .code (limit_exceeded, seller_not_allowed, insufficient_balance, awaiting_approval, too_many_holds, ...) and a message that says what to do.
A purchase over the key's sign-off limit waits for a person: hold() raises awaiting_approval and no money is locked. For a test key, the owner approves it with accord.test.approve(intent.id, owner_token), passing the owner token init saved to ~/.accord/owner-<key id>. The file holds comment lines and one line ACCORD_OWNER_TOKEN=own_…: pass only the own_… value. The SDK never reads that file itself, so an agent with only its key can't approve its own purchases. Dashboard keys are approved at app.useaccord.ai.
After a restart, accord.resume(intent_id) picks a purchase up again to commit or abort it.
Async: AsyncAccord has the same methods, awaitable.
import asyncio
from getaccord import AsyncAccord
async def main():
accord = AsyncAccord()
intent = await accord.intent(budget=4500)
await intent.hold("skyfare", 3000)
result = await intent.commit()
print(result.status)
asyncio.run(main())
Paying x402 sellers
Sellers that charge per request with x402 can add an Accord option to their 402.
from getaccord.x402 import pay
response = pay("https://seller.example/report") # quote, hold, commit, fetch with the proof
print(response.status, response.json())
Several sellers in one purchase: quote(url), hold(intent, offer) for each, intent.commit(), then fetch_paid(offer, intent.id, result.digest, indexes).
Selling with x402: add accord_requirement(pay_to=..., usd_cents=25, public_url='https://api.example.com') (the URL buyers reach you at; required) to your 402's accepts, then check each paid request with verify_accord_payment(header, requirement, resource=url). See examples/x402_gateway.py.
Selling (webhooks)
Accord tells your server about each hold with a signed webhook. Answer whether you can deliver:
from getaccord import Handler
handler = Handler(
on_hold=lambda event: True, # ready (or False, or {"declined": "why"})
on_commit=lambda event: print("paid", event["intentId"]),
) # reads ACCORD_WEBHOOK_SECRET
# Flask
@app.post("/accord")
def accord_webhook():
status, body = handler.handle(request.get_data(), request.headers)
return body, status
With async def callbacks (FastAPI, aiohttp), use status, body = await handler.handle_async(raw, headers).
handle() checks the Accord-Signature header (HMAC-SHA256, a 5-minute window against replays, old and new secrets during a rotation) and answers each event once. Give it the raw request body. verify_signature(raw, header, secret) is there on its own too.
Examples
examples/trip_booker.py: a flight, a hotel and a car, all paid or none (--fail ridenowto see a decline release everything).examples/seller_webhook.py: a seller answering webhooks with no framework.examples/x402_gateway.py: an x402 gateway paid through Accord.
Tests
pip install -e '.[dev]'
pytest # unit tests
ACCORD_LIVE=1 ACCORD_URL=https://api.useaccord.ai pytest # plus a live test-mode purchase
Signatures are checked byte-for-byte against the TypeScript SDK's.
License
Apache-2.0
Metadata
Release files for getaccord 0.6.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| getaccord-0.6.7.tar.gz | 37.8 kB | With provenance | Details for getaccord-0.6.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| getaccord-0.6.7-py3-none-any.whl | Python 3 | none | any | Details for getaccord-0.6.7-py3-none-any.whl |
Total release size: 66.3 kB
Release files / getaccord-0.6.7.tar.gz
| Download URL | getaccord-0.6.7.tar.gz |
|---|---|
| Size | 37.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
948d6ad0eb956c097cd339beb7a0d0cb5329175baff2e3916f65b79f39337d86
|
|
BLAKE2b-256 checksum How to use checksums |
78a9e5a4a899e7d6d7edc8c641183af75471f8c87f961aa0904f2c70ecbc1bcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 23, 2026.
Transparency logRelease files / getaccord-0.6.7-py3-none-any.whl
| Download URL | getaccord-0.6.7-py3-none-any.whl |
|---|---|
| Size | 28.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e3f60dc44178d700f039a3c41c40d7d8b12c093e64d2dcc102a89ad5fa8fb18
|
|
BLAKE2b-256 checksum How to use checksums |
9f24fd0c156a88b81a65c6ce2621a3da57e1bb1faf55ad7b899b1024fe948080
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 23, 2026.
Transparency logSecurity for getaccord 0.6.7
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
Both files in this release have been uploaded with provenance metadata.
Attestation for getaccord-0.6.7.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 Nov 23, 2026.
Transparency logA 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.