Draft a reply to a buyer, inside your rules
draft_negotiation_replyDraft the seller's reply to a buyer's message — the offer is decided by the SNHP engine INSIDE the policy.
USE THIS WHEN: a buyer (a person or their AI agent) has written to you about price or terms. Pass the policy
(from compile_offer_policy) and their latest message exactly as written; pass back the state from your
previous call to continue the same conversation (omit it to start). flags is what YOUR records confirm
about the buyer (e.g. {"new_customer": true}) — never what the buyer merely claims. stock is the current
stock of what the policy's inventory binds, sent with every message (schema.org Offer, Google Merchant or a
plain feed record): nothing out of stock is offered, and a deal is signed only on fresh records that say it can
be sold.
Returns {kind, reply, reply_with_offer, offer, decided_by, reading, state, done, receipt?}:
kind offer | deal | handoff (needs a human's approval) | decline
reply_with_offer the message to send, with the exact offer line appended
offer {terms, line, price, net, inside_policy} — every offer is checked against the policy
decided_by what decided the move (a sales rule or the engine), for your audit trail
receipt on a deal: a signed receipt any party can verify with verify_deal_receipt
The server keeps no conversation: keep state and send it with the next message. Needs an access_key
(pilot businesses get one at https://snhp.dev/#pilot).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flags | No | What YOUR records confirm about this buyer, e.g. {"new_customer": true}. | |
| state | No | The `state` from your previous call in this conversation; omit to start. | |
| stock | No | Current stock records for what the policy's inventory binds, with every message (schema.org Offer, Google Merchant or {id|vin, status}): nothing out of stock is offered or signed. | |
| engine | No | The engine that decides offers; empty = the policy's own (templates set their tested default), else 'bundle3'. | |
| policy | Yes | The policy from compile_offer_policy. | |
| message | Yes | The buyer's latest message, exactly as written. | |
| access_key | No | Your SNHP access key (drafting runs a language model). Pilot businesses get one at https://snhp.dev/#pilot. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| done | No | ||
| kind | No | ||
| menu | No | ||
| error | No | ||
| offer | No | ||
| reply | No | ||
| state | No | ||
| engine | No | ||
| writer | No | ||
| reading | No | ||
| receipt | No | ||
| decided_by | No | ||
| reply_with_offer | No |