Skip to content

About

Verify and sign AI agent HTTP traffic in Python — RFC 9421 · Web Bot Auth · AAuth

Topics

Resources

Contributing

Security policy

Stars

6 stars

Watchers

0 watching

Forks

Repository files navigation

regent-httpsig

Verify and sign AI agent HTTP traffic in Python. RFC 9421 · Web Bot Auth · AAuth

Some AI agents already sign their HTTP requests with Web Bot Auth: OpenAI says ChatGPT Work's Cloud browser signs its outbound requests (OpenAI), and Google signs a subset of Google-Agent requests, as an experiment (Google). On the receiving side, Cloudflare validates these signatures for signed agents and verified bots (Cloudflare), AWS WAF Bot Control verifies them for CloudFront distributions (AWS), and Google Cloud Fraud Defense (reCAPTCHA) can verify them (Google Cloud). This library brings both sides to Python: verify signed agents calling your API, and sign your own agent's traffic. (Sources checked on 1 December 2026.)

pip install regent-httpsig

What a valid signature proves, and what it does not

A VerifiedSignature means: someone holding the private key signed the covered parts of this request, and that key is bound to the named identity — for Web Bot Auth, the key was published at the Signature-Agent URL when it was fetched over TLS; for AAuth, the named issuer's token binds it (cnf.jwk), or the pinned server publishes it.

It does not prove:

  • trust — that the agent or its operator is honest or the one you think; sig.trusted only reflects your own allow-list;
  • authorization — that the agent may do what it asks;
  • consent — that a human or an account owner approved this request;
  • freshness — that the request is new: a valid signature can be replayed until it expires unless you add a replay guard or make the action idempotent;
  • anything about parts that were not covered: by default a Web Bot Auth signature only has to cover the host, so it says nothing about the method, path or body.

Verify: know which AI agent is calling — in 5 lines

from fastapi import FastAPI
from regent_httpsig import HttpsigVerifier
from regent_httpsig.fastapi import attach, SignatureDep, VerifiedSignature

app = FastAPI()
attach(app, HttpsigVerifier())

@app.post("/v1/orders")
async def create_order(sig: VerifiedSignature | None = SignatureDep):
    if sig:
        print(sig.scheme)   # "web-bot-auth"
        print(sig.agent)    # "https://chatgpt.com"
        print(sig.keyid)    # RFC 7638 key thumbprint
    ...

sig.keyid is the thumbprint of the key that signed, in every scheme. Check sig.scheme before you treat it as an identity, and key any lookup on (scheme, keyid), never on the keyid alone: a Web Bot Auth key, an AAuth agent key and a server key are different identities.

No FastAPI? The core has no framework dependencies:

verifier = HttpsigVerifier()
sig = await verifier.verify(method, url, headers)            # VerifiedSignature | None
out = await verifier.verify_detailed(method, url, headers, body)
# VerifiedSignature | VerificationError(code="expired_jwt", …) | None

For a request from ChatGPT's Cloud browser, sig prints as (keyid: the thumbprint of the key chatgpt.com published on 1 December 2026):

VerifiedSignature(scheme='web-bot-auth', agent='https://chatgpt.com',
                  keyid='ArwjqcCqtA5oxEWkzXGC-To_0A9whHmajCHtfe8I9aY', trusted=False,
                  sub=None, label=…,
                  claims={'directory': 'https://chatgpt.com/.well-known/http-message-signatures-directory',
                          'jwk': {'kty': 'OKP', 'crv': 'Ed25519',
                                  'x': 'P_1c4SX6fCavDcq6FRegWcVvaOKsp_aXHPEN1FcKDIA'}})

claims["directory"] is the exact URL the key was fetched from (query included) and claims["jwk"] the key itself, so you can record where a key came from, not only who it named.

