One buyer requests six components. Another buyer requests six more. Both check the catalogue at the same instant and see eight available. Each request appears possible in isolation. Together, they require twelve.
This hypothetical example does not need artificial intelligence to occur. But if agents handle supplier comparison and order preparation, the gap between checking, choosing and confirming can involve more systems and more competing requests.
Before teaching an agent to choose the best offer, I would begin with a less impressive question: who guarantees that the quantity will still be available when it decides to buy? A search result is not a reservation, and a reservation is not a purchase.
A catalogue describes an observation
The agent might consult a page, an API or a local copy of a supplier’s data. Each route provides information about availability, with different delays and guarantees. None automatically turns that information into a commitment.
An interface can say that an item is in stock while still allowing another person to buy the last units before confirmation. Even a response that has just arrived can stop representing the situation a moment later.
An AI integration for business purchasing should therefore preserve the distinction between observed availability and secured quantity. If the supplier offers no reservation mechanism, the product should explain that availability will be established at purchase. It should not invent a guarantee the integration cannot obtain.
Start with the quantity that can actually be sold
Imagine ten physical units in the warehouse, two already committed to an order and no temporary reservations. Eight remain for new requests. In a simplified model without damaged units, incoming deliveries or sales beyond stock, the relationship is:
available = on hand - committed - active reservations
This is the model used in our example, not a universal inventory definition. Shopify’s inventory-state documentation also distinguishes on-hand, available and committed quantities, but an integration must respect the meanings of the states it actually receives.
If the first reservation for six units is accepted, two units remain available. The second request for six no longer fits. Its agent can seek another offer or ask the buyer to decide on a different quantity; it must not promise six based on the earlier query.
| Stage in the example | On hand | Committed | Active reservations | Available |
|---|---|---|---|---|
| Before the requests | 10 | 2 | 0 | 8 |
| First reservation for six accepted | 10 | 2 | 6 | 2 |
| That reservation converted into an order | 10 | 8 | 0 | 2 |
At confirmation, the reserved quantity changes category. It must not be subtracted from availability a second time. This operational accounting error can block sales even when it does not cause overselling.
Checking capacity and reserving it must be one decision
The dangerous sequence is to read availability, wait and later write a reservation independently of that reading. Two processes can both conclude that capacity is sufficient before either consumes its quantity.
If the application controls inventory in a database, the capacity condition and corresponding change should be coordinated in an appropriate transaction. The PostgreSQL isolation documentation explains why a read does not freeze state for a later modification. The specific mechanism depends on the chosen operations and isolation.
One option is to check capacity and consume it in the same conditional update. Another is to lock the capacity record briefly while checking and changing quantity. Putting a read and a write inside a transaction, without handling concurrency between them, does not automatically make the decision safe.
I would also require the reservation record and temporary capacity consumption to commit together. Consuming quantity without recording who holds it creates unexplained unavailable stock. Saving a reservation without consuming capacity permits incompatible promises.
In an enterprise B2B SaaS product, the reservation needs to identify at least the customer, product, supply location, quantity, state and deadline. Reserving at the wrong warehouse does not fulfil the promise made to the buyer.
Do not hold a database lock while waiting for a person
A technical lock can protect a short modification. It should not be confused with the business reservation that lets a buyer consider a proposal for a while.
PostgreSQL locks have a lifecycle tied to transactions. Keeping a transaction open while waiting for human approval mixes that mechanism with a commercial deadline and can block competing work.
Instead, save an explicit reservation, finish the short transaction and allow the process to continue later using that record. When confirmation arrives, validate the reservation again within a new controlled operation.
This also makes state easier to explain. Rather than an invisible technical session, there is a quantity temporarily assigned to a particular request. The distinction matters when an agent changes devices, loses its connection or is replaced by another process.
The deadline belongs to the system that owns the reservation
An on-screen countdown can help the buyer, but it is not the authority that determines whether a reservation has expired. The responsible service should check validity when confirming, using its clock and rules.
If confirmation and expiry arrive almost simultaneously, only one transition should win. A confirmed reservation must not later be released by a delayed expiry job. An expired reservation must not return to life because an agent retained an old response.
Renewal needs the same care. If the deadline has been extended, an old release instruction should recognise that it no longer matches the current version. Reservation identity remains stable; the conditions currently in force must be checked again.
The appropriate duration depends on the process. I would consider decision time, product scarcity and the cost of temporarily removing it from sale. I would not choose a universal value simply because a provider uses it in a different checkout.
Repeating a request and competing for capacity are different problems
If the response to reservation creation is lost, the agent needs to establish whether the reservation exists before creating another. A request reference should recover the same logical operation where that behaviour is part of the service contract.
This is where idempotency keys become relevant. But two customers making different requests can still compete for the same resource. Recognising retries does not replace the rule that limits the sum of accepted reservations.
I would also limit how many reservations one purchasing intention can accumulate. An assistant holding the same product with several suppliers while comparing offers can reduce availability for other buyers. That flexibility needs limits on quantity, duration and commercial authority, plus an explicit policy for releasing abandoned alternatives.
Money and stock have separate clocks
A payment authorisation can exist without a reserved product. A product reservation can remain active after payment can no longer be completed under the expected conditions.
Stripe’s documentation on separate authorisation and capture describes a payment mechanism with its own validity. It is not inventory confirmation. The application must coordinate those commitments without assuming their deadlines coincide.
Before confirmation, I would also verify the offer revision: quantity, price, currency, supplier, location and delivery conditions. Reserving a quantity does not grant authority to accept a different price or a delivery date the buyer has not approved.
If one stage completes and another fails, recovery should address the specific outstanding commitment. Cancelling everything by default can be as wrong as continuing without confirmation. The product must know which decision still falls within its existing authority.
What to test before allowing the agent to buy
In a controlled test environment, I would send both requests for six against the eight available units. I would examine the total quantity actually reserved, rather than just the two responses shown to the agents.
I would then repeat the same request, deliver a confirmation after expiry and delay an expiry message until after valid confirmation. I would also interrupt the process between changing capacity and recording the reservation. None of those scenarios should leave quantity without an owner or release the same reservation twice.
These are proposed acceptance criteria, not reported measurements. An external integration also requires checking the supplier’s actual contract and behaviour, including lost responses.
Future autonomy depends on this established distinction
If assistants prepare more purchases in parallel between 2026 and 2030, my criterion will not be how quickly they find an offer. It will be how clearly they distinguish a possibility from a commitment, and whether they preserve that distinction when work is interrupted.
A business application that cannot explain who owns each reservation does not become ready for autonomous purchasing by adding a language model. Start by making quantity, deadlines and confirmation verifiable. Only then delegate the decision those rules can actually support.
[+] On this page 16 topics ▼
- A catalogue describes an observation
- Start with the quantity that can actually be sold
- Checking capacity and reserving it must be one decision
- Do not hold a database lock while waiting for a person
- The deadline belongs to the system that owns the reservation
- Repeating a request and competing for capacity are different problems
- Money and stock have separate clocks
- What to test before allowing the agent to buy
- Future autonomy depends on this established distinction
- Author
- Frequently Asked Questions
- Is checking availability enough to promise a purchase?
- Does an idempotency key stop two buyers reserving the same stock?
- Does a payment authorisation also reserve the product?
- Related Articles
- Continue reading
Frequently Asked Questions
Is checking availability enough to promise a purchase?
No. A query returns an observation that can become outdated. Promising quantity requires a reservation or another commitment acknowledged by the system that controls availability.
Does an idempotency key stop two buyers reserving the same stock?
Not by itself. The key recognises a repeated logical operation. Different buyers can submit distinct, legitimate operations; reservation admission still needs a capacity control.
Does a payment authorisation also reserve the product?
No. Payment authorisation and product availability belong to separate processes. The application must coordinate their states, deadlines and corrections rather than assuming either confirms the other.
Related
Start your project
Need a website that earns trust, ranks in search, and gives your business a stronger digital presence? Start the conversation here.