Skip to content

Commit 0ad7053

Browse files
adhamvapiclaude
andauthored
docs: add previousAssistantMessages handoff mode to PCI docs (#1026)
* docs: add previousAssistantMessages handoff mode to PCI and handoff docs Add a new "Securing Handoffs with Sensitive Data" section to the PCI compliance documentation explaining the security concern with forwarding full conversation context (including sensitive tool call data) during assistant handoffs, the server-side fix Vapi deployed, and the customer-side steps to configure contextEngineeringPlan appropriately. Also document the previousAssistantMessages context engineering plan type in the handoff tool documentation, which was the only type not yet covered there. Update the existing Payment Collection Squad example to use previousAssistantMessages instead of none for a more practical default. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: reframe PCI handoff docs to neutral feature documentation Remove incident-response framing ("What happened", "What we've fixed", "What you need to do") from PCI.mdx and present previousAssistantMessages as a standard feature for controlling handoff context in sensitive flows. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: correct PCI recommendation for userAndAssistantMessages context type The table previously described userAndAssistantMessages as a "good alternative" for PCI flows. This is incorrect — if a user speaks sensitive data (e.g., card numbers) aloud, those appear in user messages and would be forwarded to the next assistant. Updated the table to mark it as not recommended for PCI flows, reordered rows to list safe options first, and renamed the column header from "When to use" to "PCI Recommendation" for clarity. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: remove userAndAssistantMessages row from PCI docs table Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: adhamvapi <256238690+adhamvapi@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c673640 commit 0ad7053

2 files changed

Lines changed: 110 additions & 1 deletion

File tree

fern/security-and-privacy/PCI.mdx

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Here's a complete squad configuration that demonstrates this approach:
161161
"assistantName": "Assistant 3",
162162
"description": "Transfer the caller to the payment confirmation assistant.",
163163
"contextEngineeringPlan": {
164-
"type": "none"
164+
"type": "previousAssistantMessages"
165165
},
166166
"variableExtractionPlan": {
167167
"schema": {
@@ -227,6 +227,97 @@ The key component is the `artifactPlan` in Assistant 2:
227227

228228
This ensures that sensitive payment information is never recorded, logged, or transcribed, while still allowing you to maintain call quality data for the non-sensitive portions of the conversation.
229229

230+
## Handoff Context Configuration
231+
232+
When using squads or the handoff tool, you can control what conversation context is forwarded to the next assistant using `contextEngineeringPlan`. This is particularly important for PCI-compliant flows where an assistant handles sensitive data such as payment card numbers.
233+
234+
By default, handoffs use `contextEngineeringPlan` type `all`, which transfers the entire conversation history -- including tool call results. For assistants that process sensitive data, you should choose a more restrictive context type to ensure that tool call results (which may contain card numbers or other sensitive values) are not forwarded.
235+
236+
<Warning>
237+
If a sensitive assistant uses the default `contextEngineeringPlan` (type `all`), the full conversation context -- including tool call results -- will be forwarded to the next assistant. Always set an appropriate context engineering plan on handoff destinations from assistants that handle sensitive data.
238+
</Warning>
239+
240+
### Recommended context types
241+
242+
The following table describes the `contextEngineeringPlan` types relevant to PCI and other sensitive data flows:
243+
244+
| Type | Behavior | PCI Recommendation |
245+
|------|----------|-------------|
246+
| `previousAssistantMessages` | Forwards only the conversation history from **before** the current assistant's session. Excludes the current assistant's own messages and tool calls entirely. | **Recommended.** Preserves useful pre-payment context while fully excluding the sensitive assistant's data. |
247+
| `none` | Starts the next assistant with a blank conversation. No prior context is forwarded. | **Safe.** Maximum isolation. Use when the next assistant does not need any prior context. |
248+
249+
<Note>
250+
For a full reference on all context engineering plan types, see the [Handoff Tool - Context Engineering](/squads/handoff#context-engineering) documentation.
251+
</Note>
252+
253+
### Configuring the context engineering plan
254+
255+
Set the `contextEngineeringPlan` on the handoff destination from your sensitive assistant. Here is an example using `previousAssistantMessages`:
256+
257+
```json
258+
"assistantDestinations": [
259+
{
260+
"type": "assistant",
261+
"assistantName": "Confirmation Assistant",
262+
"description": "Transfer to the confirmation assistant after payment collection.",
263+
"contextEngineeringPlan": {
264+
"type": "previousAssistantMessages"
265+
}
266+
}
267+
]
268+
```
269+
270+
Or equivalently, when using the handoff tool:
271+
272+
```json
273+
{
274+
"type": "handoff",
275+
"destinations": [
276+
{
277+
"type": "assistant",
278+
"assistantName": "Confirmation Assistant",
279+
"description": "Transfer to the confirmation assistant after payment collection.",
280+
"contextEngineeringPlan": {
281+
"type": "previousAssistantMessages"
282+
}
283+
}
284+
]
285+
}
286+
```
287+
288+
### Using variable extraction for safe data passing
289+
290+
If the next assistant needs specific data from the sensitive session (such as the last four digits of a card number for confirmation), use `variableExtractionPlan` instead of relying on full context forwarding. This extracts only the structured fields you define:
291+
292+
```json
293+
"assistantDestinations": [
294+
{
295+
"type": "assistant",
296+
"assistantName": "Confirmation Assistant",
297+
"contextEngineeringPlan": {
298+
"type": "previousAssistantMessages"
299+
},
300+
"variableExtractionPlan": {
301+
"schema": {
302+
"type": "object",
303+
"properties": {
304+
"lastFourDigits": {
305+
"type": "string",
306+
"description": "Last four digits of the card number"
307+
}
308+
}
309+
}
310+
}
311+
}
312+
]
313+
```
314+
315+
The extracted variables are available in the next assistant's system prompt using Liquid template syntax (e.g., `{{lastFourDigits}}`). This is the pattern used in the [Payment Collection Squad Example](#payment-collection-squad-example) above.
316+
317+
<Tip>
318+
Combining `contextEngineeringPlan` with `variableExtractionPlan` gives you the best of both worlds: sensitive tool call data is excluded from the forwarded context, while the specific data points the next assistant needs are passed through as named variables.
319+
</Tip>
320+
230321
## Can PCI be used alongside HIPAA?
231322
Yes, you can enable both HIPAA and PCI compliance for an assistant. In this case, the restrictions from both compliances will apply, meaning that no recordings or transcripts will be stored or transmitted, even if you have specified cloud storage endpoints or webhooks for storing transcripts.
232323

fern/squads/handoff.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,24 @@ Transfers only user and assistant messages, filtering out system messages, tool
437437
Use `userAndAssistantMessages` when the destination assistant does not need to see tool call history or system prompts from the previous assistant. This produces a cleaner context and reduces token usage.
438438
</Tip>
439439

440+
### Previous assistant messages
441+
442+
Transfers only the conversation history from **before** the current assistant's session. This excludes the current assistant's own messages, tool calls, and tool results entirely, forwarding only the context that existed when the current assistant first received the call.
443+
444+
```json
445+
{
446+
"contextEngineeringPlan": {
447+
"type": "previousAssistantMessages"
448+
}
449+
}
450+
```
451+
452+
This mode is particularly useful when the current assistant handles sensitive data (such as payment card numbers in a PCI-compliant flow). By excluding the current assistant's session from the forwarded context, you prevent sensitive tool call results from reaching the next assistant.
453+
454+
<Tip>
455+
Use `previousAssistantMessages` when handing off from a sensitive assistant (e.g., one collecting payment data) to a non-sensitive assistant. It preserves useful conversation context from earlier in the call while ensuring the sensitive assistant's tool call data is not forwarded. See the [PCI Compliance - Handoff Context Configuration](/security-and-privacy/pci#handoff-context-configuration) guide for a complete walkthrough.
456+
</Tip>
457+
440458
### No context
441459

442460
Starts the next assistant with a blank conversation:

0 commit comments

Comments
 (0)