Tony Santana

Command Palette

Search for a command to run...

Blog
PreviousNext

Building an AI agent into a product workflow

What I learned building a logistics assistant that uses product data, asks for clarification, and prepares changes a person can review.

A useful in-product assistant understands the task at hand. In logistics, a request like “prepare a pickup for tomorrow” depends on which shipment the dispatcher means and which time slots are actually available. A conversational answer can help the dispatcher get there. A confirmed change also has to respect the same business rules as the rest of the application.

That was the problem I worked on at Hauler Network with an Expo mobile app, a NestJS backend, and the OpenAI Responses API. The example below is illustrative. It uses a fictional shipment and leaves out product data.

Let the workflow decide what a tool can do

I start with a short list of typed tools that match actions someone already understands in the product. A read tool can show possible time slots. A proposal tool can put together a candidate change. The business operation can then apply the reviewed proposal.

StepWhat the dispatcher sees
Ask“Can we move shipment 42 to tomorrow morning?”
ClarifyThe assistant asks which of two available windows the dispatcher means.
ReviewThe app shows the shipment, proposed time, and what would change in a review screen.
ConfirmThe backend rechecks the selected slot and the dispatcher's permissions before applying the change.

The assistant can keep the conversation moving when it lacks information. The app gives the dispatcher a precise action to review. A confirmation refers to the specific proposal the dispatcher saw, so a changed slot or a stale proposal goes back to review with current information.

Give the mobile UI a state it can explain

A stream can show progress and surface questions as they come up. A screen also needs durable states for interruptions. On mobile, the user can close the app, reconnect later, or switch contexts while a response is in progress. That made it important to separate the conversational response from the proposal and the result of the underlying product action.

The UI can then say “ready for review,” “the slot is no longer available,” or “the change was applied,” based on the product state. A retry should bring the user back to that state rather than ask them to guess whether the action ran.

Test the decisions around the happy path

The first demo only proves that an assistant can propose a plausible action. I also test the conditions that can change the outcome.

  • An ambiguous request should produce a focused question.
  • A read-only user should still be able to get useful information within their permissions.
  • A slot that disappears after review should trigger a fresh proposal.
  • A lost connection after confirmation should still let the app show the outcome.

The pattern I would reuse is small tools, a clear review screen, and a product command that owns the final change. It lets a person speak naturally while keeping the application's rules and feedback familiar.