Metadata-Version: 2.4
Name: atcn
Version: 1.4.1
Summary: Python SDK for the Agent Transaction Closure Network: canonical JSON, Ed25519 event signing, webhook verification, API client, Agent Work Subledger
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/fadnisnikhil/atcn
Project-URL: Source, https://github.com/fadnisnikhil/atcn/tree/main/packages/sdk-python
Project-URL: Issues, https://github.com/fadnisnikhil/atcn/issues
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography>=42
Provides-Extra: test
Requires-Dist: pytest>=8; extra == "test"
Dynamic: license-file

# atcn (Python SDK)

The ATCN Python SDK. It covers:

- **Signing.** RFC 8785 canonical JSON, Ed25519 signing, and obligation event signing with `EventSigner`.
- **Webhooks.** `verify_webhook` and `sign_webhook`.
- **API clients.** `AtcnClient` is for the clearing network. `SubledgerClient` and `CaptureQueue` record tasks, delegations and charges. `ReceiptLinkClient` is for providers.
- **Provider response statements.** `build_response_statement`, `sign_statement` and `verify_statement_signature`.

It passes the same signing test vectors as the TypeScript SDK.

```bash
pip install atcn
```

```python
from atcn import canonicalize, generate_key_pair, sign_payload, verify_payload

canonicalize({"b": 1, "a": 2})  # '{"a":2,"b":1}'
private_key, public_key = generate_key_pair()
signed = sign_payload({"hello": "world"}, "key_1", 1, private_key)
assert verify_payload(signed, public_key)
```

The API clients need an ATCN API at `base_url`. The hosted API is not open for signup yet.

The Python SDK does not verify task closures or receipts. Use `npx @atcn/verify-cli` or the TypeScript SDK for that.

`python -m atcn init` records whether this machine shares anonymous usage metrics. Reporting is off by default and needs `ATCN_USAGE_URL`; see the [usage data documentation](https://github.com/fadnisnikhil/atcn/blob/main/docs/USAGE_DATA.md).

Apache-2.0.
