> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# setStepCriteria

> Define when this step is considered complete.

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

Define when this step is considered complete. The AI evaluates this description
against the conversation state to determine whether to advance.

## **Parameters**

**`criteria`** `string` — required

Natural-language description of completion conditions.

---

## **Returns**

[`Step`][ref-step] -- Self for method chaining.

> **Tip**
>
> Be specific. Write "Customer has provided their full name AND phone number" rather
> than "Information collected". Include failure conditions when appropriate:
> "Verified OR after 3 failed attempts".

## **Example**

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

const builder = new ContextBuilder();
const ctx = builder.addContext('default');
const step = ctx.addStep('verify_identity');
step.setText('Verify the caller\'s identity.');
step.setStepCriteria(
  'Complete when the customer has provided their account number ' +
  'AND verified it with the last four digits of their SSN, ' +
  'OR after 3 failed verification attempts.'
);
```