Skip to main content

Neutral trust layer for AI agents: in-path enforcement + offline-verifiable signed receipts.

Project description

queldrex (Python)

The neutral trust layer for AI agents, for Python. Put Queldrex in the path of your agent so every tool call is authorized before it runs (allow / require approval / deny), scan tool output for injected instructions, and verify the signed receipts offline. Zero dependencies for enforcement; cryptography is an optional extra only for offline receipt verification.

Works with LangChain, LlamaIndex, the MCP Python SDK, or any custom agent loop.

pip install queldrex            # enforcement, zero deps
pip install "queldrex[verify]"  # + offline receipt verification

Enforce a tool call

from queldrex.enforce import Enforcer

q = Enforcer(api_key="qdx_...")          # free key from queldrex.com/console

# Ask before the tool runs. Pass the real call args so a poisoned value on a
# clean tool (an SSRF metadata URL, an SSH-key path) is caught, not just a
# poisoned tool definition.
d = q.authorize(
    {"name": "fetch_url", "description": "Fetches a URL"},
    args={"url": "http://169.254.169.254/latest/meta-data/"},
)
if d["decision"] != "allow":
    ...  # block, or route to a human. d["reasons"] explains why.

# Or throw on a block:
q.guard(tool, args=call_args)            # raises EnforcementDenied unless allowed

# Or wrap a tool callable so every call is authorized first:
safe_fn = q.wrap_tool(descriptor, my_tool_fn)

Async agents (asyncio, LangChain, the MCP SDK) use the _async variants, which never block the event loop and need no extra dependency:

d = await q.authorize_async(tool, args=call_args)
await q.guard_async(tool, args=call_args)
res = await q.scan_output_async(tool_result)

Fail-safe by design. If Queldrex is unreachable it never silently allows; it degrades to your fail_mode (default "ask" → require approval).

Scan tool output (indirect prompt injection)

res = q.scan_output(tool_result, source="web_fetch")
if not res["safe"]:
    ...  # treat as untrusted DATA, do not follow instructions inside it

High-confidence secrets (AWS, Stripe, GitHub, OpenAI, Slack, JWT, ...) are redacted locally before any output is sent, so credentials never leave your machine.

Verify a receipt offline (don't trust us, verify us)

from queldrex.verify import verify_receipt, is_expired, verify_issuer

verify_receipt(receipt)          # Ed25519 signature over the canonical payload
is_expired(receipt)              # past its expiresAt?
verify_issuer(receipt)           # is the key Queldrex's published key? (1 network call)

The receipt format is an open spec: https://queldrex.com/verify/spec. MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

queldrex-0.2.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

queldrex-0.2.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file queldrex-0.2.0.tar.gz.

File metadata

  • Download URL: queldrex-0.2.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for queldrex-0.2.0.tar.gz
Algorithm Hash digest
SHA256 dce7a0bd31af17a78de2af624343087315c42ff48ee4770af9708d0168563fa9
MD5 6be499f8768fb68451b4d853a1437e34
BLAKE2b-256 fc3afa90b12d0dfb1be594fb7ed288039f0e4af9978092239f33b5d551e8704f

See more details on using hashes here.

File details

Details for the file queldrex-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: queldrex-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for queldrex-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f37aa7429694736d952f1f7b8b1f91c0b60e7880e71a91daa654e7d47cc37736
MD5 070aafe8ed303757f207572ef07cecd1
BLAKE2b-256 a5d7fea64430f7fc35329057178ac6faf4297530170577c704676983ee40653b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page