AI Purchasing Decision System
AI Purchasing Decision
Workflow
An automated purchasing decision-support system built with Python, LLMs, and public APIs.
An automated purchasing decision-support system
built with Python, LLMs, and public APIs.
PROBLEM
The bottleneck: judgment didn't scale. Most of my e-commerce operation was already automated with virtual assistants and SaaS tools. One task still required me in the loop:
The decision: Every product lead needed a BUY / DEFER / REJECT call, and that meant applying strategic judgment across several data sources at once.
The cost: Because it depended on me, it was the slowest, least scalable step in an otherwise automated pipeline.
After breaking the decision down to its fundamentals, I realized most of it wasn't judgment at all. It was rules I could encode, with only a small slice genuinely ambiguous.
APPROACH
The core idea: separate deterministic from probabilistic logic I split the decision into two layers so the right kind of logic handled each kind of case:
Deterministic gates: Raw data from Keepa and Amazon's SP-API is checked against binary criteria, margin thresholds, ROI floors, velocity checks, risk flags. Anything the data already answers gets resolved here, with no LLM involved. It's cheaper, faster, and more reliable for decisions a conditional can settle.
A two-model LLM layer: Only genuinely ambiguous cases get routed forward, into a Generator-Verifier architecture. A generator reasons in my place using verified facts, a price-history chart, and the specific gate reasons that triggered review, then proposes a decision with cited reasoning.
A validation step between them: Before the second model sees anything, Python confirms every datapoint the generator cited actually exists and wasn't fabricated. The verifier then audits whether the reasoning follows the decision rules.
Quantity sizing: When the output is BUY, a separate model sizes the order from addressable FBA demand, competitor share, and a confidence multiplier based on price stability and stock pressure.
The generator produces the decision, the validator confirms the data, and the verifier audits the logic, a control layer that catches flawed reasoning before execution.
OUTCOME
Evaluation time dropped from ~70s to ~20s per product, a 72% reduction.
Throughput rose from ~50 to ~183 leads/hour, a 3.6x gain in evaluation capacity.
Key insight: Most business processes mix decisions that are already known with decisions that need judgment, but treat them as one task. The leverage is in separating them and applying the right logic to each. That has changed how I look at workflows and where the real leverage points are.