Inspiration

An AI agent can find a basket that looks right while still crossing a spending boundary. Shipping can push it over budget, a subscription can slip into a one-time purchase, or prices can change after approval.

REDLINE separates the model’s proposal from permission to spend. Give agents a mission. Keep control of the money.

What it does

REDLINE is an open-source policy enforcement SDK with a reference shopping application.

The user confirms a policy: budget including shipping and tax, required product categories, quantity limits, and one-time purchases. The model searches a controlled catalogue and proposes products. The server calculates the quote, and the deterministic SDK evaluates it.

A rejected basket cannot initiate checkout. The agent can propose a replacement under the same fixed policy. An accepted basket still requires exact human approval, followed by separate PayPal buyer approval.

Changed terms invalidate the old approval. Payment completion requires verified provider evidence, not a browser redirect.

How it was built

The portable TypeScript SDK evaluates policies and produces decisions with reason codes, checks, evaluator versions, and policy/quote hashes.

The reference application uses Next.js, React, Node.js, and PostgreSQL. Groq hosts the real model, which receives only catalogue and proposal tools—no approval or payment tools.

The server integrates with PayPal sandbox Orders APIs. PostgreSQL transactions, reservations, and durable operation records coordinate checkout. Decision receipts preserve the evidence needed for deterministic replay without another payment.

The demonstrated journey

The demo starts with a clearly labeled scripted basket totaling $156.03, rejected against a $150 budget.

The real Groq model then proposes an Orbit Duo microphone and Halo Reference headphones. The server calculates $128 in items, $6.99 shipping, and $10.24 sample tax: $145.23 USD.

Both required categories remain satisfied, and the original policy stays fixed. After exact human approval and separate sandbox buyer approval, the server captures the payment.

An independent read-only PayPal retrieval confirms $145.23 USD, COMPLETED status, and a final capture.

Challenges and lessons

The main challenges were handling model API formats, keeping payment authority outside the model, and preventing stale approvals from authorizing changed baskets.

Another lesson was that a successful API preflight does not prove checkout. The complete buyer-approved capture had to be exercised and independently verified.

Accomplishments

The build passed 42 unit tests and 59 PostgreSQL integration tests, plus type checks, lint, production build, and packaged SDK verification.

The existing SDK example reproduces the seeded budget rejection offline without contacting the model, PayPal, or a database.

Automated failure scenarios use labeled fixtures and simulators. The recorded checkout uses real Groq inference and real PayPal sandbox APIs.

What's next

Expand merchant adapters and policy coverage while preserving the same boundary: models propose, deterministic code checks, humans approve, and provider evidence establishes payment status.

The current reference shop uses seeded products, sample tax, and sandbox payments only.

Built With

Share this project:

Updates

Submission history