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

import { ContextBuilder } from '@signalwire/sdk';
const builder = new ContextBuilder();
const ctx = builder.addContext('default');
const step = ctx.addStep('collect_info');
// Structured prompt with POM sections
step.addSection('Task', 'Collect the caller\'s account information.');
step.addBullets('Required Information', [
'Full legal name',
'Account number (10 digits)',
'Reason for calling',
]);
// Completion criteria
step.setStepCriteria(
'Complete when all three pieces of information have been collected and confirmed with the caller.'
);
// Only allow relevant functions
step.setFunctions(['lookup_account', 'verify_identity']);
// Navigation
step.setValidSteps(['process_request', 'escalate']);