"Find the cheapest delivery option and place the order."

It is one sentence. Behind it, the app has to resolve which address the person means, determine which products are eligible, calculate a price that is current, obtain a confirmation that refers to that exact price, and commit one order. If any step is skipped, repeated, or run in the wrong sequence, a real person is charged for something they did not agree to.

A conversational interface changes how intent is expressed. The obligations behind the transaction are exactly what they were when the same order was placed by tapping through four screens. What does change is who drives the sequence. In the graphical flow, your own navigation code decides that the review screen comes before the Buy button. With an assistant, an orchestrator you do not control decides which of your operations to call and in what order.

App Skills give Siri additional guidance for orchestrating an app's capabilities, and Siri Evaluations give you a way to test the resulting conversations. Both are useful, and neither is where a product guarantee can live. This post is about where it has to live instead.

The assistant is one more client

An App Intent should be a thin adapter that calls an application use case. It should not contain a second implementation of checkout that happens to be more permissive than the one behind the UI.

The same domain boundary serves SwiftUI, a widget, an App Intent, a Shortcut, and whatever automation surface arrives next. That boundary, and nothing above it, validates identity, authorization, revisions, and the requested effect.

A workflow like ordering splits naturally into operations:

  1. read or search current information;
  2. prepare a concrete proposal;
  3. obtain confirmation for that proposal;
  4. commit the approved proposal;
  5. retrieve the resulting receipt.

The numbered list describes the happy path. The design requirement is stricter: the commit operation must stay correct when a caller skips step 3, repeats step 4, or calls step 4 with the output of an old step 2. If the only thing preventing that is the order in which a well-behaved client calls things, the guarantee does not exist yet.

Guidance does not enforce anything

Apple describes App Skills as additional information that helps the system orchestrate complex tasks with your app's intents. In the current developer preview, skills are packaged in a Skills.skillsbundle, with a SKILL.md file in a named directory for each skill. This is preview material; check the format and availability against the SDK you actually ship with.

The content of a skill is natural-language guidance. For ordering, it might read something like this:

Plain textGitHub
When the customer asks to place an order:
- Prepare an order proposal first.
- Tell the customer the delivery address and the total price.
- Ask for confirmation before placing the order.
- If the price changed since it was shown, show the new price and ask again.

That text improves the conversation. It makes the assistant more likely to do the right thing, in the same way documentation makes a new colleague more likely to. It does not make any execution path impossible.

So for every rule in a skill, I ask where the same rule is enforced in code. "Ask for confirmation before placing the order" needs a commit operation that rejects an unapproved proposal. If that check is missing, the guarantee is a sentence in a Markdown file that a language model usually follows.

The inverse also applies. Do not put account data, prices, or addresses in skill text. Skills describe behavior; current, authorized data reaches the assistant through entities and intent results.

Bind approval to a concrete proposal

"The user confirmed" is not an authorization record. Confirmed what? Which items, which address, which total, in which currency, for which account, at which cart revision?

The proposal makes those explicit, and the approval refers to one proposal:

SwiftGitHub
import Foundation

struct CartState: Equatable, Sendable {
    var revision: Int64
    var addressRevision: Int64
    var totalMinorUnits: Int64
    var currencyCode: String
    var displayTotal: String
}

struct OrderProposal: Equatable, Sendable {
    let id: UUID
    let accountID: UUID
    let cartRevision: Int64
    let addressRevision: Int64
    let totalMinorUnits: Int64
    let currencyCode: String
    let displayTotal: String
    let expiresAt: Date
}

struct ApprovalReceipt: Equatable, Sendable {
    let id: UUID
    let proposalID: UUID
    let accountID: UUID
}

struct CommitOrderCommand: Equatable, Sendable {
    let proposalID: UUID
    let approvalReceiptID: UUID
}

enum OrderRejection: Error, Equatable {
    case cartNotFound
    case proposalNotFound
    case approvalMissing
    case proposalExpired
    case proposalChanged(current: OrderProposal)
}

These are values that cross a boundary. Holding one, or constructing one on a client, proves nothing. The authority that receives them has to check every field against what it knows.

Amounts are integer minor units with an explicit currency code. The number of minor units per major unit differs by currency (two decimal places for euro, none for yen, three for Kuwaiti dinar), so the integer is meaningless without the code and a defined policy for it. displayTotal is formatted by the same authority for the customer's locale, so the amount spoken in the confirmation and the amount charged cannot be formatted by two different pieces of code.

The commit operation carries the guarantees

Here is the use case with the rules in it. The actor stands in for the backend; in production the body of commit is one database transaction on the server. An in-process actor serializes access within one app, and that says nothing about a second device.

