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

# addStep

> Add a new step to this context.

[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.

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`** `string` — required

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