Search for Orders and Use the Work Queue
Find orders with structured or natural-language search, and let the work queue tell you what is ready to ship.
Finding the right orders is where most shipping sessions start. The CLI supports natural language search, structured filters, and a product-defined work queue for "what should I ship?" This article shows how to search confidently without silent empty results.
In this article, we will search with natural language and structured JSON, use the work queue for shippable work, read empty-result context the right way, and connect search to shipments.
Real-World Example
We are opening the day and want ready-to-ship orders from the last two months, not four-year-old sample imports and not every order stuck in a custom hold status.
Before We Begin
This article assumes that:
- You are authenticated
- You understand that status names are defined by your account
- Optional:
postsale runavailable if you want the work queue via natural language (thepostsale orders work-queuesubcommand needs no LLM key)
Search with natural language
Here's how:
postsale orders search --query "shipped last week to California"
postsale orders search --query "orders from last 7 days" --page-size 50
postsale orders search --query "..." --allUseful flags:
--page/--page-size(max 150, default 50)--allstreams NDJSON for every matching page--max-itemscaps--all(default 10000)--compactprojects each order toid,number,status,date,total,ship_to, and an item count — about 6.4x smaller (a 50-order page drops from ~55KB to ~8.5KB). Works with--all. Response-level fields, including_cli_meta.empty_result_context, are preserved.--humanpretty-prints for reading
Reach for --compact when triaging and full records when acting: creating a shipment or quoting rates needs weights, SKUs, and the full destination address, which the projection drops. postsale orders get <order_id> fetches the full record for anything you picked out of a compact list.
The natural language path may include interpreted_query so you can see how the backend understood you.
Search with a structured filter
When you already know the filter shape:
postsale orders search --json '{"conditions":{...}}'
postsale orders search --input filter.json
postsale schema orders.searchUse structured search when natural language is ambiguous or when you are encoding a known report.
Prefer the work queue for "what should I ship?"
Guessing status strings is the most common source of silent zeros (successful calls that return no orders).
Ask for the work queue directly — no LLM key required:
postsale orders work-queue
postsale orders work-queue --human # readable rendering
postsale orders work-queue --all-time # ignore the recency window
postsale orders work-queue --statuses "Ready to Ship,On Hold"Or through the agent, which reaches the same definition:
postsale run "what should I ship? explain the applied filters and exclusions"Note
Both surfaces run the same product definition — the subcommand is a thin wrapper over the get_work_queue agent tool, not a second implementation, so they cannot disagree about what shippable work means. Prefer either one over hand-composing a status filter: status names are account-defined, and guessing them fails silently in both directions (a wrong guess looks like an empty account; a naive query surfaces four-year-old samples as today's work).
How the work queue is defined
| Rule | Behavior |
|---|---|
| Statuses | Matches your account's status list to a curated ready set. No match: loud error listing your account statuses. |
| Recency | Within window_days (default 60) by order_date. Full history: all_time: true. |
| Sort | Newest first |
| Samples | Order numbers containing CSV-SAMPLE are excluded unless include_samples is true |
| Disclosure | Results include applied filters and excluded counts. Surface those in summaries. |
Status matching is normalized, so account spellings of 'ready to ship', 'awaiting shipment', and 'unfulfilled' count. Pass explicit statuses only after confirming them with a human.
When search returns nothing
A zero-order result may include _cli_meta.empty_result_context — both from the agent tool search_orders AND from the direct postsale orders search command (so a coding agent driving the CLI gets the same honesty signal without an LLM key):
- How the filter was applied
- Alternate counts (for example total orders with no filter, or the same filter without status)
- Account status vocabulary
If alternates are nonzero, the filter missed. The account is not necessarily empty.
Note
An empty page past the end of a matching search is pagination, not an empty result. For natural-language searches, also read interpreted_query to see how the backend understood you, then loosen the query from there. The direct-CLI context appears only on a true zero-match page (never --all streaming), and the two disclosure probes run only then — non-empty searches carry no extra traffic.
From orders to shipments
Order search does not embed full shipment records. Continue with:
postsale shipments list --query "..."
postsale shipments get --reference <order_id>See Orders, shipments, and labels.
Direct CLI without the agent
- List statuses via
postsale run "list order statuses for this account"or your account UI. - Search with natural language or structured JSON using your status names.
- If the result is empty, widen filters and read
interpreted_queryon natural search. - Reads are free; experiment with searches as much as you like.
The full structured filter that mirrors the work queue lives in AGENTS.md for agent authors. Do not invent field names.
Good to Know
| Symptom | Likely cause | What to do |
|---|---|---|
| Zero orders, looks successful | Wrong status or window | Work queue; empty-result context; list statuses |
| Old samples dominate | Sample exclusion off | Keep work queue defaults |
| Natural language misread | Backend interpretation | Read interpreted_query; switch to structured |
| Expected a CLI work-queue flag | Surface is agent/run | Use get_work_queue via run, or compose search carefully |
List statuses via the agent:
postsale run "list order statuses for this account"Additional Reading
- Ship one order
- Shipping, labels, and rates
- orders command stub
- Agent honesty notes: honesty-contracts
On this page
Related