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

1from signalwire import AgentBase
2
3agent = AgentBase(name="my-agent", route="/agent")
4
5contexts = agent.define_contexts()
6ctx = contexts.add_context("default")
7ctx.add_step("greet").set_text("Welcome the caller.")
8transfer = ctx.add_step("transfer")
9transfer.set_text("Transfer the caller to billing.")
10transfer.set_valid_contexts(["billing"])
11transfer.set_reset_system_prompt(
12 "You are now a billing specialist. Help the customer with their invoice."
13)
14billing = contexts.add_context("billing")
15billing.add_step("invoice").set_text("Help with billing inquiries.")
16
17agent.serve()