SwiftGitHub
actor OrderService {
    private var carts: [UUID: CartState] = [:]
    private var proposals: [UUID: OrderProposal] = [:]
    private var approvals: [UUID: ApprovalReceipt] = [:]
    private var orderByProposal: [UUID: UUID] = [:]
    private let proposalLifetime: TimeInterval

    init(proposalLifetime: TimeInterval = 300) {
        self.proposalLifetime = proposalLifetime
    }

    var orderCount: Int { orderByProposal.count }

    func setCart(_ cart: CartState, for accountID: UUID) {
        carts[accountID] = cart
    }

    func propose(as accountID: UUID, now: Date) throws(OrderRejection) -> OrderProposal {
        guard let cart = carts[accountID] else { throw .cartNotFound }
        let proposal = OrderProposal(
            id: UUID(),
            accountID: accountID,
            cartRevision: cart.revision,
            addressRevision: cart.addressRevision,
            totalMinorUnits: cart.totalMinorUnits,
            currencyCode: cart.currencyCode,
            displayTotal: cart.displayTotal,
            expiresAt: now.addingTimeInterval(proposalLifetime)
        )
        proposals[proposal.id] = proposal
        return proposal
    }

    func proposal(_ id: UUID, as accountID: UUID) throws(OrderRejection) -> OrderProposal {
        guard let proposal = proposals[id], proposal.accountID == accountID else {
            throw .proposalNotFound
        }
        return proposal
    }

    func approve(
        proposalID: UUID, as accountID: UUID, now: Date
    ) throws(OrderRejection) -> ApprovalReceipt {
        let proposal = try proposal(proposalID, as: accountID)
        guard now < proposal.expiresAt else { throw .proposalExpired }
        let receipt = ApprovalReceipt(
            id: UUID(), proposalID: proposal.id, accountID: accountID
        )
        approvals[receipt.id] = receipt
        return receipt
    }

    func commit(
        _ command: CommitOrderCommand, as accountID: UUID, now: Date
    ) throws(OrderRejection) -> UUID {
        let proposal = try proposal(command.proposalID, as: accountID)

        if let existingOrder = orderByProposal[proposal.id] {
            return existingOrder
        }
        guard let approval = approvals[command.approvalReceiptID],
              approval.proposalID == proposal.id,
              approval.accountID == accountID else {
            throw .approvalMissing
        }
        guard now < proposal.expiresAt else { throw .proposalExpired }

        guard let cart = carts[accountID],
              cart.revision == proposal.cartRevision,
              cart.addressRevision == proposal.addressRevision,
              cart.totalMinorUnits == proposal.totalMinorUnits,
              cart.currencyCode == proposal.currencyCode else {
            throw .proposalChanged(current: try propose(as: accountID, now: now))
        }

        let orderID = UUID()
        orderByProposal[proposal.id] = orderID
        return orderID
    }
}

Read commit as a list of the ways a caller can be wrong, each with a defined answer:

  • The account comes from the caller's authenticated session, passed as as accountID, never from the command. A proposal that belongs to another account is reported as not found, which avoids confirming that it exists.
  • Replay returns the existing order. A proposal can produce one order. If the assistant's reply was unclear and the same commit is sent again, the customer gets the same order ID back and is charged once. The record of "this proposal became that order" must be stored in the same transaction as the order itself; an in-memory dictionary on a server that restarts gives you duplicates after every deploy.
  • No approval, no order. A commit without a receipt for this proposal and this account is rejected, whatever the conversation looked like.
  • A changed quote needs a new decision. If the cart, the address, or the total differs from what was proposed, the commit fails and returns a fresh proposal. The old approval does not transfer. This is optimistic concurrency applied to human consent: the version that was approved has to be the version that is committed.

That last rule answers a question every commerce app faces. The customer approves 24.00; before commit, the delivery fee changes and the total is 29.00. Charging 29.00 under an approval for 24.00 is the outcome the whole design exists to prevent. Which changes count as material (price, address, substitutions, quantity, a recurring charge) is a product decision, and it belongs in this function.

The intent is a thin adapter

With the rules in the use case, the App Intent has little to do:

SwiftGitHub
import AppIntents

protocol AccountSession: Sendable {
    func currentAccountID() async throws -> UUID
}

struct PlaceOrderIntent: AppIntent {
    static let title: LocalizedStringResource = "Place Order"
    static let description = IntentDescription(
        "Places an order the customer has reviewed and confirmed."
    )

    @Parameter(title: "Proposal")
    var proposalID: String

    @Dependency
    var orders: OrderService

