swml_change_step

View as MarkdownOpen in Claude

Transition to a different step within the current conversation context. Steps are defined using ContextBuilder and represent discrete stages in a workflow (e.g., “greeting”, “verification”, “checkout”).

Parameters

step_name
strRequired

Name of the step to transition to.

Returns

FunctionResult — self, for chaining.

Example

1from signalwire import AgentBase
2from signalwire import FunctionResult
3
4agent = AgentBase(name="my-agent", route="/agent")
5agent.set_prompt_text("You are a helpful assistant.")
6
7@agent.tool(name="move_to_checkout", description="Transition to the checkout step")
8def move_to_checkout(args, raw_data):
9 return (
10 FunctionResult("Moving to checkout.")
11 .swml_change_step("checkout")
12 )
13
14agent.serve()