Skip to main content

Clearinghouse SDK for agent-to-agent payments.

Project description

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

pip install rescontre

Quickstart

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

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

# Production
with Client("https://rescontre-production.up.railway.app") as c:
    # 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%}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rescontre-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rescontre-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file rescontre-0.1.0.tar.gz.

File metadata

  • Download URL: rescontre-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for rescontre-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7c9300044c1e009fc44ff955613b4805219038b463891e2fbfe50a9d0f292def
MD5 1e9ae4499933dbab723d39cbe7f53778
BLAKE2b-256 84ad09125d80d30976bd6192ff071bcfd6f7f822b23afd9b166f293bc8891d71

See more details on using hashes here.

File details

Details for the file rescontre-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rescontre-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for rescontre-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1758df2a1f4a207904c2e022f58b4bfc7c93ead198e78883186df3b37661c7e6
MD5 28da3901ed457e8168687171fb316b56
BLAKE2b-256 7b26692285cb88bfc9a513fd6d1c3c01a81d4a2b2ea7b6d3a03da1a2007bd487

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page