Verification is enrichment by default: no Signature header costs nothing, a bad signature yields None, and nothing ever raises on untrusted input. verify_detailed() says why with the Signature-Error code of draft-hardt-httpbis-signature-key exactly as AAuth -11 §11.3.4 assigns it (invalid_signature, invalid_input, unsupported_scheme, unsupported_algorithm, invalid_key, unknown_key, issuer_missing, issuer_mismatch, invalid_jwt, expired_jwt, revoked_jwt, clock_skew); error.headers() is the 401's header set and error.problem() its problem+json body. Use regent_httpsig.fastapi.RequiredSignatureDep when a signature must be present — the 401 carries that header, or AAuth-Requirement: requirement=agent-token when nothing was signed.

Verify against your own public URL, never one built from the client's Host. The signature covers @authority, and it binds the request to your site only if the URL you verify against names your site. Framework-free: pass verify() the URL of your own public origin plus the request path, not one assembled from the Host header — otherwise a signature made for another site verifies here when replayed with that site's Host. FastAPI: set HttpsigConfig(public_origins=frozenset({"https://api.example"})); the URL is then built from the configured origin that matches Host (scheme included), and a signed request whose Host is none of them is refused before verification. If one host is listed under both http:// and https://, X-Forwarded-Proto decides which, and without that header it is https:// — never the connection's own scheme, which behind a TLS-terminating proxy is plain http. A client that reaches you directly over plain http (no proxy, no header) with a signature covering @target-uri or @scheme is then refused; list only the scheme you serve, or have the proxy send X-Forwarded-Proto. Without that setting the FastAPI layer rebuilds the URL from the client's Host and X-Forwarded-Proto, as 0.7 did, so the proxy in front must pass only your own names (and forward the scheme — nginx: proxy_set_header X-Forwarded-Proto $scheme;). If signatures mysteriously fail to verify in production, check the scheme first.

Sign: get your agent past bot walls

from regent_httpsig import EgressSigner

signer = EgressSigner(seed=os.environ["AGENT_KEY_SEED"],
                      signature_agent="https://myagent.example")
headers = signer.sign("POST", url, {"content-type": "application/json"})
resp = httpx.post(url, json=body, headers=headers)

headers now carries (values shortened):

content-type:    application/json
Signature-Agent: "https://myagent.example"
Signature-Input: sig1=("@method" "@authority" "@path" "signature-agent");created=1796102314;
                 keyid="BTd4PmkX…";alg="ed25519";expires=1796102614;tag="web-bot-auth"
Signature:       sig1=:g7Pk5Qc4…:

Generate a key and the ready-to-publish /.well-known/ files in one command:

regent-httpsig keygen --agent https://myagent.example --out ./well-known/
# Keep this secret — it IS your agent's identity:
# keyid (RFC 7638 thumbprint): NXlkuIrk…
# Wrote ./well-known/http-message-signatures-directory and jwks.json
# Serve them at https://myagent.example/.well-known/
AGENT_KEY_SEED=…

Publish the directory at https://myagent.example/.well-known/http-message-signatures-directory and Web Bot Auth verifiers can fetch your key and verify your agent's signatures. Some also ask you to register the agent first (Cloudflare's verified bots and signed agents do).

The same key signs as an AAuth agent (-11 §11.3.3) — the token in Signature-Key, the required components covered, Content-Digest computed when there is a body:

headers = signer.sign_aauth("POST", url, {"content-type": "application/json"},
                            token=agent_token, body=raw_body)

