set_isolated

View as MarkdownOpen in Claude

Set whether to truncate conversation history when entering this context. Creates a clean slate for the new context.

Parameters

isolated
boolRequired

Whether to truncate conversation history on entry.

Returns

Context — Self for method chaining.

Example

1from signalwire import AgentBase
2
3agent = AgentBase(name="my-agent", route="/agent")
4
5contexts = agent.define_contexts()
6contexts.add_context("default").add_step("menu").set_text("Ask what the caller needs.")
7
8secure = contexts.add_context("secure")
9secure.set_isolated(True)
10secure.set_system_prompt("You are verifying the caller's identity.")
11secure.add_step("verify").set_text("Ask for the caller's account PIN.")
12
13agent.serve()