Skip to content

Commit 7f3ea59

Browse files
adhamvapiclaude
andcommitted
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>
1 parent c673640 commit 7f3ea59

2 files changed

Lines changed: 121 additions & 1 deletion

File tree

fern/security-and-privacy/PCI.mdx

Lines changed: 103 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,108 @@ 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+
## Securing Handoffs with Sensitive Data
231+
232+
When using squads or the handoff tool with PCI-mode assistants, it is important to control what conversation context is forwarded to the next assistant. By default, handoffs use `contextEngineeringPlan` type `all`, which transfers the **entire** conversation history -- including tool call results that may contain sensitive data such as card numbers.
233+
234+
### What Vapi has fixed
235+
236+
Vapi has deployed a server-side fix to ensure that sensitive data is no longer stored in internal systems or logs for any assistant that has PCI mode enabled, logging disabled, or zero data retention (ZDR) configured. This fix applies automatically to all qualifying assistants.
237+
238+
### What you need to do
239+
240+
As a defense-in-depth measure, if your flow uses assistant handoffs -- particularly handing off **from** a card-collection (or similarly sensitive) assistant **to** another assistant -- you should configure the `contextEngineeringPlan` on the handoff destination to prevent sensitive tool call data from being forwarded.
241+
242+
<Warning>
243+
If your sensitive assistant uses the default `contextEngineeringPlan` (type `all`), the full conversation context -- including tool call results containing card numbers or other sensitive data -- will be forwarded to the next assistant. Always set an appropriate context engineering plan on handoff destinations from sensitive assistants.
244+
</Warning>
245+
246+
#### Step 1: Identify your sensitive assistant handoffs
247+
248+
Review your squad or handoff tool configuration. Look for any assistant that collects sensitive data (card numbers, SSNs, etc.) and has `assistantDestinations` or handoff tool `destinations` pointing to another assistant.
249+
250+
#### Step 2: Set the context engineering plan
251+
252+
On each destination **from** a sensitive assistant, add a `contextEngineeringPlan` that excludes tool call data. The recommended options are:
253+
254+
| Type | Behavior | When to use |
255+
|------|----------|-------------|
256+
| `previousAssistantMessages` | Forwards only the conversation history from **before** the current (sensitive) assistant's session. Excludes the sensitive assistant's own messages and tool calls entirely. | **Recommended.** Preserves useful pre-payment context while fully excluding sensitive data. |
257+
| `userAndAssistantMessages` | Forwards only user and assistant spoken messages, stripping out all tool calls and tool results. | Good alternative when you want the next assistant to see the conversational flow but not internal tool data. |
258+
| `none` | Starts the next assistant with a blank conversation. No prior context is forwarded. | Maximum isolation. Use when the next assistant does not need any prior context. |
259+
260+
<Note>
261+
For a full reference on all context engineering plan types, see the [Handoff Tool - Context Engineering](/squads/handoff#context-engineering) documentation.
262+
</Note>
263+
264+
#### Step 3: Apply the configuration
265+
266+
Set the `contextEngineeringPlan` on the handoff destination from your sensitive assistant. Here is an example using `previousAssistantMessages`:
267+
268+
```json
269+
"assistantDestinations": [
270+
{
271+
"type": "assistant",
272+
"assistantName": "Confirmation Assistant",
273+
"description": "Transfer to the confirmation assistant after payment collection.",
274+
"contextEngineeringPlan": {
275+
"type": "previousAssistantMessages"
276+
}
277+
}
278+
]
279+
```
280+
281+
Or equivalently, when using the handoff tool:
282+
283+
```json
284+
{
285+
"type": "handoff",
286+
"destinations": [
287+
{
288+
"type": "assistant",
289+
"assistantName": "Confirmation Assistant",
290+
"description": "Transfer to the confirmation assistant after payment collection.",
291+
"contextEngineeringPlan": {
292+
"type": "previousAssistantMessages"
293+
}
294+
}
295+
]
296+
}
297+
```
298+
299+
#### Step 4: Use variable extraction for safe data passing
300+
301+
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:
302+
303+
```json
304+
"assistantDestinations": [
305+
{
306+
"type": "assistant",
307+
"assistantName": "Confirmation Assistant",
308+
"contextEngineeringPlan": {
309+
"type": "previousAssistantMessages"
310+
},
311+
"variableExtractionPlan": {
312+
"schema": {
313+
"type": "object",
314+
"properties": {
315+
"lastFourDigits": {
316+
"type": "string",
317+
"description": "Last four digits of the card number"
318+
}
319+
}
320+
}
321+
}
322+
}
323+
]
324+
```
325+
326+
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.
327+
328+
<Tip>
329+
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.
330+
</Tip>
331+
230332
## Can PCI be used alongside HIPAA?
231333
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.
232334

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 - Securing Handoffs](/security-and-privacy/pci#securing-handoffs-with-sensitive-data) 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)