setValidSteps

View as MarkdownOpen in Claude

Set which steps the agent can navigate to from this step.

Parameters

steps
string[]Required

List of step names within the same context. Use "next" to allow sequential advancement to the next step in order.

Returns

Step — Self for method chaining.

Example

1import { ContextBuilder } from '@signalwire/sdk';
2
3const builder = new ContextBuilder();
4const ctx = builder.addContext('default');
5ctx.addStep('greet').setText('Welcome the caller.');
6const step = ctx.addStep('collect_info');
7step.setText('Collect the caller\'s information.');
8step.setValidSteps(['process_request', 'escalate']);
9ctx.addStep('process_request').setText('Process the caller\'s request.');
10ctx.addStep('escalate').setText('Escalate to a human agent.');