Skip to main content
A session records one agent shopping for one shopper at one merchant. It holds every tool call the agent made, and ends with an outcome, whether the agent bought something or left after a few searches. Create the session before the agent starts shopping with create_session, passing a shopper_id and a merchant_id. You pass its ID again when you open checkout with create_checkout, which ties the order back to the run that produced it.
Session tools need a test key. In keyless test mode they return needs_test_key.

Outcomes

Every session has one outcome. A new session starts as browsing. A session that ends without an order is still recorded. A run where the agent searches and leaves tells you as much as one that buys.

The session record

get_session returns the session with its cart and order, if any, plus how long it ran and how many tool calls it made.
endedAt and durationMs are null while the session is still open.

Events

Every tool call the agent makes in a session is stored as an event. Events are append-only: they are never edited or deleted. get_session_events returns them in order.
Each event has the tool name, how long the call took, a one-line summary of the result, whether it failed, and when it happened.

Debugging with sessions

Use a session’s events to see what an agent did, step by step, and where it stopped. Use list_sessions with outcome or shopper_id to find patterns across runs. For example, many abandoned sessions can point to friction at approval or checkout. Session events record what the agent did. Order events, from get_order_events, record what happened to the order afterwards.