Skip to main content

Quick start

Built-in tool calls (NPV, loan, AML, options) return ToolCallStatus.COMPUTED — meaning the result was computed deterministically but not verified against an LLM claim. Only tools with a custom verification_fn that compare against an LLM output can return ToolCallStatus.APPROVED.

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


Tool call flow

  1. LLM emits tool call with arguments
  2. QWED intercepts and checks for a registered verification_fn
  3. If no verification_fnREJECTED (fail-closed, audited)
  4. If verification_fn exists → execute with error boundary
  5. Returns verified result with cryptographic receipt

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

The check_aml_compliance tool delegates to ComplianceGuard.high_risk_countries for its sanctions list, ensuring a single source of truth across the entire QWED-Finance system.

Black-Scholes input validation

The price_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

Since N-01 fix: price_option delegates to DerivativesGuard.verify_black_scholes() — the same mpmath (30 dp) implementation used by direct guard calls. This guarantees that pricing through the OpenResponses integration and pricing through DerivativesGuard produce identical outputs for identical inputs.
Previously, the integration shipped its own IEEE-754 float-based Black-Scholes routine (math.log/exp/sqrt/erf). Same formula, two precision paths — same input could yield two different outputs depending on 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. A verification_fn is required — tools without one are rejected.
If your verification_fn raises an exception, it will be caught by the error boundary and return ToolCallStatus.ERROR with a descriptive message — the agent loop will not crash.

Audit trail

All tool call outcomes — including rejections — produce cryptographic receipts:
Rejected tool calls (missing verification_fn) are also audited with a receipt containing the rejection reason, ensuring complete compliance traceability.