---
title: "QWED UCP"
description: "QWED UCP checks the totals, state and structure of Universal Commerce Protocol checkouts before payment."
url: https://qwedai.com/platform/ucp
---

QWED UCPv0.3.0

# Verify agent checkouts before the money moves.

Verification middleware for the Universal Commerce Protocol. It checks the totals, state and structure of a checkout an agent prepared, before payment.

[Read the documentation](https://docs.qwedai.com/ucp/overview) [Source on GitHub](https://github.com/QWED-AI/qwed-ucp)

At a glance

Version

0.3.0

Status on PyPI

Alpha

Install

pip install qwed-ucp

Also on

GitHub Action (QWED-AI/qwed-ucp@v1)

Model in the check

None

Licence

Apache-2.0

## Guards

-   MoneyGuard

    ### Totals

    Total must equal subtotal minus discount, plus fulfilment, tax and fees.

-   StateGuard

    ### Checkout state

    The checkout must move through valid states.

-   SchemaGuard

    ### Structure

    The checkout must match the UCP v1.0 schema.

-   LineItemsGuard, DiscountGuard, CurrencyGuard

    ### Line items, discounts, currency

    Standalone guards for the parts of a checkout.

-   RefundGuard, TipGuard, FeeGuard

    ### Refunds, tips and fees

    Standalone guards for money added or returned.

-   AttestationGuard

    ### Signed checkouts

    JWT verification with replay protection.

## Mistakes it is built to catch

Nobody checked any of it

### Without QWED UCP

-   **Tax worked out wrong** Tax of 8.25% on $100 charged as $8.00.

-   **Items that do not add up** $50 + $30 + $20 totalled as $110.00.

-   **A discount in the wrong place** A discount applied after tax instead of before.

Each one checked before it is used

### With QWED UCP

1.  **Tax worked out wrong** MoneyGuard 8.25% of $100 is $8.25, so payment is held.

    VERIFIED · DENY
2.  **Items that do not add up** LineItemsGuard The items come to $100.00, so it is held.

    VERIFIED · DENY
3.  **A discount in the wrong place** DiscountGuard Applied in the wrong order, so it is held.

    VERIFIED · DENY

What is proven correct goes through, with a record of why.

QWED returns the decision; your integration acts on it.

## Get started

shell

```
$ pip install qwed-ucp
```

[Documentation](https://docs.qwedai.com/ucp/overview) [Repository](https://github.com/QWED-AI/qwed-ucp) [PyPI](https://pypi.org/project/qwed-ucp/) [Release history](https://qwedai.com/releases)

Good to know

-   It is not a cart, a payment processor or a fraud system.
-   verify\_totals\_only() checks totals alone and should not be treated as a final verdict.
-   Replay protection is kept in memory only.

[**Use case: AI agents** Runtime verification for agents: before an agent runs a tool, messages another agent or makes a purchase, QWED checks the action.](https://qwedai.com/solutions/ai-agents)

## More agents and protocols

-   [Open Responses](https://qwedai.com/platform/open-responses)
-   [MCP server](https://qwedai.com/platform/mcp)
-   [QWED A2A](https://qwedai.com/platform/a2a)
-   [Every package](https://qwedai.com/ecosystem)
