Step

View as MarkdownOpen in Claude

A Step represents a single phase within a Context. Each step has its own prompt text, completion criteria, available functions, and navigation rules. The AI advances through steps automatically when criteria are met.

You create steps by calling addStep() on a Context object. All setter methods return this for fluent method chaining.

Properties

name
stringRequired

Step name. Must be unique within the parent context.

Methods

Example

1import { ContextBuilder } from '@signalwire/sdk';
2
3const builder = new ContextBuilder();
4const ctx = builder.addContext('default');
5
6const step = ctx.addStep('collect_info');
7
8// Structured prompt with POM sections
9step.addSection('Task', 'Collect the caller\'s account information.');
10step.addBullets('Required Information', [
11 'Full legal name',
12 'Account number (10 digits)',
13 'Reason for calling',
14]);
15
16// Completion criteria
17step.setStepCriteria(
18 'Complete when all three pieces of information have been collected and confirmed with the caller.'
19);
20
21// Only allow relevant functions
22step.setFunctions(['lookup_account', 'verify_identity']);
23
24// Navigation
25step.setValidSteps(['process_request', 'escalate']);