> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentcard.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Choose how long a reply waits for stores

> Set how long Agentcard waits for store searches before it writes the reply, and whether a slower store's cards still show after it.

Set how long a reply waits for the stores a search asks, and what happens to a store that answers after the reply. A streaming chat shows each store's cards as they arrive and streams the few that come after the reply. A texting app sends the reply once, as its last word.

```ts agentcard.ts theme={null}
const buy = buyTool({ agentcard, externalUserId: shopper.id, storeWaitMs: 25000, lateResults: 'stream' });
```

Agentcard writes the reply once every store answered, or once `storeWaitMs` passed, whichever comes first. Leave both options out and Agentcard chooses the wait.

Agentcard ends every store search at 30 seconds, so a `storeWaitMs` above `30000` waits no longer than `30000` does.

## Show late cards in a streaming chat

A chat that shows cards as they come uses `storeWaitMs: 25000` and `lateResults: 'stream'`. Each store's cards show the moment that store answers, so the shopper sees products long before the reply. The reply waits up to 25 seconds, and 99.7% of stores show their first products within that wait. A store that answers later sends its cards in the same turn, after the reply, with one message that says what they added:

```text theme={null}
Target has the LaCroix Lime 12 pack. Walmart is still being checked.
[card: LaCroix Lime 12 pack (Walmart)]
Walmart has it too, and it costs less there.
```

The late cards reach the same callbacks as the first ones: `sendLink`, `onProducts`, or `onItem`. Keep each callback ready to add a card below the reply, not only above it. The turn's `onResult` lists the late cards in `result.products`, after the answer's own, so a cart panel or a list of products built from `onResult` shows them too.

## Hold late cards in a texting app

A texting app that cannot add a card after it sent the reply uses `storeWaitMs: 20000` and `lateResults: 'hold'`:

```ts sms.ts theme={null}
const buy = buyTool({ agentcard, externalUserId: shopper.id, storeWaitMs: 20000, lateResults: 'hold' });
```

The shopper waits up to 20 seconds for the reply, and the reply is the turn's last message. 96% of stores show their first products within that wait. A store that answers after the reply sends nothing in that turn, so about 4 stores in 100 miss the reply. A longer wait catches more of them, up to the 30-second limit, and the shopper waits that much longer.

## Set a wait for one turn

Pass the same options to `buy.turn` to change them for one message. An option the turn leaves out keeps the tool's:

```ts chat.ts theme={null}
const turn = buy.turn(message, { storeWaitMs: 10000 }); // this turn replies sooner, and late cards still stream
```

An app that calls `client.buy` itself sends the fields `store_wait_ms` and `late_results` on the request.

A `storeWaitMs` that is not a whole number of milliseconds, 0 or more, or a `lateResults` other than `stream` or `hold`, throws a TypeError before any call, so a typo never reaches a shopper. `buyTool({ agentcard, externalUserId: shopper.id, storeWaitMs: '25s' })` throws:

```text theme={null}
TypeError: Pass storeWaitMs as a whole number of milliseconds, 0 or more, or leave it out.
```

Pass the wait as a number of milliseconds instead:

```ts agentcard.ts theme={null}
const buy = buyTool({ agentcard, externalUserId: shopper.id, storeWaitMs: 25000 });
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.