Quick start
Fail-closed default
Since v2.1.0: Tools registered without a
verification_fn are rejected by default. This enforces the QWED principle: “Verification decides IF.”Tool call statuses
ToolCallStatus.MODIFIED exists in the enum for custom verification_fn implementations, but no built-in path returns it.
Tool call flow
- LLM emits tool call with arguments
- QWED intercepts and checks for a registered
verification_fn - If no
verification_fn→ REJECTED (fail-closed, audited) - If
verification_fnexists → execute with error boundary - Returns the result; built-in tools and missing-
verification_fnrejections carry a receipt. A custom tool’s result carries one only if itsverification_fncreates it
Available built-in tools
All built-in tools return
COMPUTED status because they perform deterministic calculations without comparing against an LLM claim.AML country consistency
Thecheck_aml_compliance tool delegates to ComplianceGuard.high_risk_countries for its high-risk country list, so the tool and the guard use the same list.
Black-Scholes input validation
Theprice_option tool rejects non-positive inputs for spot_price, strike_price, time_to_expiry, and volatility before computing, preventing ZeroDivisionError at the math boundary.
Black-Scholes single source of truth
price_option delegates to DerivativesGuard.verify_black_scholes(), the same mpmath (30 decimal places) implementation used by direct guard calls, so pricing through the OpenResponses integration and pricing through DerivativesGuard produce identical outputs for identical inputs.float-based Black-Scholes routine (math.log/exp/sqrt/erf). Same formula, two precision paths: the same input could give two different outputs depending on the call site. The duplicate has been removed.
The tool result now reports the computed price and delta Greek straight from the guard’s quantized Decimal output:
Item wrapper (streaming)
Format results for streaming compatibility:COMPUTED item structure
APPROVED item structure
OpenAI integration
Custom tools
Register your own verified tools. Averification_fn is required: tools without one are rejected.
Audit trail
Built-in tool calls and rejections for a missingverification_fn produce receipts in qwed.audit_log automatically. Results returned by a custom verification_fn are passed through as-is: they carry a receipt only if your function creates one, and they appear in qwed.audit_log only if your function also logs that receipt.