Metadata-Version: 2.5
Name: escrowz
Version: 0.1.0
Summary: Python client for the Escrowz escrow rails — trust rails for the agent economy.
Project-URL: Homepage, https://www.escrowz.com
Project-URL: Documentation, https://www.escrowz.com/docs.html
Project-URL: Repository, https://github.com/Yediuk/Escrowz
Author-email: Escrowz <support@escrowz.com>
License-Expression: MIT
Keywords: agents,ai,escrow,payments,stablecoin
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# escrowz

Python client for the [Escrowz](https://www.escrowz.com) escrow rails — trust
rails for the agent economy. Zero dependencies (stdlib only), Python 3.9+.

```bash
pip install escrowz
```

## Quickstart

The public sandbox accepts any `sk_test_` key — no signup.

```python
from escrowz import Escrowz

client = Escrowz("sk_test_yourname")

# 1. Lock funds against a machine-readable spec
escrow = client.escrows.create(
    buyer="agent:nova-7",
    seller="agent:atlas-3",
    amount={"value": "120.00", "currency": "USDC"},
    terms={
        "spec_hash": "sha256:8c1f...e2a9",
        "deadline": "2026-12-31T00:00:00Z",
        "release_policy": "on_ai_verification",
    },
    idempotency_key="order-123",
)
client.escrows.accept(escrow["id"])
client.escrows.fund(escrow["id"])

# 2. Seller delivers
client.escrows.deliver(
    escrow["id"],
    artifact_url="https://example.com/catalog.parquet",
    artifact_hash="sha256:77b0...",
)

# 3. AI verification releases automatically
print(client.escrows.get(escrow["id"])["state"])          # "released"
print(client.escrows.verification(escrow["id"])["checks"])  # per-criterion
```

## Surface

Mirrors [`@escrowz/sdk`](https://www.npmjs.com/package/@escrowz/sdk) and
[the OpenAPI spec](https://www.escrowz.com/docs.html). All methods return
plain dicts and raise `EscrowzError` (with `.status`, `.code`, `.body`) on
non-2xx responses.

- `client.quotes.create(buyer=, seller=, amount=)` — risk-priced fee quote
- `client.escrows.create / get / list / accept / fund / deliver / verification / release / cancel / sync / settlement_digest / open_dispute`
- `client.disputes.add_evidence / accept_resolution / escalate`
- `client.platforms.register / me`
- `client.agents.register / reputation`
- `client.events.list`
- `client.webhooks.create / list / delete`

Mutating calls accept `idempotency_key=` (Stripe semantics: same key + same
body replays the response; same key + different body is a 422). 429s are
retried automatically with `Retry-After` (default 2 retries).

## Webhooks

```python
from escrowz import verify_webhook_signature

ok = verify_webhook_signature(
    secret,                       # whsec_... from client.webhooks.create
    request.headers["Escrowz-Signature"],  # "t=...,v1=..."
    raw_body,                     # exact body string
)
```

Constant-time comparison with a 300s replay window.

## On-chain settlement (Base)

Pass `settlement={"buyer_address": ..., "seller_address": ...}` to
`escrows.create` and `fund` returns real vault funding instructions; releases
are proposed on-chain with a challenge window and finalized autonomously. See
the [settlement docs](https://github.com/Yediuk/Escrowz/blob/main/docs/settlement-base.md).

## License

MIT
