Metadata-Version: 2.4
Name: rescontre
Version: 0.1.0
Summary: Clearinghouse SDK for agent-to-agent payments.
Project-URL: Homepage, https://github.com/Jungyoonlim/Rescontre
Project-URL: Repository, https://github.com/Jungyoonlim/rescontre-SDK
Project-URL: Issues, https://github.com/Jungyoonlim/rescontre-SDK/issues
Author-email: Jungyoon Lim <46868943+Jungyoonlim@users.noreply.github.com>
License-Expression: MIT
License-File: LICENSE
Keywords: agents,clearinghouse,payments,settlement,x402
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2.6
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Description-Content-Type: text/markdown

# rescontre

Python SDK for Rescontre, a clearinghouse for agent-to-agent payments. Agents and resource
servers record commitments against a bilateral ledger and settle in periodic
batches instead of on every request.

## Why?

Instead of settling every API call on-chain, Rescontre nets obligations and settles the differences. Up to ~90% fewer settlement transactions. 

## Install

```bash
pip install rescontre
```

## Quickstart

```python
from rescontre import Client, Direction

with Client("http://localhost:3000") as c:
    c.register_agent("agent-1", wallet_address="0xAAA...")
    c.register_server("server-1", wallet_address="0xBBB...", endpoints=["/api/data"])
    c.create_agreement("agent-1", "server-1", credit_limit=10_000_000, settlement_frequency=100)

    check = c.verify("agent-1", "server-1", amount=1_000_000, nonce="n-1")
    assert check.valid, check.reason

    receipt = c.settle(
        "agent-1", "server-1",
        amount=1_000_000, nonce="n-1",
        description="GET /api/data",
        direction=Direction.AgentToServer,
    )
    print(receipt.commitment_id, receipt.net_position)
```

Amounts are integers in microdollars (`$1 == 1_000_000`).

## Connect

```python
# Local development
with Client("http://localhost:3000") as c:

# Production
with Client("https://rescontre-production.up.railway.app") as c:
```

```python
    # After multiple settle calls in both directions...
    result = c.bilateral_settlement("agent-1", "server-1")
    print(f"Gross: ${result.gross_volume / 1_000_000:.2f}")
    print(f"Net:   ${result.net_amount / 1_000_000:.2f}")
    print(f"Compression: {result.compression:.0%}")
```
