qerexa-langchain
Gate every LangChain agent action through Qerexa runtime trust enforcement.
When an AI agent tries to do something consequential — write to a database, send a payment, deploy code, delete records — this package routes that action through a Qerexa gate first. The gate evaluates policy, optionally requires human approval, and records the decision in a tamper-evident audit chain. The action only runs if the gate allows it.
Built for the EU AI Act Article 14 human-oversight requirement, enforceable August 2026.
Install
pip install qerexa-langchain
Quickstart
from qerexa_langchain import QerexaClient, gated
qerexa = QerexaClient(api_key="sk_live_...") # or set QEREXA_API_KEY
@gated(action="database.write", client=qerexa)
def write_record(data: str) -> str:
# This body only executes if Qerexa allows the action.
return db.insert(data)
If the gate blocks the action, write_record never runs — it raises GateBlockedError. If the action requires human approval, the call blocks until an approver decides (or times out).
Gate an existing LangChain tool
from langchain_core.tools import tool
from qerexa_langchain import QerexaClient, gate_tool
qerexa = QerexaClient(api_key="sk_live_...")
@tool
def transfer_funds(amount: float, to: str) -> str:
"""Transfer funds to a recipient."""
return payments.send(amount, to)
# Wrap it — every invocation now passes through the gate.
safe_transfer = gate_tool(transfer_funds, client=qerexa, action="payment.transfer")
agent = create_agent(llm, tools=[safe_transfer])
Let the agent reason about a block
By default a block raises. Pass on_block to return a message the agent can read and act on instead:
@gated(
action="database.delete",
client=qerexa,
on_block=lambda err: f"Action blocked by policy: {err.reason}. Ask a human to approve.",
)
def delete_records(query: str) -> str:
return db.delete(query)
Human-in-the-loop approval
When a Qerexa policy marks an action as requiring approval, the gate holds it and notifies the approver. The call waits until a decision is made:
qerexa = QerexaClient(
api_key="sk_live_...",
approval_timeout=600, # wait up to 10 minutes for a human
poll_interval=3,
)
@gated(action="production.deploy", client=qerexa)
def deploy(service: str) -> str:
return k8s.rollout(service)
Set wait_for_approval=False on the decorator to fail fast instead of waiting.
Configuration
| Setting | Env var | Default |
|---|---|---|
| API key | QEREXA_API_KEY |
required |
| Base URL | QEREXA_BASE_URL |
https://api.qerexa.com |
The distribution includes a py.typed marker, so type checkers can consume the
package's inline type annotations.
Why gate agent actions?
Your IAM knows the agent is authenticated. Your infrastructure runs what it's told. Nothing in between enforces whether a specific action, against a specific target, at a specific moment, is authorized — with proof. An AI agent can fire a thousand actions a minute. Qerexa is the enforcement layer in that gap.
Every gate decision is written to Qerexa's tamper-evident audit chain. Completed human approvals are published into the Merkle transparency ledger and become independently verifiable after the corresponding root is published.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qerexa_langchain-0.1.0.tar.gz.
File metadata
- Download URL: qerexa_langchain-0.1.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63fa17bfb6c86898d49008b84ef333fbe1f58246a3e2c8fe0c23481ede9cdf1c
|
|
| MD5 |
59357849905acbbdf338969792def501
|
|
| BLAKE2b-256 |
7adcdb6f2a7e161f5584f52258bf7c2bac9db7f3d22230958d2e42e384b9bb21
|
Provenance
The following attestation bundles were made for qerexa_langchain-0.1.0.tar.gz:
Publisher:
langchain-sdk-release.yml on rodriguew/Trust-Rails
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qerexa_langchain-0.1.0.tar.gz -
Subject digest:
63fa17bfb6c86898d49008b84ef333fbe1f58246a3e2c8fe0c23481ede9cdf1c - Sigstore transparency entry: 2617651144
- Sigstore integration time:
-
Permalink:
rodriguew/Trust-Rails@c42c9a3f8ccc82682bc41782c7ff94f81d1a3f73 -
Branch / Tag:
refs/tags/langchain-v0.1.0 - Owner: https://github.com/rodriguew
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
langchain-sdk-release.yml@c42c9a3f8ccc82682bc41782c7ff94f81d1a3f73 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file qerexa_langchain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: qerexa_langchain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
752cc66f7a08480d03ec507f6aa3c95b29346276a7a0e5e3de765f50507cb9a7
|
|
| MD5 |
99a8a4079653a5779ab29db85a66ef00
|
|
| BLAKE2b-256 |
b85b6cea125221edbfbf019d541b803bfc5f2a150422515ededd7faca4986b96
|
Provenance
The following attestation bundles were made for qerexa_langchain-0.1.0-py3-none-any.whl:
Publisher:
langchain-sdk-release.yml on rodriguew/Trust-Rails
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qerexa_langchain-0.1.0-py3-none-any.whl -
Subject digest:
752cc66f7a08480d03ec507f6aa3c95b29346276a7a0e5e3de765f50507cb9a7 - Sigstore transparency entry: 2617651150
- Sigstore integration time:
-
Permalink:
rodriguew/Trust-Rails@c42c9a3f8ccc82682bc41782c7ff94f81d1a3f73 -
Branch / Tag:
refs/tags/langchain-v0.1.0 - Owner: https://github.com/rodriguew
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
langchain-sdk-release.yml@c42c9a3f8ccc82682bc41782c7ff94f81d1a3f73 -
Trigger Event:
workflow_dispatch
-
Statement type: