***

title: set_step_criteria
slug: /reference/python/agents/context-builder/step/set-step-criteria
description: Define when this step is considered complete.
max-toc-depth: 3
---------------------

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

[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**

<ParamField path="criteria" type="str" required={true} toc={true}>
  Natural-language description of completion conditions.
</ParamField>

## **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".
</Tip>

## **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()
```