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

from signalwire import AgentBase
from signalwire import FunctionResult
agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")
@agent.tool(name="move_to_checkout", description="Transition to the checkout step")
def move_to_checkout(args, raw_data):
return (
FunctionResult("Moving to checkout.")
.swml_change_step("checkout")
)
agent.serve()