Orders
What Is an Order?#
An Order is the central record that ties a client request to an agent-executed job and its eventual delivery. When a client submits an intake form for a service, Strata creates an Order automatically, triggers the relevant AI agent job, and tracks every state transition until the client confirms the delivered work.
Order Lifecycle#
Every order moves through a predictable sequence of states. The diagram below maps each transition, who triggers it, and what happens in the background.
Client submits intake form
The client fills in the service intake form on the portal. On submission Strata validates the input and creates an Order record with status pending.
Order created — agent job triggered
The system writes the Order to the database and immediately enqueues an agent job. The Order status advances to in_progress and agentJobId is populated.
Agent completes work — delivery posted
When the agent job finishes, the operator reviews the output and uploads the delivery. The Order status advances to delivered and deliveryNotes is written.
Client confirms delivery
The client downloads the delivery, marks it accepted in the portal, and the Order status advances to completed. An invoice is generated if one has not already been issued.
Order Statuses#
The status field is the single source of truth for where an order stands. The table below lists every valid status, its meaning, and who is responsible for setting it.
| Name | Type | Required | Description |
|---|---|---|---|
pending | string | Yes | Order has been created from an intake submission but the agent job has not yet started. Set automatically by the system on order creation. |
in_progress | string | Yes | The agent job is actively running. Set automatically when the job is enqueued. No manual intervention is expected while an order is in this state. |
delivered | string | Yes | The operator has reviewed the agent output and posted the delivery to the client. Set by the operator via the order detail panel. |
completed | string | Yes | The client has confirmed the delivery is acceptable. Set by the client via the portal confirmation action. Triggers invoice generation if not already issued. |
cancelled | string | Yes | The order was cancelled before a delivery was posted. Can be set by the operator or (if enabled) the client. A cancellation is required before any refund can be processed — see the warning below. |
Order Fields#
The following fields are stored on every Order record. Optional fields are only populated once the relevant workflow step has been completed.
| Name | Type | Required | Description |
|---|---|---|---|
publicId | string | Yes | Human-readable unique identifier shown to clients (e.g. ORD-00123). Distinct from the internal database primary key. |
serviceId | string | Yes | References the Service that was purchased. Determines which intake form, agent workflow, and pricing apply. |
clientId | string | Yes | References the Client who submitted the order. Used to scope the portal view and to associate the invoice. |
intakeData | JSONB | Yes | Raw form submission data captured at intake. Shape is defined by the service intake schema; stored as JSONB so it can vary per service without a schema migration. |
agentJobId | string | No | Populated once the agent job is enqueued. Use this to look up execution logs or re-trigger a failed job from the operator panel. |
deliveryNotes | string | No | Free-text notes added by the operator when posting a delivery. Visible to the client on the delivery confirmation screen. |
invoiceId | string | No | Populated once an invoice is generated for the order. Null until the order reaches completed or is manually invoiced by the operator. |
status | 'pending' | 'in_progress' | 'delivered' | 'completed' | 'cancelled' | Yes | Current lifecycle state of the order. Always reflects the most recent transition. See Order Statuses above. |
createdAt | timestamp | Yes | UTC timestamp recorded when the order was first created. |
updatedAt | timestamp | Yes | UTC timestamp updated on every status change or field edit. Used for optimistic locking and audit trails. |
Portal Views#
Strata surfaces different capabilities depending on whether the logged-in user is an operator or a client.
Operator View
Filter the order list by status, service, or date range. Open the order detail panel to review intake data, monitor the agent job, upload the delivery file, and add delivery notes. Mark an order cancelled from the detail panel if work cannot be completed.
Client View
Track order progress via the status badge. Download the delivery once it reaches the delivered state. Confirm acceptance to advance the order to completed. Pay the invoice directly from the order summary if an invoice has been issued.