Skip to content

Commit 4aa5f8b

Browse files
committed
docs(ai-chat): document the default mid-turn message behavior
1 parent e4bda18 commit 4aa5f8b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

docs/ai-chat/pending-messages.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ description: "Inject user messages mid-execution to steer agents between tool-ca
88

99
When an AI agent is executing tool calls, users may want to send a message that **steers the agent mid-execution** — adding context, correcting course, or refining the request without waiting for the response to finish.
1010

11-
The `pendingMessages` option enables this by injecting user messages between tool-call steps via the AI SDK's `prepareStep`. Messages that arrive during streaming are queued and injected at the next step boundary. If there are no more step boundaries (single-step response or final text generation), the message becomes the next turn automatically.
11+
By default (without `pendingMessages`), a message sent while the agent is responding never interrupts the in-flight response: it's buffered and processed as its own turn once the current turn completes, with multiple messages running sequentially in arrival order.
12+
13+
The `pendingMessages` option enables steering instead, injecting user messages between tool-call steps via the AI SDK's `prepareStep`. Messages that arrive during streaming are queued and injected at the next step boundary. If there are no more step boundaries (single-step response or final text generation), the message becomes the next turn automatically.
1214

1315
## How it works
1416

0 commit comments

Comments
 (0)