Examples
E-commerce
An agent-ready product catalog, cart, and checkout.
This example designs an agent-ready layer for a fictional outdoor store, Northwind Outfitters. It covers the three tasks people most often delegate in retail: finding a product, buying it, and returning it.
Illustrative exampleTasks
| Task | Delegated as | Risk |
|---|---|---|
| Find | "Find waterproof trail shoes in size 42 under €150." | Read |
| Buy | "Order the black pair, delivered by Friday." | High |
| Return | "Return the shoes, they're too small." | Medium |
Capabilities
{
"capabilities": [
{ "name": "search_products", "risk": "read", "auth": "none" },
{ "name": "get_product", "risk": "read", "auth": "none" },
{ "name": "add_to_cart", "risk": "low", "auth": "session", "idempotent": true },
{ "name": "get_cart", "risk": "read", "auth": "session" },
{ "name": "place_order", "risk": "high", "auth": "user", "scopes": ["orders:create"], "requiresApproval": true, "idempotent": true },
{ "name": "list_orders", "risk": "read", "auth": "user", "scopes": ["orders:read"] },
{ "name": "start_return", "risk": "medium", "auth": "user", "scopes": ["returns:create"], "idempotent": true }
]
}Search with structured filters
The search action accepts the constraints people actually express, so agents never need to filter results themselves:
export const searchProducts = defineAction({
name: "search_products",
description: "Search the catalog. Filters are combined with AND. Returns at most 50 results.",
risk: "read",
scopes: [],
input: z.object({
query: z.string().optional(),
category: z.enum(["footwear", "jackets", "packs", "accessories"]).optional(),
size: z.string().optional().describe("Size in the product's sizing system, e.g. 'EU 42'"),
maxPrice: z.object({ amount: z.number(), currency: z.literal("EUR") }).optional(),
deliverBy: z.string().date().optional().describe("Latest acceptable delivery date, ISO 8601"),
features: z.array(z.enum(["waterproof", "wide_fit", "vegan"])).optional(),
}),
run: async (input) => ({ status: "completed", data: await catalog.search(input), receipt: null! }),
});Buying within limits
place_order checks the grant's spending limit. Orders under the limit complete autonomously; orders above it return approval_required. The approval is sent to the customer's phone, bound to the exact cart contents and total.
{
"status": "approval_required",
"approval": {
"id": "apr_903",
"summary": "1 × Trail Runner (Black, EU 42) · Standard delivery by Fri 9 Oct · Total €129.00",
"reason": "Above the €100 per-order limit you set for Example Assistant.",
"expiresAt": "2026-10-06T15:00:00Z"
}
}Returns
start_return validates eligibility in its preconditions and returns specific errors (return_window_closed, final_sale_item) so agents can explain the outcome accurately. The receipt includes the label URL and estimated refund.
What changed for people
The same changes improved the human experience. Size options became real radio buttons with labels. The return policy moved from a footer link onto the product page as structured data rendered in plain language. Error messages became specific.
Related
Last updated 2026-10-06. AX Framework documentation describes proposals unless a section is marked as an established standard.