set_reset_system_prompt

View as MarkdownOpen in Claude

Set a new system prompt for when this step navigates to another context.

Parameters

system_prompt
strRequired

New system prompt to use during the context switch.

Returns

Step — Self for method chaining.

Example

from signalwire import AgentBase
agent = AgentBase(name="my-agent", route="/agent")
contexts = agent.define_contexts()
ctx = contexts.add_context("default")
ctx.add_step("greet").set_text("Welcome the caller.")
transfer = ctx.add_step("transfer")
transfer.set_text("Transfer the caller to billing.")
transfer.set_valid_contexts(["billing"])
transfer.set_reset_system_prompt(
"You are now a billing specialist. Help the customer with their invoice."
)
billing = contexts.add_context("billing")
billing.add_step("invoice").set_text("Help with billing inquiries.")
agent.serve()