Skip to main content

Traylinx Auth Client (Python)

Sentinel Pass authentication for Traylinx agent-to-agent communication.

2.0.0: the hardened Sentinel Pass client. A major version: Python 3.11+, HTTPS only and stricter credentials break 1.0.x callers, so <2 pins are not upgraded. See HARDENING.md.

Install

Requires Python >=3.11,<4. Runtime dependencies, installed automatically: Requests >=2.34.2,<3, FastAPI >=0.161.0,<1, Pydantic >=2.14.1,<3.

python -m pip install 'traylinx-auth-client>=2,<3'

2.0.0 is the 1.1.0rc1 code unchanged, released 9 November 2026; the JavaScript twin is traylinx-auth-client@2.0.0 on npm. Deployment approval is still integration-specific: see "Deployment gates" in HARDENING.md.

The caller and receiving service should use separate agent identities. The receiver uses its own verifier credentials, verifies the caller's pass with Sentinel, and then applies resource grants. Confirm the verifier OAuth application's owner rather than treating a configured agent UUID as proof of that ownership.

Server release status — 26 October 2026

The Sentinel AUTH/USERS/worker release and a bounded JavaScript html2md consumer are deployed. Those consumer checks are not a new Python production qualification. Python deployments need their own integration-specific approval; extended performance/platform qualification remains separate.

Configure

Supply these values securely through your application's environment or secret manager:

Variable Meaning
TRAYLINX_CLIENT_ID Sentinel OAuth client id
TRAYLINX_CLIENT_SECRET Sentinel OAuth client secret
TRAYLINX_API_BASE_URL Trusted Sentinel HTTPS base URL
TRAYLINX_AGENT_USER_ID Agent UUID

These identify the calling/verifying agent, not credentials for websites it visits. Do not commit credentials or include them in logs.

Call a trusted agent

from traylinx_auth_client import make_a2a_request

# Fixed application-approved destination, not an untrusted input URL.
def fetch_status():
    return make_a2a_request("GET", "https://agent.example/status")

def submit_task():
    return make_a2a_request(
        "POST", "https://agent.example/tasks",
        json={"operation": "inspect"}, timeout=30,
    )

Allowed request options: headers, params, data, json and timeout. Timeouts are seconds. Authentication, host and cookie header overrides are rejected. POST is not automatically replayed.

Verify incoming proof

require_a2a_auth and validate_a2a_request accept the custom header pair X-Agent-Secret-Token / X-Agent-User-Id. require_dual_auth and validate_dual_auth_request additionally accept a Sentinel agent pass in Authorization: Bearer ..., with X-Agent-User-Id. This does not validate ordinary user bearer tokens or arbitrary OAuth tokens.

For resource-level authorization, use verified introspection metadata rather than trusting an agent id supplied in headers:

from traylinx_auth_client import TraylinxAuthClient

client = TraylinxAuthClient()  # Reads the environment above.

def verify_pass(pass_value, claimed_agent_id):
    principal = client.introspect_token(pass_value, claimed_agent_id)
    if not principal["active"]:
        return None
    # Caller must authorize principal["agent_id"] for the requested resource.
    return principal

Validate duplicate/mixed headers before extracting proof in custom middleware. Do not invoke business logic if introspection fails or raises. validate_token(pass_value, agent_id) remains the boolean API. get_agent_request_headers() returns custom agent headers; get_a2a_request_headers() returns agent bearer headers. get_request_headers() is Sentinel-only, not incoming agent proof.

Constructor options include timeout, max_retries, retry_delay, cache_tokens, agent_token_ttl_seconds and refresh_skew_seconds. Set agent_token_ttl_seconds only when the server's pass lifetime has been verified independently.

The client is synchronous. FastAPI authentication decorators bridge blocking I/O through Starlette's thread pool and wrap async endpoints that accept a Request. Do not call the synchronous client directly on an event loop. Coroutine cancellation does not forcibly stop an in-flight Requests operation; see the transport limits below.

Security and compatibility

  • This is Sentinel Pass authentication, not a full A2A task-protocol SDK.
  • HTTPS with certificate verification is required. Credential-bearing redirects, URL userinfo, fragments, duplicate/mixed authentication and credential overrides are rejected. Request/decoded-response bounds are 4 MiB, or 64 KiB for auth responses.
  • Only eligible GET/HEAD operations in the configured client retry path may retry. Token exchanges, introspection, RPC and other writes are never automatically replayed. The high-level remote-agent helper does not promise automatic retries.
  • Access tokens stay with Sentinel. Remote-agent helpers send an agent pass and agent id, not the Sentinel access token. Never send these credentials to an arbitrary URL supplied by a user or scraped page; destinations must be trusted application configuration. This SDK is not an SSRF policy engine.
  • Introspection validates agent binding, scope, active status and expiry. A valid pass authenticates a principal; the application must still authorize access to resources and enforce ownership, grants and quotas.
  • Middleware rejects invalid/missing proof with 401 and fails closed with 503 when verification is unavailable. Never fall back to another principal after failed proof.
  • Access and pass lifetimes are independent. If the server does not return agent_secret_token_expires_in, a pass is not reused across sequential operations unless an operator supplies a verified pass lifetime. Do not guess the lifetime.
  • Header helpers return credentials to the caller. If you use your own HTTP client, TLS, redirects, timeouts, safe destinations and secret-free logging become your responsibility. Do not print or persist returned headers or tokens.

Existing helper entry points remain, but HTTPS enforcement, runtime floors, stricter verification and error behavior are intentional migration changes. See HARDENING.md for the full contract and transport limitations.

Qualification

Tests use synthetic credentials and owned loopback HTTPS fixtures. Local tests do not establish production readiness. Before production adoption, independently review the integration, verify deployed server deactivation/revocation and token lifetimes, and qualify platform support, throughput and cancellation behavior. See QUALIFICATION.md for measured coverage and remaining gates.

Publishing this candidate does not change any server, install it into an existing application, or replace ordinary user-token authentication.

License

MIT. See LICENSE.

Development

poetry install --with dev
poetry run pytest

Metadata

Release files for traylinx-auth-client 2.0.0

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

Source distribution (sdist)

Source distribution for traylinx-auth-client 2.0.0
File Size Uploaded Provenance Actions
traylinx_auth_client-2.0.0.tar.gz 28.6 kB Without provenance Details for traylinx_auth_client-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for traylinx-auth-client 2.0.0
File Interpreter ABI Platform Actions
traylinx_auth_client-2.0.0-py3-none-any.whl Python 3 none any Details for traylinx_auth_client-2.0.0-py3-none-any.whl

Total release size: 53.5 kB

Release files / traylinx_auth_client-2.0.0.tar.gz

Download URL traylinx_auth_client-2.0.0.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5a21255e5f3253a79ffb3b56fd358a5499b124f2f0ba610eceec929ceb2939bd
BLAKE2b-256 checksum
How to use checksums
6d369c9de83545071cde11e4dbd4f88746bbc6798319747aa8d11c0b6f3a242a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.11.10 Darwin/24.6.0

Release files / traylinx_auth_client-2.0.0-py3-none-any.whl

Download URL traylinx_auth_client-2.0.0-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46a0f5d149ba9dde5de2bf75cf91d49f6a3292b19f97bd1a8c08e69e6b73753f
BLAKE2b-256 checksum
How to use checksums
b31517d0869501fc51cd1eac8c577cb118b956051b84f604f9136a4e42ac4bab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.11.10 Darwin/24.6.0

Security for traylinx-auth-client 2.0.0

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