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
          • addBullets
          • addEnterFiller
          • addExitFiller
          • addSection
          • addStep
          • addSystemBullets
          • addSystemSection
          • getStep
          • moveStep
          • removeStep
          • setConsolidate
          • setEnterFillers
          • setExitFillers
          • setFullReset
          • setInitialStep
          • setIsolated
          • setPostPrompt
          • setPrompt
          • setSystemPrompt
          • setUserPrompt
          • setValidContexts
          • setValidSteps
        • createSimpleContext
        • GatherInfo & GatherQuestion
        • getCompletionAction
        • getContext
        • getGatherInfo
        • getQuestions
        • getStepOrder
        • getSteps
        • getValidContexts
        • reset
        • Step
        • 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
  • Parameters
  • Returns
  • Examples
  • Compact syntax
  • Method chaining
AgentsContextBuilderContext

addStep

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

addSystemBullets

Next
Built with

Add a new step to this context. When called with only name, the returned Step can be configured via method chaining. When an options object is provided, the step is fully configured in one call.

Throws an Error if the step name already exists in this context or if the maximum steps per context limit (100) is exceeded.

Parameters

name
stringRequired

Step name. Must be unique within this context.

opts
object

Optional configuration object with the following fields:

opts.task
string

Text for a “Task” POM section. Equivalent to calling step.addSection('Task', task).

opts.bullets
string[]

List of bullet strings for a “Process” POM section. Equivalent to calling step.addBullets('Process', bullets).

opts.criteria
string

Step-completion criteria. Equivalent to calling step.setStepCriteria(criteria).

opts.functions
string | string[]

Tool names the step may call, or "none" to disable all tools. Equivalent to calling step.setFunctions(functions).

opts.validSteps
string[]

Names of steps the agent may transition to. Equivalent to calling step.setValidSteps(validSteps).

Returns

Step — The new step for optional further chaining.

Examples

Compact syntax

1import { ContextBuilder } from '@signalwire/sdk';
2
3const builder = new ContextBuilder();
4const ctx = builder.addContext('default');
5
6ctx.addStep('get_name', {
7 task: 'Ask for the customer\'s full name.',
8 criteria: 'Customer has provided their full name',
9 validSteps: ['get_email'],
10});
11ctx.addStep('get_email').setText('Ask for the customer\'s email address.');

Method chaining

1import { ContextBuilder } from '@signalwire/sdk';
2
3const builder = new ContextBuilder();
4const ctx = builder.addContext('default');
5
6ctx.addStep('get_name')
7 .addSection('Task', 'Ask for the customer\'s full name.')
8 .setStepCriteria('Customer has provided their full name')
9 .setValidSteps(['get_email']);
10ctx.addStep('get_email').setText('Ask for the customer\'s email address.');