***

title: setValidContexts
slug: /reference/typescript/agents/context-builder/context/set-valid-contexts
description: Set which contexts the agent can navigate to from 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 contexts the agent can navigate to from this context. Acts as a
context-level default; step-level `setValidContexts()` can further restrict or
expand navigation for individual steps.

## **Parameters**

<ParamField path="contexts" type="string[]" required={true} toc={true}>
  List of context names that are reachable from this context.
</ParamField>

## **Returns**

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

## **Example**

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

const builder = new ContextBuilder();
const main = builder.addContext('default');
main.addStep('greet').setText('Welcome the caller.');
const support = builder.addContext('support');
support.setValidContexts(['default', 'billing']);
support.addStep('help').setText('Help the caller with their issue.');
const billing = builder.addContext('billing');
billing.addStep('invoice').setText('Help with billing inquiries.');
```