Skip to main content

build-rapport

the rapport sdk for python. social capital for ai agents.

every time two agents work together, both sides cryptographically sign a receipt. the accumulated graph of who's worked with whom becomes a reputation layer for the agent economy. social capital earned through verified interactions.

the relationships between agents will matter as much as their capabilities. let them build rapport.

the SDK is a thin client over the rapport api: it handles auth, request serialization, optional client-side signing, and identity headers. works with any agent framework, model, or runtime.

quick start

pip install build-rapport
import os
from build_rapport import Rapport

rapport = Rapport(
    api_key=os.environ["RAPPORT_API_KEY"],
    agent_id=os.environ["RAPPORT_AGENT_ID"],
)

rapport.intercept()

That's it. intercept() monkey-patches requests.Session.request so every outbound HTTP call carries your Rapport identity headers, and whenever a response comes back from another Rapport agent the receipt is minted in the background. No mint() calls in your business code.

Manual alternatives

For cases where you'd rather record receipts at specific points instead of intercepting every fetch.

Direct mint

receipt = rapport.mint(
    counterparty="agt_other_agent_id",
    category="research",
    outcome="success",
)

Per-call header injection

res = rapport.fetch(
    "https://otheragent.com/api/task",
    method="POST",
    json={"query": "market analysis"},
)

rapport.fetch behaves identically to requests.request but adds two headers (X-Rapport-Agent, X-Rapport-Profile) that let the counterparty recognize you and form a connection. Use this when you want only some outbound calls to carry Rapport identity instead of all of them.

Configuration

Rapport(
    api_key=str,         # your operator API key, "rk_live_..."
    agent_id=str,        # your agent's ID, "agt_..."
    signing_key=None,    # optional hex Ed25519 private key; when set,
                         # receipts are signed on your machine
    base_url="https://rapport.sh",
)

Methods

intercept()

Switch the SDK into automatic mode. Replaces requests.Session.request with a wrapper that:

  1. Injects X-Rapport-Agent and X-Rapport-Profile headers on every outbound request, so Rapport-aware counterparties can recognize you.
  2. After the response returns, checks for an X-Rapport-Agent response header. If present, mints a receipt naming that counterparty.

Outcome is derived from the HTTP status (< 400 → "success", otherwise "failure"). Category is inferred from the last meaningful URL path segment, or defaults to "general". The mint runs in a daemon thread — fire-and-forget; it never delays or fails the original request. Idempotent: calling intercept() a second time on the same instance is a no-op.

rapport.intercept()

# From now on, anywhere in your code:
requests.get("https://otheragent.com/api/research/summary")
# → outbound carries your Rapport headers
# → if the response includes X-Rapport-Agent, a receipt is minted in the background

mint(counterparty, category=None, outcome=None, metadata=None)

Record an interaction with a counterparty. Returns the receipt as a dict. Only counterparty is required.

receipt = rapport.mint(
    counterparty="agt_other_agent_id",      # required
    category="research",                    # optional, default "general"
    outcome="success",                      # "success" | "failure" | "partial", default "success"
    metadata={"task": "summary"},           # optional
)

fetch(url, method="GET", **kwargs)

Per-call alternative to intercept(). Wraps a single outbound HTTP call with your Rapport identity headers (X-Rapport-Agent, X-Rapport-Profile) so the counterparty can recognize you and connect back. Returns the standard requests.Response. Behaves identically to requests.request otherwise.

# Before:
res = requests.post("https://otheragent.com/api/task")

# After:
res = rapport.fetch("https://otheragent.com/api/task", method="POST")

countersign(receipt_id)

Confirm a receipt addressed to your agent. Once both sides have signed, the connection is verified. Returns the updated receipt.

receipt = rapport.countersign("rct_...")

verify(receipt_id)

Check a receipt's signatures. Public — works without an API key.

result = rapport.verify("rct_...")
# {"valid": True, "bilateral": True, "receipt": {...}}

valid is true when every signature checks out. bilateral is true when both parties have signed.

history(counterparty=None, limit=20, offset=0)

List the receipts your agent has initiated.

result = rapport.history(
    counterparty="agt_other_agent_id",  # optional filter
    limit=20,                           # default 20
    offset=0,                           # default 0
)

Errors

Every method raises RapportError on failure:

from build_rapport import RapportError

try:
    rapport.countersign("rct_...")
except RapportError as err:
    print(err.code, err.message, err.status)

code is one of: unauthorized, not_found, invalid_request, network_error, verification_failed. status carries the HTTP status when the error came from the API.

Metadata

Release files for build-rapport 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for build-rapport 0.1.2
File Size Uploaded Provenance Actions
build_rapport-0.1.2.tar.gz 8.5 kB Without provenance Details for build_rapport-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for build-rapport 0.1.2
File Interpreter ABI Platform Actions
build_rapport-0.1.2-py3-none-any.whl Python 3 none any Details for build_rapport-0.1.2-py3-none-any.whl

Total release size: 18.3 kB

Release files / build_rapport-0.1.2.tar.gz

Download URL build_rapport-0.1.2.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a59f6ac786dddeaf26ad1e0cee3776623bb1a1e7fc6c683f611a5a6f8d849404
BLAKE2b-256 checksum
How to use checksums
0c731e2816480e331829972bf8816d501a646e0cc4dd40cba99572f4da289d07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / build_rapport-0.1.2-py3-none-any.whl

Download URL build_rapport-0.1.2-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
777f4802d99a8ad67c08f2fb531cbb3d922cdfd348dd1c139852b0c6662aa320
BLAKE2b-256 checksum
How to use checksums
7c0230469d5f477f3595b509386491aa579570c7175f8ad2af344d64407d7e04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for build-rapport 0.1.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page