Skip to main content

auth51 — Python client (embed mode)

The in-process enforcement point: it intercepts your agent's egress and gives every governed call a scoped, verifiable intent token — minted at the source, verified at the resource. This is the generalized, MCP-era successor to the original A-JWT client shim, with contextvar-based agent attribution (no call- stack introspection) per DESIGN §7b.

It's the durable, unbypassable path: it sees all egress in-process (native tool calls and MCP calls), and depends only on the HTTP library — not on any agent host's conventions.

Use

import auth51

auth51.configure(
    authority_url="https://authority.auth51.com",
    client_id="...", client_secret="...",
    audiences=["api.internal"],          # hosts to govern; everything else passes through
)

with auth51.agent("ReviewBot", checksum=agent_checksum, scope="read:repo"):
    httpx.get("https://api.internal/repos/...")   # ← stamped with an intent token

Config can also come from env: AUTH51_AUTHORITY_URL, AUTH51_CLIENT_ID, AUTH51_CLIENT_SECRET, AUTH51_AUDIENCES (comma-sep), AUTH51_FAIL_OPEN.

How it works

  • One import installs it (idempotent; a no-op until configured + inside an agent() context).
  • A framework adapter (LangChain/CrewAI — next) or the app sets the current agent via a contextvar at the tool-call boundary; the interceptor reads it.
  • On governed egress: mint a scoped intent token (Hop A) → attach as a Bearer header → forward. Minting uses stdlib urllib so it never re-enters the patched HTTP client.
  • fail-open by default (mint failure → forward unstamped, don't wedge the agent); set fail_open=False to fail closed.

Retained from the original A-JWT client shim

  • Startup-sync (load_agents) — preload registered agents from the authority, index by checksum, detect collisions, and fail-fast on drift when the app declares expected checksums. Boot-time validation: a mis-deployed agent is caught before it runs.
  • Workflow seamswith auth51.workflow(id): ... + record_step(...) track an execution; the chain + completed-steps + prev_jti ride into each intent token's delegation_context (§4.3 tamper-evident trace).
  • contextvar attribution + smart caching — kept; call-stack introspection dropped.

Status

  • ✅ contextvar agent attribution · httpx sync + async + requests interception · mint + attach · fail-open/closed
  • load_agents() startup-sync (cache + collision + drift validation) · workflow seams (delegation_context + prev_jti chain)
  • ✅ LangChain adapter (auth51.adapters.langchain.Auth51CallbackHandler) — sets agent context + records steps at tool boundaries
  • ⏭️ next: PoP signing (the cnf binding) · MCP _meta injection · aiohttp · local checksum recompute (shared lib) · live e2e against the deployed authority

Release files for auth51 0.2.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 auth51 0.2.2
File Size Uploaded
auth51-0.2.2.tar.gz 40.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for auth51 0.2.2
File Interpreter ABI Platform
auth51-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 90.0 kB

Release files / auth51-0.2.2.tar.gz

Download URL auth51-0.2.2.tar.gz
Size 40.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5ab0dd0f8975afa3657c96e53025fd7289178bf62386c20b4338569bc39d7b83
BLAKE2b-256 checksum
How to use checksums
69020741ac1cf5e949c4e603fdbac672b58c1e1390ef85bebd09e41c115356d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 1, 2026.

Transparency log

Release files / auth51-0.2.2-py3-none-any.whl

Download URL auth51-0.2.2-py3-none-any.whl
Size 49.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb8412ef2f9003ddc8f567a4ca520be64223f70a9664296726ebd6192bd0807d
BLAKE2b-256 checksum
How to use checksums
e3079d007aba44b7726585634a88e2867efbc70fc311aaa2794f6b06d3ebaf1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 1, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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