tenxyte-langchain
LangChain / LangGraph connector for AIRS/1.0 — the open specification for AI agent identity, delegation, and Human-in-the-Loop governance that Tenxyte implements.
A pure HTTP client: it never imports the tenxyte package, and works against any
AIRS-conformant server (discovered at runtime, never hardcoded).
Install
pip install tenxyte-langchain
Minimal example
import httpx
from tenxyte_langchain import TenxyteAIRSClient, TenxyteAgentAuth, TenxyteHITLPending
# 1. A human issues the Agent Token once, out-of-band (e.g. via Tenxyte's own /ai/tokens/ API
# with their own Bearer JWT) — this connector never creates tokens itself.
AGENT_TOKEN = "the-raw-token-value-returned-at-issuance"
TOKEN_ID = 42
client = TenxyteAIRSClient("https://your-tenxyte-server.example.com", agent_token=AGENT_TOKEN)
auth = TenxyteAgentAuth(
AGENT_TOKEN,
client=client,
token_id=TOKEN_ID,
heartbeat_required_every=300, # matches what the token was issued with, if a DMS is set
)
with httpx.Client(base_url=client.base_url, auth=auth) as http:
# Every request through `http` now carries AgentBearer + X-Prompt-Trace-ID automatically.
response = http.post(client.endpoint("report_usage", id=TOKEN_ID), json={"cost_usd": 0.01})
try:
client.request("POST", "/business/invoices/", json={"amount": 500})
except TenxyteHITLPending as pending:
# A human approves pending.confirmation_token through Tenxyte's own API — outside this
# package, by design (see spec/airs/AIRS-1.0.md §11, privilege amplification).
...
response = pending.resume() # after approval
Budget tracking with a LangChain chain
from tenxyte_langchain import TenxyteBudgetCallbackHandler, TenxyteBudgetExceededError
budget_callback = TenxyteBudgetCallbackHandler(
client, TOKEN_ID, cost_per_prompt_token=3e-6, cost_per_completion_token=15e-6
)
try:
llm.invoke("...", config={"callbacks": [budget_callback]})
except TenxyteBudgetExceededError:
# The token has been suspended server-side — stop the agent, don't retry.
raise
HITL with LangGraph interrupt()
from langgraph.types import interrupt
from tenxyte_langchain import TenxyteHITLPending
def sensitive_tool(payload):
try:
return client.request("POST", "/business/refunds/", json=payload)
except TenxyteHITLPending as pending:
# Suspend the graph; a human approves confirmation_token via Tenxyte's own API.
interrupt({"confirmation_token": pending.confirmation_token, "expires_at": pending.expires_at})
return pending.resume()
Design notes
TenxyteAIRSClient: low-level, resolves every endpoint through the target's Discovery Endpoint — nothing is hardcoded.TenxyteAgentAuth: anhttpx.Auth— attach it to anyhttpx.Client(auth=...)for automaticAgentBearer+X-Prompt-Trace-IDon every request, plus an optional background heartbeat thread.- Fail-safe by design: every terminal Agent Token condition (suspended, revoked, expired, budget-exceeded) raises a distinct, typed exception. None of them are meant to be retried with the same token — see [AIRS-CORE-17] and [AIRS-CORE-22] in the specification.
- No privilege amplification: this package never creates Agent Tokens and never confirms or denies a HITL action itself — both stay strictly on the human side of Tenxyte's own API.
License
MIT (this package). The AIRS/1.0 specification it implements is separately licensed CC BY 4.0 —
see spec/airs/LICENSE.
Metadata
Release files for tenxyte-langchain 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tenxyte_langchain-0.1.0.tar.gz | 14.9 kB | With provenance | Details for tenxyte_langchain-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tenxyte_langchain-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for tenxyte_langchain-0.1.0-py3-none-any.whl |
Total release size: 27.4 kB
Release files / tenxyte_langchain-0.1.0.tar.gz
| Download URL | tenxyte_langchain-0.1.0.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f1d60da11e7e7a1097b7b1908ea34c72f3d51a65e7c8bc6aecb3c1b417e34982
|
|
BLAKE2b-256 checksum How to use checksums |
361f1970674c6cb5602a796d6a82ec8e19fe3f0273887997a42cb0f7f5bd1336
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 28, 2026.
Transparency logRelease files / tenxyte_langchain-0.1.0-py3-none-any.whl
| Download URL | tenxyte_langchain-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3b38f2f874e58d190770afed70ff1294dbfb930e737fc72c2b27e28c218cc9b
|
|
BLAKE2b-256 checksum How to use checksums |
b71c86ad5d0574292db7b0385c9adee0b6f244f610c8c484327d99952f2d4cae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 28, 2026.
Transparency logSecurity for tenxyte-langchain 0.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tenxyte_langchain-0.1.0.tar.gz
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 Nov 28, 2026.
Transparency logA 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.