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

# set_step_criteria

> Define when this step is considered complete.

[ref-step]: /docs/server-sdks/reference/python/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`** `str` — 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**

```python {9}
from signalwire import AgentBase

agent = AgentBase(name="my-agent", route="/agent")

contexts = agent.define_contexts()
ctx = contexts.add_context("default")
step = ctx.add_step("verify_identity")
step.set_text("Verify the caller's identity.")
step.set_step_criteria(
    "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."
)

agent.serve()
```