Skip to main content

Quesen — LangChain / LangGraph Tool

Deterministic Agent Firewall + A2A risk validation as LangChain BaseTools. Integrate in under 5 minutes.

Status: v0.3.0 · tracks Quesen engine v1.10.0 (TSC v2 firewall) · requires quesen-sdk>=0.4.1. Developer portal: https://senueren.co.za/quesen · Source: https://github.com/Shxnque/quesen


Agent Firewall (30-second, no signup)

from quesen_langchain import QuesenFirewallTool

# sandbox=True self-serves a free key against the hosted engine.
firewall = QuesenFirewallTool(
    base_url="https://web-production-3df26.up.railway.app",
    sandbox=True,
)

# Give it to any LangChain/LangGraph agent, or call directly:
verdict = firewall._run(
    agent="my-agent", action="send_data",
    target="https://paste.evil.example", data_class="secret",
)
print(verdict["decision"])                       # 'BLOCK'
print([r["code"] for r in verdict["reasons"]])   # ['EGRESS_SECRET_UNTRUSTED']

action accepts send_data / tool_call / payment (+ aliases). For production pass api_key="sk_live_..." instead of sandbox=True.


Install

pip install quesen-langchain
# or from source while we publish:
pip install git+https://github.com/Shxnque/quesen-langchain.git

Brings quesen-sdk>=0.2.0 and langchain-core with it. No LLM lock-in.


30-second usage

from langchain_core.messages import HumanMessage
from langchain_openai import ChatOpenAI
from quesen_langchain import QuesenValidateTool, QuesenReportTool

validate_tool = QuesenValidateTool(base_url="https://<your-quesen>", api_key="sk_live_abc")
report_tool   = QuesenReportTool(base_url="https://<your-quesen>", api_key="sk_live_abc")

agent = ChatOpenAI(model="gpt-4o-mini").bind_tools([validate_tool, report_tool])
print(agent.invoke([HumanMessage("Should I ape into a 1-day-old token with 4 scam keywords and 95% engagement?")]))

Receipt provenance (v1.10, tracked in v0.2.0)

QuesenValidateTool._run(...) returns the raw response dict verbatim from the underlying quesen-sdk client. When talking to a v1.10.0+ engine that dict includes two additional fields:

  • input_snapshot_hash — 64-char SHA-256 hex over the canonical request payload.
  • commit_sha — 40-char git SHA of the engine ruleset live at decision time (or "unknown").

Both flow through unchanged for downstream LangGraph nodes to consume, log, or verify. See the developer portal API reference for the field contract.


What ships

Tool Wraps Purpose
QuesenValidateTool POST /validate Deterministic PROCEED/REVIEW/SKIP verdict (carries v1.10 provenance)
QuesenSimulateTool POST /simulate Free counterfactual (test the model without spending a call)
QuesenReportTool POST /report Post-decision outcome feedback (v1.1 schema)

All three are langchain_core.tools.BaseTool subclasses with structured Pydantic inputs. Compatible with LangGraph, create_react_agent, bind_tools(), and every LangChain callback pipeline.


Environment

Var Meaning
QUESEN_BASE_URL Optional default base URL (else pass to the tool constructor).
QUESEN_API_KEY Optional default API key.

Doctrine compliance (inherited from parent)

  • Determinism. No prompt-tuning, no randomness in the wrapper.
  • Ecosystem neutrality. Depends on langchain-core only, not on any specific LLM provider.
  • Fail-closed. Timeouts surface as tool errors; recommended agent policy: treat as SKIP.
  • Provenance forwarded. The raw dict returned to the LangChain runtime carries input_snapshot_hash and commit_sha unchanged, so downstream nodes can pin the ruleset.

MIT license. See senueren.co.za/quesen for canonical documentation.

Metadata

Release files for quesen-langchain 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quesen-langchain 0.5.1
File Size Uploaded
quesen_langchain-0.5.1.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for quesen-langchain 0.5.1
File Interpreter ABI Platform
quesen_langchain-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.1 kB

Release files / quesen_langchain-0.5.1.tar.gz

Download URL quesen_langchain-0.5.1.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
67cea208ea62f7928766c1e87d0342d32adecda932d753cb478bb86b3c766f52
BLAKE2b-256 checksum
How to use checksums
68d8e3990088a2f10f0f45a0ff723abe70faf3ab42be3b9080658b81e4c50c76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / quesen_langchain-0.5.1-py3-none-any.whl

Download URL quesen_langchain-0.5.1-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83dacab41ad44325ad5dc984962bf0647caf27b189b6098036d9e54075bad443
BLAKE2b-256 checksum
How to use checksums
b14bf8d054593c24fbc7d0aa05f885914754f1919fbe51bc61b491c962e71d94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.3.0

2 release files

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