***

title: setValidSteps
slug: /reference/typescript/agents/context-builder/context/set-valid-steps
description: Set which steps can be navigated to from any step in this context.
max-toc-depth: 3
---------------------

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

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

Set which steps can be navigated to from **any** step in this context. Acts as a
context-level default; step-level `setValidSteps()` takes precedence when set.

## **Parameters**

<ParamField path="steps" type="string[]" required={true} toc={true}>
  List of step names. Include `"next"` to allow sequential advancement.
</ParamField>

## **Returns**

[`Context`][ref-context] -- Self for method chaining.

## **Example**

```typescript {5}
import { ContextBuilder } from '@signalwire/sdk';

const builder = new ContextBuilder();
const ctx = builder.addContext('default');
ctx.setValidSteps(['next', 'cancel']);
ctx.addStep('greet').setText('Welcome the caller.');
ctx.addStep('collect').setText('Collect information.');
ctx.addStep('cancel').setText('Cancel the process and say goodbye.');
```