and a server (a PS or AS calling a resource's usage or revocation endpoint, §11.3.2) signs under the jwks_uri scheme with ServerSigner(seed=…, server_id="https://ps.example", dwk="aauth-person.json") — publish .jwks() at your metadata document's jwks_uri.

What exactly is verified

Drafts as checked on the IETF datatracker on 1 December 2026: Web Bot Auth is draft-ietf-webbotauth-httpsig-protocol-01 (29 October 2026), which replaces draft-meunier-web-bot-auth-architecture (last revision -05, expired 3 September 2026); AAuth is draft-hardt-oauth-aauth-protocol-11 (25 September 2026), with draft-hardt-httpbis-signature-key-09 (13 September 2026) for Signature-Key and Signature-Error, and draft-hardt-aauth-budgets-00 (28 September 2026) for budgets.

Check Status
RFC 9421 Appendix B.2.6 Ed25519 vector (byte-exact) ✅ in CI
Web Bot Auth -01 Appendix E.2.1 — sf-dictionary Signature-Agent, member keyed by the label, covered with ;key= ✅ in CI
Web Bot Auth -01 Appendix E.2.2 — legacy sf-string form (what OpenAI's Cloud browser sends) ✅ in CI
Web Bot Auth architecture -05 A.2.2 — member keyed differently from the label (;key="agent2") ✅ in CI¹
Web Bot Auth -01 §5.2 rules: @authority (or @target-uri) and the Signature-Agent member covered, expires required with no grace, created at most 5 s ahead, attribution only to the covered member, member values resolved directly as JWK Sets, directories answered 200 only ✅ in CI
Externally generated Web Bot Auth fixtures (issue #2, CC0): valid, tampered @authority, expired by 1 s, created in the future, unknown keyid, swapped Signature-Agent, wrong tag, replay (with a guard) ✅ in CI
Sign → verify roundtrip (fresh keys, full pipeline) ✅ in CI
AAuth -11 agent / person / auth tokens (cnf.jwk proof of possession, required components, body digest, 60 s created window, RS-51 token time, fully-specified algs, Ed25519 + ES256 possession keys) ✅ in CI
AAuth -11 server scheme (jwks_uri with id/dwk/kid, issuer_mismatch, key rotation refetch; verify() only for pinned servers; keyid = thumbprint) ✅ in CI
Every -11 §11.3.4 Signature-Error code, revoked_jwt via the revocation record, RS-52 case-exact ids ✅ in CI
Key members in canonical base64url only; one RFC 7638 thumbprint per key (RFC 7638 §3.1 example) ✅ in CI
Replay guard on both paths, keyed on the signature base (an ECDSA signature's twin is still a replay) ✅ in CI
Signed by aauth-signing (jwt scheme, keyid-less) → verified ✅²
Tampered request / expired signature / wrong directory key rejected ✅ in CI

¹ The signature bytes printed in the -05 A.2.2 example do not verify over that draft's own signature base (its legacy A.2.3 vector and RFC 9421 B.2.6 both do, so the defect is in the example, not the canonicalization). Ed25519 is deterministic, so our test pins the vector re-signed with the same RFC test key over the same byte-exact base — reported upstream. The -01 dictionary vector (E.2.1) verifies as printed; -01's legacy vector (E.2.2) is the -05 A.2.3 one unchanged.

² Cross-library interop with aauth-signing's jwt scheme: token layer, cnf.jwk proof of possession and canonicalization all verify. Its signers correctly omit the optional keyid parameter — which exposed an unconditional keyid read in the underlying RFC 9421 library that we now handle. One deviation reported upstream to aauth-signing: it emits the Signature byte sequence as base64url, while RFC 8941 requires standard base64. The keyid-less shape is pinned in CI.

Both dialects, one verifier

  • Web Bot Auth (draft-ietf-webbotauth-httpsig-protocol-01, checked 1 December 2026): the agent signs with tag="web-bot-auth" and names its key directory in Signature-Agent. Both wire forms are accepted: the sf-dictionary -01 asks signers to send (Signature-Agent: sig1="https://…", covered as "signature-agent";key="sig1"; Google-Agent sends this form) and the legacy bare sf-string OpenAI's Cloud browser sends ("https://chatgpt.com"). -01 changes where the keys are: every member value is now a URL fetched directly as the JWK Set. A bare origin, which is what deployed signers send, still resolves to {origin}/.well-known/http-message-signatures-directory, as in every earlier draft; any other https URL is fetched as the JWK Set itself and is the identifier (sig.agent), without its query. A signature is attributed only to the member it covers. -01's defaults are enforced (see Configuration); stricter ones are yours to set.
  • AAuth (draft-hardt-oauth-aauth-protocol-11, the current revision on 1 December 2026): the agent carries its token in Signature-Key under the jwt scheme — an agent token (aa-agent+jwt), a person token (aa-person+jwt, opt-in via HttpsigConfig.resource_url) or an auth token (aa-auth+jwt, pinned via trusted_ps); the issuer's JWKS, discovered through {iss}/.well-known/{dwk}, verifies the token, the token's cnf.jwk verifies the request signature. Servers sign under jwks_uri (id/dwk/kid); verify() accepts that scheme only from a server pinned in trusted_ps (allow_unpinned_servers=True opens it), while verify_server() is the entry point for usage and revocation endpoints. Install with pip install 'regent-httpsig[aauth]'. 0.7.0 is the -11 cut-over — one dialect, as published: fully-specified algorithms only (RFC 9864; EdDSA is refused), the required covered components, the 60-second created window, no tolerance on exp, revoked tokens named as revoked. require_fully_specified_algs=False survives for private test rigs only. For a full-protocol AAuth implementation (both roles, all token types) see christian-posta/aauth-python-library — this library is the thin relying-party verifier that handles both dialects.

Budgets: meter a spending envelope (draft-hardt-aauth-budgets)

An agent can carry a PS-issued auth token (typ: aa-auth+jwt) with a budget claim — a spending envelope it uses offline, no per-call round trip to the control plane. The middleware does the whole resource-side checklist: verify the token against your pinned PS, atomically reserve → commit → release per request, answer with AAuth-Budget, and refuse exhausted envelopes with a 401 + AAuth-Requirement (optionally carrying your signed resource token with one consumption record — the presented token's {jti, consumed} — so one agent never learns about a sibling's spending). The cap is per token: a jti never draws on a sibling's grant; the (iss, sub, aud) key is only the per-person ledger behind records and usage:

from regent_httpsig import HttpsigConfig, HttpsigVerifier, InMemoryMeter
from regent_httpsig.fastapi import BudgetMiddleware

app.add_middleware(
    BudgetMiddleware,
    verifier=HttpsigVerifier(HttpsigConfig(
        resource_url="https://api.example",
        trusted_ps={"my-ps": "https://ps.example/jwks.json"},
    )),
    meter=InMemoryMeter(),
    price_fn=lambda request: PRICES.get(request.url.path),  # max cost, minor units
)

The only thing the library cannot do for you is pricing (price_fn) — that is your domain. Under Implementations in Progress, draft-hardt-aauth-budgets-00 §22.1 lists Regent Protocol's deployment and names regent-httpsig as its open-source resource/PS middleware; the draft's description is of that deployment as of the draft's date, not of this release.

The August 20 additions are covered too:

  • insufficient-budget refusals carry required — the refused request's maximum cost — so the agent lowers its bound and retries instead of guessing.
  • Revocation (-11 §11.12): make_revocation_endpoint(meter, authenticate_ps=…) takes the signed POST {"jti", "exp"}, keys the record by the caller's verified identity, answers an empty 200 always (no 404) and problem+json invalid_request / unsupported_iss. A revoked token stops spending at once, in-flight requests complete, and a later presentation is answered 401 + Signature-Error: error=revoked_jwt + AAuth-Requirement: requirement=person-token — no resource token (§11.12.5). Wire HttpsigVerifier(is_revoked=meter.is_revoked) so the verifier names it first.
  • An expired auth token is answered the same way with expired_jwt (budgets editor's copy, 6 October): nothing is served or metered, and the token's final consumption record reaches its issuer through the usage endpoint, not on the challenge.
  • Streaming responses run in the draft's cost-omitted mode: reserved in the header, commit when the stream ends (set request.state.budget_cost mid-stream if you learn the actual), and the agent recovers the exact cost from the next response's remaining.
  • The usage endpoint (§Usage Counters) lets your PS query consumption without the agent in the loop — scope counters (sub, UTC calendar buckets) and per-key jkts totals, optionally signed:
from regent_httpsig import InMemoryMeter, ResponseSigner, make_usage_endpoint
from regent_httpsig.fastapi import attach, verify_server_request

attach(app, verifier)                          # with HttpsigConfig(public_origins=...)

handler = make_usage_endpoint(
    meter,
    authenticate_ps=verify_server_request,     # the PS signs as a server, §11.3.2
    unit="USD", decimals=6,
    signer=ResponseSigner(seed=SEED, server_id="https://api.example"),  # dwk aauth-resource.json
)

@app.post("/usage")
async def usage(request: Request):
    return await handler(request)

verify_server_request verifies against the same URL as the other FastAPI dependencies (public_origins when set). Do not build the URL from request.url yourself: that is the client's Host (see the warning under Verify).

  • validate_budget_grant(unit, decimals, budget_units) enforces the resource metadata MUSTs before you mint a resource token — the "thousandfold error" guard.

Test vectors: vectors/aauth-budgets-vectors.json — header serializations (including required and the cost-omitted streaming case), the budget object, consumption records, and a fully worked signed usage response with a fixed key, ready for cross-implementation checks.

Security model (what a naive implementation gets wrong)

The verifier fetches key directories from attacker-nameable origins — whoever signs a request chooses its Signature-Agent. regent-httpsig ships with the guard rails on:

  • SSRF protection by default: https-only, every resolved IP must be public (catches 169.254.169.254, loopback, private ranges, DNS names mapping to internal services), redirects never followed, anything but 200 refused, responses size-capped.
  • Bounded caching: per-instance TTL cache with eviction — a keyid-spam attack can't grow memory; failures are negative-cached so a dead origin can't be used to slow you down. A failed refetch of a Web Bot Auth directory is not evidence (-01 §6.10): the last good copy keeps being served, so an operator's short outage does not revoke its keys — but for at most wba_max_stale_seconds (default 600 s) after it went stale, because whoever can make the refetch fail (a DoS of the directory host) would otherwise keep a removed key verifying for ever. A directory that answers without a key is evidence, and that key stops verifying. AAuth issuer and server JWKS are never served stale.
  • One key, one keyid. Key members are read only from canonical base64url, and keyid is the RFC 7638 thumbprint of the key that verified, in every scheme — never a label the signer chose. A server (jwks_uri) signature names its own kid, so verify() accepts one only from a server you pinned in trusted_ps.
  • Attribution by coverage. A Web Bot Auth signature is attributed only to the Signature-Agent member it covers, never to "the first member", and a member with parameters or a URL with userinfo is not used.
  • One header, one value. The header mapping is normalised once, before anything reads it, so the verifier's checks and the RFC 9421 library read the same value. A request in which a field the verification depends on (Signature, Signature-Input, Signature-Agent, Signature-Key, the body fields, Host, any covered field) arrives under two spellings, as a case-preserving mapping can deliver, is refused.
  • A valid signature proves key possession — not trustworthiness, authorization, consent or freshness (above). VerifiedSignature.trusted reflects only your configured allow-list; deciding whether to trust a key is your policy layer's job, and replays are stopped only by a replay guard or by your own idempotency.

Known sharp edges of the underlying ecosystem, already handled: the upstream http-message-signatures library cannot resolve RFC 9421 ;key= dictionary members (we provide the component resolver), it looks up header names case-sensitively while ASGI frameworks lowercase them (we wrap), and it forgets to declare typing_extensions (we declare it).

Configuration

from regent_httpsig import HttpsigConfig, HttpsigVerifier, InMemoryReplayGuard

verifier = HttpsigVerifier(HttpsigConfig(
    trusted_agents=frozenset({"https://chatgpt.com"}),
    max_age_hours=25,              # Web Bot Auth: reject signatures created earlier than this
    wba_required_components=("@authority", "signature-agent"),  # Web Bot Auth: -01 minimum
    wba_require_expires=True,      # Web Bot Auth: -01 makes `expires` a MUST
    wba_max_validity_seconds=None, # Web Bot Auth: cap on expires - created (None = no cap)
    signature_window_seconds=60,   # AAuth -11: the `created` window (advertise as signature_window)
    resource_url="https://api.example",                    # accept person / auth tokens for us
    trusted_ps={"https://ps.example": ""},                 # pinned issuers ("" = discover the JWKS)
    cache_ttl=600,                 # key-directory cache seconds
), is_revoked=meter.is_revoked,    # optional: name revoked tokens as revoked
   replay_guard=InMemoryReplayGuard())  # optional: refuse a signature seen before (per process)

Pass your app's shared client to reuse its pool: HttpsigVerifier(http_client=my_async_client).

One deliberate deviation from -01: max_age_hours (25) bounds the age of created even when expires is later. -01 sets no upper bound (it recommends expires at most 24 hours after created), but its own test vectors expire in 2124, and -01 §6.9 says a precomputed signature must not become a long-lived credential. A signer whose signatures are meant to live longer than 25 hours is refused; raise max_age_hours to accept it.

Web Bot Auth defaults are the draft's minimum, not a payment profile. Under -01 a signature must cover @authority (or @target-uri) and its Signature-Agent member, and carry expires; expires has no grace and created may be at most 5 seconds ahead of your clock. Such a signature is valid for any method, path and body sent to your host until it expires (-01 §5.2 says so itself). If a verified Web Bot Auth request can move money or change state, set at least:

HttpsigConfig(
    wba_required_components=("@method", "@authority", "@path", "signature-agent",
                             "content-digest"),   # bind method, path and (when present) body
    wba_max_validity_seconds=300,                  # at most 5 minutes between created and expires
)

and pass the request body to verify() (the FastAPI layer does), plus a replay guard. Signers that cover less are then refused with invalid_input and the list of components you require. When you pass the body, the body decides whether the request has one (an empty body is no body, whatever the framing says). When you do not, the request's own framing decides (Content-Length above zero, Transfer-Encoding, Content-Digest); if it then must cover content-digest, it is refused, because a digest nobody checks binds nothing.

Replay

A valid signature can be presented again, by anyone who saw it, until it expires (or, on the AAuth path, until its 60-second created window closes). The verifier does not stop this unless you give it a replay guard, or your application makes the action idempotent itself:

from regent_httpsig import HttpsigVerifier, InMemoryReplayGuard

verifier = HttpsigVerifier(config, replay_guard=InMemoryReplayGuard(max_entries=100_000))

With a guard, the second presentation is refused with invalid_signature ("already used") on both paths. Verify each request once: a second verify() of the same request is a replay too (the FastAPI dependencies and BudgetMiddleware share one result per request). "The same" means the same key and the same signature base (every covered value plus created, expires and any nonce), not the same Signature bytes — an ECDSA signature has a twin that verifies too — and not the label, which intermediaries may change. AAuth has no Signature-Error code for replay; invalid_signature is the code -11 already gives a signature that verifies but is no longer acceptable, and the agent's remedy is the same: sign again.

The guard keeps state for signers nobody has vetted, so both what it remembers and what it admits are bounded (-01 Appendix C.6):

  • Window. With a guard, a signature is admitted only replay_window_seconds (default 300) after its created, and remembered until min(expires, created + window + 1) — never 25 hours.
  • Partition. Each signature is filed under the host that vouches for its key: the Web Bot Auth directory's host, the AAuth issuer's, or the AAuth server's — the ASCII name httpx connects to (IDNA 2008), lowercase, trailing dot stripped, port and scheme ignored. Minting keys, keyids, JWK Set URLs or ports on one host stays in one partition, and InMemoryReplayGuard lets one partition hold at most max_share (default 10%) of max_entries. A partition over its share is refused; other hosts are not.
  • What remains. No public-suffix list is consulted, so every subdomain is its own host: a signer controlling many subdomains takes one share per subdomain, and ten of them (at the default share), each at its cap within one window, can still fill the guard, which then refuses everybody new until entries expire (at most 306 s later: the 300-second window, the 5 seconds created may be ahead of your clock, and one). That takes max_entries verified signatures per window — a volumetric attack. In the other direction, co-tenants of one shared host (object storage, a platform serving per-agent JWK Sets) share one partition, and one tenant can exhaust it for the others; so can the agents of one open AAuth issuer. The knobs are max_share and max_entries, and a rate limit in front of the service.

InMemoryReplayGuard is per process and never evicts a live entry: when a partition or the whole guard is full it refuses (fail closed). Size it so that max_entries * max_share covers your busiest legitimate host's verified requests per window. For more than one process, implement the ReplayGuard protocol over a shared store:

class ReplayGuard(Protocol):
    async def first_use(self, key: str, *, until: int, partition: str) -> bool: ...
    # True: first use, now remembered until `until`; False: seen before.
    # Raise ReplayGuardFull(partition=...) when it cannot remember; any other
    # exception means "unknown". Both make the verifier refuse.

for example Redis SET key 1 NX EXAT until plus a per-partition counter that expires with the window.

Honest limitations

  • Web Bot Auth and AAuth are IETF drafts (RFC 9421 itself is a final standard). We track the drafts; breaking draft changes land as minor releases while we're 0.x.
  • Web Bot Auth is Ed25519 only. The directories checked on 1 December 2026 (chatgpt.com, agent.bot.goog) publish Ed25519 keys; -01 allows any registered algorithm (its vectors include RSA-PSS), and such signatures are refused here. AAuth possession keys may be Ed25519 or P-256 (ES256); RS256 is accepted for issuer keys.
  • On the AAuth path a request with a body must cover content-digest and content-type (-11 §11.3.3.1) and the digest is checked against the body you pass — so pass it: such a request is refused without it. The FastAPI layer reads the body for you. On the Web Bot Auth path -01 requires no body coverage; list content-digest in wba_required_components to require it.
  • Web Bot Auth, not done: only the first web-bot-auth signature of a request is verified (-01 lets a request carry several); directory response signatures (-01 Appendix B) are not checked; known test keys are not refused (-01 §6.8, a SHOULD); directories are cached for a fixed cache_ttl, not by their Cache-Control, and an unknown keyid does not trigger a refetch; the directory's media type is not checked.
  • Identifiers are normalised as URIs only (RFC 3986), with no IRI mapping: a path written with non-ASCII characters and the same path percent-encoded are two identifiers. Signature-Agent values are ASCII by construction, so this matters only for URLs you configure yourself (trusted_agents, public_origins): write them percent-encoded.
  • EgressSigner still sends the legacy sf-string Signature-Agent, which -01 keeps only for migration (signers MUST send the dictionary form). It is what OpenAI's Cloud browser sends.
  • The in-memory replay guard is per process (see Replay).
  • Not in 0.8: issuing person/resource tokens, missions, the 202 deferred requirement=auth-token, federated mode — the PS half of the protocol.

Related projects

cloudflare/web-bot-auth (TypeScript/Rust) · christian-posta/aauth-python-library (full AAuth protocol) · pyauth/http-message-signatures (the RFC 9421 primitive this builds on)


Built by Regent Protocol — runtime control and identity for AI agents. Apache-2.0.

About

Verify and sign AI agent HTTP traffic in Python — RFC 9421 · Web Bot Auth · AAuth

Topics

Resources

Contributing

Security policy

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages