> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwedai.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# QWED: deterministic verification for LLMs and AI agents

> QWED verifies the structured claims an LLM produces with deterministic engines for math, logic, code, and SQL before your AI agent executes or responds.

> [!NOTE]
>
> **QWED v9.1.0 is the current release.** `CodeVerifier` now admits Python code only when the modules, builtins and special attributes it uses are listed, and each LLM provider runs the model you configure. Some code that earlier releases admitted is now refused, so read the [9.1.0](https://docs.qwedai.tech/changelog.md#v9-1-0-—-allowlist-admission-for-python-code) and [9.0.0](https://docs.qwedai.tech/changelog.md#v9-0-0-—-eleven-advisories-and-models-you-configure) upgrade steps before you upgrade.

## What is QWED?

QWED (Query With Evidence & Determinism) is a trust boundary for AI systems:

* LLMs can translate user intent into structured claims.
* QWED verifies those claims with deterministic engines before execution or response.
* You get proof-backed outcomes instead of probability-only confidence.

QWED is designed for LLM verification, AI agent security, verified tool calls, prompt injection defense, and deterministic transaction verification in high-stakes workflows.

> **"Do not trust generated output. Verify it."**

```mermaid theme={null}
flowchart LR
    U[User Query] --> L[LLM Translation]
    L --> Q[QWED Verification]
    Q --> R[Verified Result]

    L -. Untrusted output .-> X[Possible hallucination]
    Q -. Deterministic proof .-> Y[Accepted or rejected]

    classDef untrusted fill:#fff4e5,stroke:#f59e0b,color:#92400e;
    classDef trusted fill:#ecfeff,stroke:#06b6d4,color:#155e75;
    classDef result fill:#ecfdf5,stroke:#22c55e,color:#166534;
    class L,X untrusted;
    class Q,Y trusted;
    class R result;
```

## Explore common verification problems

> [card] [LLM verification](https://docs.qwedai.tech/advanced/llm-verification.md)
>
> Learn how formal verification for LLMs differs from prompting, RAG, and output formatting.

> [card] [AI agent security](https://docs.qwedai.tech/advanced/agent-verification.md)
>
> Add pre-execution checks, policy enforcement, and budget controls for agent actions.

> [card] [Prompt injection defense](https://docs.qwedai.tech/advanced/security-hardening.md)
>
> Harden your stack against prompt injection, exfiltration, and unsafe execution paths.

> [card] [QWED MCP](https://docs.qwedai.tech/mcp/overview.md)
>
> Give MCP clients access to QWED's deterministic verification libraries.

## When to use QWED first

> [card] Math and logic
>
> Verify equations, constraints, and logical claims before they reach users.

> [card] Code and SQL
>
> Catch unsafe patterns, injection risks, and structural errors before execution.

> [card] Agent tool calls
>
> Inspect actions and payloads before external systems are touched.

> [card] High-stakes workflows
>
> Add deterministic checkpoints for finance, legal, tax, and regulated systems.

## Quick start (5 minutes)

```bash theme={null}
pip install qwed==9.1.0
```

The examples below use the `qwed` CLI that this installs. The `qwedai/qwed-verification:9.1.0` Docker image runs the API server instead; see [Self-hosting](https://docs.qwedai.tech/advanced/self-hosting.md#docker).

```bash theme={null}
# Run every engine on known cases (no LLM needed)
qwed test
# Math:
#   [ok] 2+2=4                  -> VERIFIED | ADMIT
#   [ok] 2+2=5                  -> VERIFIED (false) | DENY
#   ...

# Verify logic constraints
qwed verify-logic "(AND (GT x 5) (LT y 10))"
# -> SAT: {x=6, y=9}
```

**1. Install and configure**

Follow [Installation](https://docs.qwedai.tech/getting-started/installation.md) and set your provider with [LLM configuration](https://docs.qwedai.tech/getting-started/llm-configuration.md).

**2. Run first verification**

Use [Quick start](https://docs.qwedai.tech/getting-started/quickstart.md) to validate math, logic, code, and SQL.

**3. Integrate into production flow**

Use [Integration getting started](https://docs.qwedai.tech/integration/getting-started.md) and [Production deployment](https://docs.qwedai.tech/integration/production.md).

## Verification engines at a glance

> [card] [Math](https://docs.qwedai.tech/engines/math.md)
>
> SymPy-based symbolic verification.

> [card] [Logic](https://docs.qwedai.tech/engines/logic.md)
>
> Z3 SAT/SMT verification with models.

> [card] [Code](https://docs.qwedai.tech/engines/code.md)
>
> AST and symbolic checks for risky behavior.

> [card] [SQL](https://docs.qwedai.tech/engines/sql.md)
>
> Parser-backed SQL safety and validation.

> [card] [Schema](https://docs.qwedai.tech/engines/schema.md)
>
> Type and shape validation for structured outputs.

> [card] [Taint](https://docs.qwedai.tech/engines/taint.md)
>
> Data-flow tracking for untrusted inputs.

> [card] [See all engines](https://docs.qwedai.tech/engines/overview.md)
>
> Explore core, analysis, and specialized engines.

## What's new in v9

> [accordion] Allowlist admission for Python code
>
> From v9.1.0, `CodeVerifier` admits Python code only when every module, module name, builtin and special attribute it uses is on a list, and the code reads no attribute's value by a name made at run time (`hasattr` is admitted: it only answers whether an attribute exists, although the lookup can run a property). Each refusal names the module, builtin or attribute. A caller can name modules its own runtime confines with `trusted_modules`, as the code-execution sandbox does for `numpy` and `pandas`; the module checks then skip those modules, so they need that confinement. [Read the 9.1.0 notes →](https://docs.qwedai.tech/changelog.md#v9-1-0-—-allowlist-admission-for-python-code)

> [accordion] Before you upgrade
>
> From v9.0.0, QWED names no model of its own: set your provider's model variable, such as `OPENAI_MODEL` or `ANTHROPIC_MODEL`, and pass `model=` to `QWEDLocal`, `verify()` and `qwed_sdk.integrations.langchain.QWEDTool`. `/verify/math` runs in worker processes with a time limit, the CSV exports change their columns, and the Go module path moves to `/v9`. Upgrade every server process together. [Read the upgrade steps →](https://docs.qwedai.tech/changelog.md#v9-0-0-—-eleven-advisories-and-models-you-configure)

## Recommended learning path

1. [Core concepts](https://docs.qwedai.tech/getting-started/concepts.md)
2. [Architecture overview](https://docs.qwedai.tech/architecture.md)
3. [SDKs overview](https://docs.qwedai.tech/sdks/overview.md)
4. [API overview](https://docs.qwedai.tech/api/overview.md)
5. [Integration guide](https://docs.qwedai.tech/integration/getting-started.md)


## Related topics

- [QWED Protocol: deterministic verification for LLMs](https://docs.qwedai.tech/whitepaper.md)
- [QWED Tax: tax verification for AI agents](https://docs.qwedai.tech/tax/overview.md)
- [QWED Legal: deterministic verification guards for legal AI](https://docs.qwedai.tech/legal/overview.md)
- [Why cloud LLMs for QWED verification?](https://docs.qwedai.tech/advanced/why-cloud-llms.md)
- [QWED Finance: deterministic verification for financial AI](https://docs.qwedai.tech/finance/overview.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.