xat-langchain
XAT signing for LangChain. Every tool call gets an Agent-Signature header.
Based on the x-agent-trust extension in the OpenAPI Extensions Registry.
Install
pip install xat-langchain
Usage
Wrap existing tools
from xat_langchain import XATToolkit
toolkit = XATToolkit(key_file="agent.pem", agent_id="my-agent")
signed_tools = toolkit.wrap(existing_tools)
# Every HTTP call these tools make now carries Agent-Signature
agent = create_react_agent(llm, signed_tools)
Decorator
from xat_langchain import xat_tool
import requests
@xat_tool(key_file="agent.pem", agent_id="my-agent")
def search(query: str) -> str:
return requests.get(f"https://api.example.com/search?q={query}").text
With AWS KMS (production)
import boto3
kms = boto3.client("kms", region_name="eu-west-2")
async def kms_sign(data: bytes) -> bytes:
import hashlib
digest = hashlib.sha256(data).digest()
response = kms.sign(
KeyId="arn:aws:kms:eu-west-2:123456:key/abcd",
Message=digest,
MessageType="DIGEST",
SigningAlgorithm="ECDSA_SHA_256"
)
return response["Signature"]
toolkit = XATToolkit(kms_sign=kms_sign, agent_id="prod-agent")
Audit trail
from xat_langchain import XATCallbackHandler
handler = XATCallbackHandler()
agent.invoke({"input": "..."}, config={"callbacks": [handler]})
print(handler.signed_calls)
What it does
- Wraps LangChain tool HTTP calls with automatic
Agent-Signaturesigning - ECDSA P-256 (ES256) over a canonical request string
- Private key never enters memory when using KMS providers
- Works with any LangChain tool that makes HTTP requests
Links
Author
Raza Sharif, CyberSecAI Ltd
License
Apache-2.0
Metadata
Release files for xat-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 |
|---|---|---|---|---|
| xat_langchain-0.1.0.tar.gz | 5.4 kB | Without provenance | Details for xat_langchain-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xat_langchain-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for xat_langchain-0.1.0-py3-none-any.whl |
Total release size: 11.8 kB
Release files / xat_langchain-0.1.0.tar.gz
| Download URL | xat_langchain-0.1.0.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d49439b81f1763984a380cb2e8d1f2ecef8f597bae5710b855328f6cd9fa4fbf
|
|
BLAKE2b-256 checksum How to use checksums |
7ebb9b70ad0a616fbfa0a02a1dcadc82611ec575becdbec9163ea97248ed9536
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / xat_langchain-0.1.0-py3-none-any.whl
| Download URL | xat_langchain-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa60bdbe7fc3c949a21c0ef302a01bdc8907be4c193f9f78de0c3e708150c626
|
|
BLAKE2b-256 checksum How to use checksums |
a1faeca01a1d7338cd5bd7f76f992845812ae5acba2149bab60a8f883565a088
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for xat-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.
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.