For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • Configuration
      • ContextBuilder
        • addContext
        • Context
        • createSimpleContext
        • GatherInfo & GatherQuestion
        • getCompletionAction
        • getContext
        • getGatherInfo
        • getQuestions
        • getStepOrder
        • getSteps
        • getValidContexts
        • reset
        • Step
          • addBullets
          • addGatherQuestion
          • addSection
          • clearSections
          • setEnd
          • setFunctions
          • setGatherInfo
          • setResetConsolidate
          • setResetFullReset
          • setResetSystemPrompt
          • setResetUserPrompt
          • setSkipToNextStep
          • setSkipUserTurn
          • setStepCriteria
          • setText
          • setValidContexts
          • setValidSteps
        • toDict
        • validate
      • DataMap
      • FunctionResult
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • ChatResource
      • Compat
      • Datasphere
      • Fabric
      • ImportedNumbersResource
      • Logs
      • LookupResource
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSubResource
      • Queues
      • Recordings
      • Registry
      • RestClient
      • RestError
      • Short Codes
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Properties
  • Methods
  • Example
AgentsContextBuilder

Step

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

addBullets

Next
Built with

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

addBullets

Add a POM section with bullet points to the step.

addGatherQuestion

Add a question to this step’s gather info configuration.

addSection

Add a POM section to the step.

clearSections

Remove all POM sections and direct text from this step.

setEnd

Set whether the conversation should end after this step completes.

setFunctions

Set which SWAIG functions are available during this step.

setGatherInfo

Enable structured info gathering for this step.

setResetConsolidate

Set whether to consolidate conversation history on context switch.

setResetFullReset

Set whether to fully reset conversation history on context switch.

setResetSystemPrompt

Set a new system prompt for context switching from this step.

setResetUserPrompt

Set a user message to inject when this step triggers a context switch.

setSkipToNextStep

Automatically advance to the next step without evaluating criteria.

setSkipUserTurn

Skip waiting for user input when entering this step.

setStepCriteria

Define when this step is considered complete.

setText

Set the step’s prompt text directly.

setValidContexts

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

setValidSteps

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

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']);