Skip to main content

Issue verifiable allegiance receipts for AI agents

Project description

getstub

Issue verifiable allegiance receipts for AI agents, from Python.

When your agent acts for someone, this gives them a signed record of what it did and what influenced the result, checkable at a neutral registry. Three calls, and the third is one line per action.

Here is a live receipt before you install anything:

https://api.getstub.dev/check/72b4baee1719ec34acc5df5c514a12fd2e19b9a6776de4b45706988f765c77d8

Install

pip install getstub

Quickstart

import os
from getstub import Stub, influenced

# 1. Declare your standing mandate, once. Policy level: who pays you, and
#    which kinds of conflict exist in your business at all.
stub = Stub(
    operator="Nimbus Assistant",
    declared={
        "paid_by": "the traveler, subscription",
        "conflicts": ["commission"],
    },
    principal_salt=os.environ["STUB_SALT"],
)

# 2. At the line where your ranking picks a winner, pass through the flags
#    it already computed. Nobody hand writes these.
inf = []
if pick.paid_placement:
    inf.append(influenced.placement(f"{pick.seller} paid for placement"))
if pick.commission_pct:
    inf.append(influenced.commission(f"{pick.commission_pct}% on a sale"))

# 3. One call per action.
receipt = stub.issue(
    principal=user.id,          # hashed on your side, never sent raw
    agent="nimbus",
    requested=query,
    done=f"booked {pick.name}",
    value_moved={"amount": pick.price, "currency": "GBP"},
    not_disclosed=inf,          # an empty list is signed proof none applied
)

print(receipt["url"])           # hand this to your user

Where disclosures come from

Your ranking code already knows when a boost, a commission, or a partner filter applied, because it applied them. Pass the same flags through with influenced at the same line where the boost happens. Helpers: placement, commission, partner_only, own_brand, data_share, and other(kind, detail) for anything else.

An empty not_disclosed is not nothing. It is a signature saying conflicts exist in your business and none of them touched this action.

Privacy by default

Pass your internal user id as principal and the client hashes it on your side with a salt only you hold. The registry rejects anything that is not an opaque digest, so no name or email can be stored even by accident.

Set the salt once so digests stay stable across restarts. If a user asks to be forgotten, drop their mapping to the salt and their digests become permanently meaningless, while the record stays append only.

Keep requested and done about the action, not the person. The client warns in development if free text looks like it carries an email or phone number.

Keys

The client generates an Ed25519 keypair on first use. Save it if you want the same operator identity across restarts:

kp = stub.export_keypair()          # store this somewhere safe
stub = Stub(operator="...", declared={...}, keypair=kp)

Your keys stay on your side. We cannot recover them for you.

Compatibility

Stubs are signed over a canonical JSON form. This client produces byte identical output to the JavaScript client at @getstub/agent, which is verified in the test suite rather than assumed: the tests sign a stub in Python and have the actual registry code verify it.

python3 test_getstub.py     # 31 tests

Pricing

Free tier: 1,000 stubs a month. Checking is always free.

Links

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

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

getstub-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: getstub-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.9.6

File hashes

Hashes for getstub-0.1.0.tar.gz
Algorithm Hash digest
SHA256 09fcff0574d8fb3dbd867a3cbfde09605bb2a20b4bc21fce48d3912fb45f2818
MD5 d02c188a324c5f86bca0e571a0de2d95
BLAKE2b-256 df1650d355b1644535461fcf1e5a5fa47c26493972c3dd24d9d180010c924772

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for getstub-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5176087c525c12471b170eab48fa47a65b363b34e5a7ad2a7178d0eba4d89e96
MD5 488c9b2fce1e84631f235be23c2b19da
BLAKE2b-256 4d9fd7b42417862ae5fbc45facdba12f60ddfb0ec490375f2e44256c27eb5a1f

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