Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Traylinx Auth Client (Python)

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

1.1.0rc1: opt-in release candidate. Not qualified for production deployment. Existing stable installations are not upgraded by this release.

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==1.1.0rc1'

Pin the prerelease explicitly. Unpinned stable installs are not the opt-in path.

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 1.1.0rc1

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 1.1.0rc1
File Size Uploaded Provenance Actions
traylinx_auth_client-1.1.0rc1.tar.gz 27.8 kB Without provenance Details for traylinx_auth_client-1.1.0rc1.tar.gz

Built distribution (wheel)

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

Total release size: 52.3 kB

Release files / traylinx_auth_client-1.1.0rc1.tar.gz

Download URL traylinx_auth_client-1.1.0rc1.tar.gz
Size 27.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7ca467a536dca581187b8516085df7200e176b34288464b0f60e69ea7d30fde0
BLAKE2b-256 checksum
How to use checksums
be54c12b2e07618e529854781a9348f67dfe92cf98203b96f2272f9f48549dbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.10

Release files / traylinx_auth_client-1.1.0rc1-py3-none-any.whl

Download URL traylinx_auth_client-1.1.0rc1-py3-none-any.whl
Size 24.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4f6b58bee7e8b654fc09a7ca1a9472258e2d628428e0f2042e6c88794c825ff
BLAKE2b-256 checksum
How to use checksums
08d3811ab0941d8bf87f7e94bfe67635c7b06263918dd7a84e008b3ce1cd2c06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.10

Security for traylinx-auth-client 1.1.0rc1

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