setIsolated

View as MarkdownOpen in Claude

Set whether this context is isolated from other contexts’ conversation history. When true, entering this context via change_context wipes the conversation array — the model starts fresh with only this context’s system prompt and step instructions, with no memory of prior turns.

If the context also has a reset configured (setConsolidate(true) or setFullReset(true)), the wipe is skipped in favor of the reset behavior. Use reset with setConsolidate(true) to summarize prior history into a single message instead of dropping it entirely.

Parameters

isolated
booleanRequired

Whether to isolate this context from other contexts’ conversation history.

Returns

Context — Self for method chaining.

Example

1import { ContextBuilder } from '@signalwire/sdk';
2
3const builder = new ContextBuilder();
4builder.addContext('default').addStep('menu').setText('Ask what the caller needs.');
5
6const secure = builder.addContext('secure');
7secure.setIsolated(true);
8secure.setSystemPrompt('You are verifying the caller\'s identity.');
9secure.addStep('verify').setText('Ask for the caller\'s account PIN.');