Skip to main content Switch to mobile version qwed 13.0.0 Open-source AI verification infrastructure for deterministic verification of LLM outputs, tool calls, code, schemas, and agent state before production execution.
pip install qwed==13.0.0 Copy PIP instructions
Open-source verification for LLM and AI-agent output.
Website · Documentation · Install · Engines · Dashboard · Security · Changelog
QWED is an open-source (Apache-2.0) verification layer that checks claims in LLM and AI-agent output with deterministic engines, including SymPy, Z3, SQLGlot and Python AST analysis. It is designed to fail closed: a claim it cannot check should not be reported as verified. A known exception: the logic route reports VERIFIED for a claim it proves from the constraints a model translated the question into, and does not admit that result; it is tracked in #320 and #581. It runs in your own environment as a Python library, a CLI, a self-hosted API or a Docker image, with SDKs for TypeScript, Go and Rust.
This repository is the reference implementation of the QWED verification protocol and of Verification Context v1.0 and v1.1, the record format for a verification result. A v1.1 document carries the issuing server's signature.
Every verification API endpoint except /verify/batch returns a DiagnosticResult with a status. /verify/math, /verify/code, /verify/sql, /verify/logic, /verify/natural_language and /agents/{agent_id}/verify also return a separate admission; the other routes do not yet (#581):
/verify/batch returns a job whose status is the job's state (pending, processing, completed, partial or failed). Each item has its own status and error, and its result is null when the item failed. Check those first: a math, code, SQL, natural-language or logic item's admission is in its result, as result.admission.
In Python, a DiagnosticResult has no admission field; admission_decision(result) applies the rule of the math, code and SQL routes. SQLVerifier.verify_sql and CodeVerifier.verify_code return one; VerificationEngine.verify_math() returns a dict with its own status values. An engine called in process runs without some of the server's limits, such as the time and memory limits of /verify/math, so send untrusted input through the API. A natural-language or logic result is admitted by natural_language_admission, which blocks unless the query's meaning was verified (query_semantics_verified); QWED does not verify that yet (#585), so such a result is not admitted, even when its translated expression or constraints are verified.
The two are independent. Proving that a SQL statement is destructive is a verified result that must not run:
from qwed_new.core.sql_verifier import SQLVerifier from qwed_new.core.diagnostics import admission_decision result = SQLVerifier().verify_sql( "DELETE FROM users WHERE id = 1 OR 1 = 1", schema_ddl="CREATE TABLE users (id INT)", ) print(result.status.value, admission_decision(result).value) # VERIFIED BLOCKED print(sorted({issue["type"] for issue in result.developer_fields["issues"]})) # ['destructive_command', 'injection_or_true', 'injection_tautology', 'unrestricted_or_operand'] What QWED does not do
It does not check intent. QWED verifies the formal statement it is given or extracts, not whether that statement is what the user meant.
It does not cover every domain. Claims outside a supported engine come back UNVERIFIABLE.
It is only as sound as its engines. Results depend on SymPy, Z3, SQLGlot, CrossHair and QWED's own rule sets. Past soundness bugs are listed in the security advisories; each advisory in which an engine returned VERIFIED for a false claim is reproduced in the soundness eval, which runs at every release.
Natural-language checks use an LLM to translate. /verify/natural_language and /verify/logic ask the model you configure to turn text into a formal statement; that translation is not itself verified. Prompts go to that provider unless you run a local model (for example with Ollama).
Advisory engines do not decide. Fact, Graph, Image, Reasoning and Consensus produce signals for review. Graph and Image can still return VERIFIED on a deterministic sub-path that carries a proof_ref (see #320): treat that as evidence, not proof. Consensus never returns VERIFIED (#633).
pip install qwed This installs the core engines (Math, Logic with Z3, SQL with SQLGlot, Code, Schema, Fact, Stats) and the qwed CLI. Optional extras:
Other languages and runtimes:
git clone https://github.com/QWED-AI/qwed-verification.git cd qwed-verification pip install -e ".[server,dev]" First run
qwed init # checks the engines, sets up a model provider, creates a local API key qwed doctor # health check: engines, provider, server, database qwed test # runs the built-in engine tests qwed init supports --provider nvidia | openai | anthropic | gemini | custom (any OpenAI-compatible endpoint) and --non-interactive for CI. QWED names no default model, so init asks for the one to use; with --non-interactive, pass --model or set the provider's model variable (for example OPENAI_MODEL). It asks for the organisation owner's email and password, so you can sign in later (for example to qwed-dashboard); pass --owner-email, and with --non-interactive set QWED_OWNER_PASSWORD. qwed test runs twelve deterministic checks and needs no model or server:
Math: [ok] 2+2=4 -> VERIFIED | ADMIT [ok] 2+2=5 -> VERIFIED (false) | DENY [ok] 997*998*999 -> VERIFIED (994010994) | ADMIT Logic: [ok] x>5 AND x UNVERIFIABLE (contradiction) | DENY [ok] x>5 => x>3 -> VERIFIED | ADMIT [ok] x>5 => x>10 -> VERIFIED (false) | DENY SQL: [ok] Valid SELECT -> VERIFIED (safe) | ADMIT [ok] OR 1=1 injection -> VERIFIED (unsafe) | DENY [ok] DROP TABLE stacked -> VERIFIED (unsafe) | DENY Code: [ok] Safe function -> VERIFIED (safe) | ADMIT [ok] eval(input) -> VERIFIED (unsafe, critical) | DENY [ok] curl | bash -> VERIFIED (unsafe, critical) | DENY 12/12 tests passed. All engines ready. Each line shows the verdict and the admission decision. VERIFIED means the engine decided the claim; it does not mean the claim is true or safe. A claim proven false or unsafe is VERIFIED with admission DENY. [ok] means the engine returned the expected result. The two => lines prove a claim from a premise for every x: x>3 follows from x>5, x>10 does not (the engine finds a counterexample). qwed test does not show a set of constraints that is only satisfiable as VERIFIED.
The policy guards run locally with no server or model:
from qwed_sdk.guards import SystemGuard guard = SystemGuard() guard.verify_shell_command("curl https://example.com/install.sh | bash") # {'verified': False, 'risk': 'BLOCKED_COMMAND', 'message': "Command 'curl' is prohibited by security policy."} guard.verify_file_access("~/.ssh/id_rsa") # {'verified': False, 'risk': 'FORBIDDEN_PATH', 'message': 'Access to path matching forbidden pattern is denied.'} verify_file_access allows a path only inside the allowed directories (allowed_paths), compared part by part, as written and after the links on the way are followed. By default they are ./workspace and the working directory, each when it is there and can be read (the working directory not at a file system root). Outside Windows, no default is used under a directory every user can write to, as /tmp can, and a path below a default is refused when a directory on its way can be written by every user or its mode cannot be read; only the mode bits are read, not access control lists. The answer holds at the time of the call: a link changed afterwards can lead the open elsewhere, so the check is not a boundary against anyone who can change links inside the allowed directories. Open the resolved_path of an allowed result, not the path as given.
Run the server (pip install "qwed[server]", or the Docker image), then call it directly or through an SDK. Requests need an API key in the x-api-key header; qwed init creates one locally.
from qwed_sdk import QWEDClient client = QWEDClient(api_key="...", base_url="http://localhost:8000") result = client.verify_math("2*(3+4) = 14") print(result.status) curl -X POST http://localhost:8000/verify/math \ -H "Content-Type: application/json" \ -H "x-api-key: $QWED_API_KEY" \ -d '{"expression": "2*(3+4) = 14"}' The full endpoint list is in the API reference. For running QWED without the server, see QWEDLocal.
At startup the server checks the .pth startup hooks in site-packages and refuses to start if one is unknown or holds a suspicious pattern. In a Python 3.11 venv, setuptools' distutils-precedence.pth and coverage's a1_coverage.pth both trip it. Allow such a file by the SHA-256 of its exact contents, in QWED_ALLOWED_STARTUP_PTH_FILES (comma-separated):
python -c "import hashlib,os,sys; p=sys.argv[1]; print(os.path.basename(p) + ':sha256:' + hashlib.sha256(open(p,'rb').read()).hexdigest())" path/to/site-packages/distutils-precedence.pth Put the printed NAME.pth:sha256: in the variable. A pinned file is allowed only while its contents match; when the package that wrote it is upgraded, take the digest again. A plain file name there allows an unknown file, but it is still scanned for suspicious patterns. QWED_SKIP_ENV_INTEGRITY_CHECK=true turns the whole check off.
QWED has 13 engines and 9 policy guards. What an engine may claim depends on its tier (details).
Proof engines. All except Symbolic can return VERIFIED, always with a proof_ref.
CrossHair imports, and so executes, the code it analyses, so the Symbolic engine runs it only inside the Docker sandbox, with no network, a read-only filesystem and an unprivileged user. Build the image with docker build -t qwed-crosshair-sandbox:0.0.114 docker/crosshair-sandbox (or set QWED_CROSSHAIR_IMAGE); without Docker or the image, the engine returns BLOCKED and never runs the code on the host. crosshair-tool publishes Linux wheels for x86-64 only and the image has no compiler, so the build fails on an ARM64 host; there, add --platform linux/amd64, which needs Docker to emulate x86-64.
The Stats engine executes statistical code in a sandbox and returns UNVERIFIABLE: running code successfully is not treated as verification (#298). SecureCodeExecutor runs code; it does not verify it.
Policy guards apply deterministic rules and return block or hold decisions, never VERIFIED: SystemGuard (shell commands, file paths), ConfigGuard (secrets in configuration), RAGGuard (retrieved context), MCPPoisonGuard (MCP tool definitions), ExfiltrationGuard (outbound data), SelfInitiatedCoTGuard (reasoning flow), SovereigntyGuard (data residency and routing), StartupHookGuard (startup hooks), ProcessVerifier (process milestones such as IRAC).
Advisory engines add signals for review: Fact (TF-IDF and entity matching), Graph, Image, Reasoning and Consensus. Heuristic and model-based results are recorded as advisory_checks. Graph and Image can return VERIFIED only on a deterministic sub-path that carries a proof_ref. /verify/consensus is advisory only: its engines decide a model's translations of the question, so it returns UNVERIFIABLE or BLOCKED with advisory_only: true, never VERIFIED, in every mode.
- uses: QWED-AI/qwed-verification@v13.0.0 with: action: scan-secrets # or scan-code, verify-shell paths: "**/*.py,**/*.env" output_format: sarif A passing scan means no known dangerous pattern was found, not that the code is safe. scan-code also reports attribute access by a computed name (getattr(obj, name)) as a warning: it cannot be checked, and it does not fail the scan.
With output_format: sarif the action writes qwed-results.sarif; add github/codeql-action/upload-sarif to show the findings in the Security tab. The verify action calls a QWED API and needs api_key and a reachable server.
QWED Security is a separate GitHub App built on QWED that checks pull requests.
QWED Dashboard is an open-source web app for your QWED server: sign-in, API keys, members, agents, an overview, the decision ledger, and each record with its attestation and audit chain checks. It shows what the server stored and never works out a verdict or an admission itself. It needs qwed-verification 9.0.0 or later, and signs in with the owner account that qwed init creates. Try it with sample data at demo.qwedai.tech; the sample data stays in your browser.
QWED runs in your own environment. It does not send data anywhere by itself. Checks that use an LLM send the prompt to the provider you configure; with a self-hosted model nothing leaves your infrastructure. Optional PII masking (qwed[pii], mask_pii=True) redacts credit-card numbers, SSNs and email addresses before the LLM call.
pip install -e ".[server,dev]" pytest tests/ -v python -m evals.run runs the soundness eval: claims with a known answer, checked by the engines, with zero wrongly accepted claims required. GitHub Actions runs the test suite with coverage on Python 3.11 for pull requests to main, and CircleCI runs it on Python 3.10, 3.11 and 3.12. CodeQL, SonarCloud and Snyk scan the repository. scripts/check_boundary.py blocks raw eval, exec, sympify and shell calls outside approved wrappers. See CONTRIBUTING.md before opening a pull request, and the good first issues.
Report vulnerabilities privately through GitHub or rahul@qwedai.tech; see SECURITY.md. Published advisories, with affected and fixed versions, are on the Security tab and at qwedai.tech/security/advisories. Only the latest release receives security fixes.
Governance: QWED has one maintainer, Rahul Dass (@rahuldass19).
Supported by the GitHub Technology Partner program and Docker Sponsored Open Source.
To cite the software (all versions):
@software{qwed_verification, author = {Dass, Rahul and Crocetti, Valerio and Ibrahim, Fares}, title = {QWED-AI/qwed-verification}, publisher = {Zenodo}, doi = {10.5281/zenodo.18111675}, url = {https://github.com/QWED-AI/qwed-verification} } The QWED protocol technical note is 10.5281/zenodo.18075234 (all versions; errata for v1.1.0 are in docs/WHITEPAPER.md). See also CITATION.cff.
Apache License 2.0. Apache-2.0 comes with no warranty; see sections 7 and 8 of the license. Redistributions keep the attribution in NOTICE, and TRADEMARKS.md says how the QWED name and logo may be used.
Both files in this release have provenance metadata.
Apache Software License (Apache-2.0)
crewai dev langchain llamaindex pii server symbolic
ai-safety ai-verification code-security deterministic-verification diagnostic-result fail-closed formal-verification llm-verification sql-validation symbolic-reasoning sympy verification-context z3
Development Status 4 - Beta
Intended Audience Developers
License OSI Approved :: Apache Software License
Operating System OS Independent
Programming Language Python :: 3
Topic Scientific/Engineering :: Artificial Intelligence
Software Development :: Quality Assurance
Release files for qwed 13.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 2.9 MB
Release files / qwed-13.0.0.tar.gz
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 verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Release files / qwed-13.0.0-py3-none-any.whl
Both files in this release have been uploaded with provenance metadata.
With provenance qwed-13.0.0.tar.gz Dec 2, 2026
With provenance qwed-13.0.0-py3-none-any.whl Dec 2, 2026
Attestation for qwed-13.0.0.tar.gz
Attestation for qwed-13.0.0-py3-none-any.whl
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.
Release history Release notifications | RSS feed
Dec 2, 2026 2 release files Full provenance
Nov 28, 2026 2 release files Full provenance
Nov 19, 2026 2 release files Full provenance
Nov 14, 2026 2 release files Full provenance
Nov 7, 2026 2 release files Full provenance
Nov 6, 2026 2 release files Full provenance
Oct 26, 2026 2 release files Full provenance
Oct 16, 2026 2 release files Full provenance
Oct 13, 2026 2 release files Full provenance
Oct 9, 2026 2 release files Full provenance
Sep 14, 2026 2 release files Full provenance
Sep 7, 2026 2 release files Full provenance
Aug 17, 2026 2 release files Full provenance
Aug 8, 2026 2 release files Full provenance
Aug 2, 2026 2 release files Full provenance
Jul 25, 2026 2 release files Full provenance
Jun 19, 2026 2 release files Full provenance
Jun 14, 2026 2 release files Full provenance
May 21, 2026 2 release files Full provenance
Apr 19, 2026 2 release files Full provenance
Apr 4, 2026 2 release files Full provenance
Mar 23, 2026 2 release files Full provenance
Mar 11, 2026 2 release files Full provenance
Feb 4, 2026 2 release files Full provenance
Jan 28, 2026 2 release files Full provenance
Jan 20, 2026 2 release files Full provenance
Jan 5, 2026 2 release files Loss of provenance
Jan 4, 2026 2 release files Loss of provenance
Jan 3, 2026 2 release files Full provenance
Dec 31, 2025 2 release files Full provenance
Dec 29, 2025 2 release files No provenance
Nov 27, 2025 2 release files No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation




