***

title: addContext
slug: /reference/typescript/agents/context-builder/add-context
description: Create a new named context and add it to the builder.
max-toc-depth: 3
---------------------

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

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

Create a new context and add it to the builder. Returns the Context object for
further configuration.

<Warning>
  A single-context agent must name its context `"default"` or validation will fail.
  Multi-context agents can use any names.
</Warning>

## **Parameters**

<ParamField path="name" type="string" required={true} toc={true}>
  Unique context name. When using a single context, it **must** be named `"default"`.
</ParamField>

## **Returns**

[`Context`][context] -- The newly
created context, ready for adding steps.

## **Examples**

### Single context

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

const builder = new ContextBuilder();
const ctx = builder.addContext('default');
ctx.addStep('greet').setText('Greet the caller and ask how you can help.');
```

### Multiple contexts

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

const builder = new ContextBuilder();
const main = builder.addContext('default');
const sales = builder.addContext('sales');
const support = builder.addContext('support');

main.addStep('menu').setText('Ask whether the caller needs sales or support.');
sales.addStep('qualify').setText('Understand what product the caller wants.');
support.addStep('diagnose').setText('Understand the customer\'s issue.');
```