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

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