set_reset_user_prompt

View as MarkdownOpen in Claude

Set a user message to inject when this step triggers a context switch.

Parameters

user_prompt
strRequired

User message to inject.

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_user_prompt(
12 "The customer needs help with their most recent invoice."
13)
14billing = contexts.add_context("billing")
15billing.add_step("invoice").set_text("Help with billing inquiries.")
16
17agent.serve()