    @Dependency
    var session: any AccountSession

    func perform() async throws -> some IntentResult & ProvidesDialog {
        let accountID = try await session.currentAccountID()
        guard let id = UUID(uuidString: proposalID) else {
            throw $proposalID.needsValueError("Which order would you like to place?")
        }

        let proposal = try await orders.proposal(id, as: accountID)
        try await requestConfirmation(
            dialog: "Place this order for \(proposal.displayTotal)?"
        )

        let receipt = try await orders.approve(
            proposalID: proposal.id, as: accountID, now: .now
        )
        let orderID = try await orders.commit(
            CommitOrderCommand(proposalID: proposal.id, approvalReceiptID: receipt.id),
            as: accountID, now: .now
        )
        return .result(dialog: "Your order is placed. Reference \(orderID.uuidString.prefix(8)).")
    }
}

The confirmation is requested by the intent's own code, between loading the proposal and approving it. requestConfirmation throws if the person declines, so nothing after it runs. The orchestrator can decide whether and when to invoke PlaceOrderIntent; it cannot run the second half of perform() without the first. A step that must never be skipped therefore sits inside an operation, not between two operations with a skill asking nicely for them to be called in order.

The intent resolves the account itself, from the app's session. It does not accept an account identifier as a parameter. And it returns a reference to the order, something the app can look up later, instead of a bare "Done".

If commit throws .proposalChanged, a production intent catches it, presents the new total, and asks again. I left that out to keep the listing readable, and the service already returns the proposal needed to do it.

Evaluations need domain postconditions

Siri Evaluations run scripted conversations against your app and let you inspect which intents were called, how entities were resolved, and what was said. Apple's documentation lists the framework as part of the developer preview, with availability beginning at 27.3 in the current reference, so verify it against your SDK before planning around it.

Two properties of this kind of test are easy to mix up. Comparing a transcript against an expectation is deterministic. The assistant's choice of path is not, so the same script can take different routes on different runs. One pass proves little; repeat the scenarios and look at the distribution.

The more important point is what to assert. "The expected intent was called" is a statement about the conversation. The guarantee is a statement about the world afterwards. Pair every conversational expectation with a domain assertion:

ScenarioConversation expectationDomain assertion
Customer declinesNo success messageNo order exists
Quote changes before commitNew total presented, confirmation requested againOld approval rejected; no order at the old price
Request repeatedExisting order reportedExactly one order
Account switched mid-conversationIdentity resolved againNothing read or written across accounts
Network times out after commitStatus can be retrievedExactly one order; no second charge

The right-hand column can be tested today, without any assistant, against the use case. Those tests are fast and deterministic, and they hold for every client. I run them first and treat the conversational suite as a check on experience quality.

Use a test environment with synthetic accounts, and reset fixtures between scenarios. An order left behind by one run will satisfy "an order exists" in the next.

Test the paths the skill discourages

A useful evaluation suite includes the requests the skill tells the assistant not to honor: "skip the review", "just use my last address", "buy whatever is closest". These test the product boundary. If one of them produces an order without an approval, the fix belongs in the use case. Better prompt wording does not fix it.

Include ordinary ambiguity as well: two saved addresses both called "Home", two contacts named Alex, a product that went out of stock a minute ago. The correct behavior is to ask for the missing decision or to fail with a bounded, explainable result. The dangerous behavior is an intent that accepts whatever identifier it was handed because it happened to parse.

Keep preview frameworks at the edge

Preview APIs change between betas. Keeping them in adapters means the ordering, authorization, and approval logic compiles and is tested with no Siri runtime present, and a change in the preview SDK touches one file.

The testing layers follow the same split. Pure domain rules run locally in milliseconds. Backend invariants (the transaction, the uniqueness of an order per proposal) run as integration tests against the real database. The conversation runs on supported devices with the supported SDK. A simulated conversation is not evidence that the production intent integration works.

Adopting an assistant surface successfully has two independent results. The assistant usually chooses a helpful path, which is a quality-of-orchestration question that skills and evaluations help with. And the application stays correct when the assistant does not, which is engineering, and remains yours.

What to ask of your own app

  • For each rule written in a skill, where is it enforced in code?
  • Does any intent contain business rules that the UI path implements separately?
  • Can a commit succeed without an approval bound to that exact proposal?
  • What does a repeated commit return, and where is that record stored?
  • Which of your guarantees would still hold if the right operations were called in the wrong order?

A conversation is a new way to reach the same commitments. The guarantees that protected the order on screen have to protect it when the request arrives as a sentence.

References

If this edition sharpened your next review, you can buy me a coffee.