Skip to main content

ubag (Python)

UBAG Web Layer — agent identity and routing at the web edge. FastAPI / Starlette middleware.

When an autonomous agent visits a website, UBAG verifies who it is and routes accordingly: humans to your normal site, credentialed agents to clean JSON-LD, unknown bots to a cryptographic challenge. Asymmetric by design — agent identity is an Ed25519 keypair; credentials are ES256 JWTs verifiable via JWKS, no shared secrets.

Early but real, pre-1.0, unaudited. See the full README and SECURITY.md.

Install

pip install "ubag[fastapi]"

Quick start

from fastapi import FastAPI
from ubag import UBAGMiddleware, generate_issuer_keypair

issuer_private, _ = generate_issuer_keypair()   # EC P-256 (ES256)

app = FastAPI()
app.add_middleware(
    UBAGMiddleware,
    origin="https://yoursite.com",
    issuer_key=issuer_private,                  # mints + verifies credentials
    site_meta={"name": "My Store", "type": "Store", "description": "We sell widgets"},
)

Your site now serves clean JSON-LD to credentialed agents, proxies humans to your origin, challenges unknown bots, exposes /.well-known/ubag.json for discovery, and serves its issuer key as JWKS at /.well-known/jwks.json.

A Node/Express SDK with an identical, cross-verifiable wire format is in the same repo. Full docs, a runnable demo, and the protocol details: https://github.com/mohameduk/Ubag_protocol

MIT licensed.

Download files

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

Source Distribution

ubag-0.3.0.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

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

ubag-0.3.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file ubag-0.3.0.tar.gz.

File metadata

  • Download URL: ubag-0.3.0.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ubag-0.3.0.tar.gz
Algorithm Hash digest
SHA256 eb194e34fa6f5b467c6b79eec9ca4596625de07afecff301995da6c2c2da3df8
MD5 33878fcfa4822fbc87d1efbd365157fc
BLAKE2b-256 8e9afbfd789a2876758afce7b61337d31a9f7f0db970589f860cfa6df59aa45f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ubag-0.3.0.tar.gz:

Publisher: publish.yml on mohameduk/Ubag_protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ubag-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ubag-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ubag-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c4983770186fc10087a087024a2b73281e20dde60f873f3579cfbd56f357068
MD5 cbf432f53dc0f12c52a6443fa8c9b503
BLAKE2b-256 3e52ac9598ab19bcef9817d10f0dea03b7c52999df82a31eb6aff3b41598b036

See more details on using hashes here.

Provenance

The following attestation bundles were made for ubag-0.3.0-py3-none-any.whl:

Publisher: publish.yml on mohameduk/Ubag_protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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