***

title: addStep
slug: /reference/typescript/agents/context-builder/context/add-step
description: Add a new step to this context.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[step]: /docs/server-sdks/reference/typescript/agents/context-builder/step

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.

## **Parameters**

<ParamField path="name" type="string" required={true} toc={true}>
  Step name. Must be unique within this context.
</ParamField>

<ParamField path="opts" type="object" toc={true}>
  Optional configuration object with the following fields:
</ParamField>

<Indent>
  <ParamField path="opts.task" type="string" toc={true}>
    Text for a "Task" POM section. Equivalent to calling `step.addSection('Task', task)`.
  </ParamField>

  <ParamField path="opts.bullets" type="string[]" toc={true}>
    List of bullet strings for a "Process" POM section. Equivalent to calling
    `step.addBullets('Process', bullets)`.
  </ParamField>

  <ParamField path="opts.criteria" type="string" toc={true}>
    Step-completion criteria. Equivalent to calling `step.setStepCriteria(criteria)`.
  </ParamField>

  <ParamField path="opts.functions" type="string | string[]" toc={true}>
    Tool names the step may call, or `"none"` to disable all tools.
    Equivalent to calling `step.setFunctions(functions)`.
  </ParamField>

  <ParamField path="opts.validSteps" type="string[]" toc={true}>
    Names of steps the agent may transition to. Equivalent to calling
    `step.setValidSteps(validSteps)`.
  </ParamField>
</Indent>

## **Returns**

[`Step`][step] -- The new step
for optional further chaining.

## **Examples**

### Compact syntax

```typescript {6-10}
import { ContextBuilder } from '@signalwire/sdk';

const builder = new ContextBuilder();
const ctx = builder.addContext('default');

ctx.addStep('get_name', {
  task: 'Ask for the customer\'s full name.',
  criteria: 'Customer has provided their full name',
  validSteps: ['get_email'],
});
ctx.addStep('get_email').setText('Ask for the customer\'s email address.');
```

### Method chaining

```typescript {6-9}
import { ContextBuilder } from '@signalwire/sdk';

const builder = new ContextBuilder();
const ctx = builder.addContext('default');

ctx.addStep('get_name')
  .addSection('Task', 'Ask for the customer\'s full name.')
  .setStepCriteria('Customer has provided their full name')
  .setValidSteps(['get_email']);
ctx.addStep('get_email').setText('Ask for the customer\'s email address.');
```