Skip to main content
Thread lifecycle: browsing, carted, checked-out A thread is one shopping trip. It starts when your agent creates a thread and ends when the order is placed or the thread is cancelled.

Thread = cart

create_cart returns a cart with an id prefixed thr_. That id is the thread id. Every subsequent call (update_cart, create_checkout, complete_checkout) takes it as thread_id.
The shopper is identified by the X-Shopper-Id header, not a body field. The response includes the id. Pass it as thread_id on every tool. On REST it is :id in /v1/carts/:id.

Lifecycle

A thread stays open until it is ordered, cancelled, or its order is submitted and fails or has an unknown outcome. It does not time out. Once it ends it cannot be reopened, and any call on it returns thread_ended (HTTP 410) with the outcome in the message. Start a new thread with create_cart. complete_checkout does not end the thread. It returns a confirm_url, and the thread ends after the shopper confirms on that page. See Orders.

What a thread holds

The saved card and login are Evervault-encrypted values. See Security.

One merchant, one browser context

Each thread is bound to one merchant, set by merchant on create_cart. See Merchants for the nine live merchants. A thread runs on a stored browser context: one per organization, shopper and merchant. The first create_cart for a shopper at a merchant creates it, and every later thread for the same X-Shopper-Id and merchant reuses it. The context keeps the merchant cart and sign-in state, and it outlives the thread. A shopper’s next thread at the same merchant starts on the same context, usually still signed in. Each call borrows a browser from a shared pool and opens it on that context. When every browser is busy, a call returns browser_unavailable with retry_after_seconds. Nothing changed. Wait and call again.

Merchant sign-in

Every thread shops as the shopper’s own merchant account. Nothing checks sign-in up front: a step that needs the account, such as create_checkout, returns sign_in_required when the shopper’s context is signed out. Then:
  1. set_credentials with { "thread_id": "thr_…", "type": "login" }. It returns a url.
  2. Give the url to the shopper. They enter their merchant email and password. The password is encrypted in their browser.
  3. sign_in with { "thread_id": "thr_…" }. It returns { "signed_in": true }. Retry the step that failed.
The sign-in is kept on the context, so the shopper signs in once per merchant. The saved login is on the thread and is cleared when the thread ends.

Console

The Threads page at console.getagentmall.com/threads lists every thread for your organization. Each row shows the merchant, outcome, and tool call count. Click a thread to see its tool calls.