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

from signalwire import AgentBase
agent = AgentBase(name="my-agent", route="/agent")
contexts = agent.define_contexts()
contexts.add_context("default").add_step("menu").set_text("Ask what the caller needs.")
secure = contexts.add_context("secure")
secure.set_isolated(True)
secure.set_system_prompt("You are verifying the caller's identity.")
secure.add_step("verify").set_text("Ask for the caller's account PIN.")
agent.serve()