***

title: set_valid_steps
slug: /reference/python/agents/context-builder/step/set-valid-steps
description: Set which steps the agent can navigate to from this step.
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

Set which steps the agent can navigate to from this step.

## **Parameters**

<ParamField path="steps" type="list[str]" required={true} toc={true}>
  List of step names within the same context. Use `"next"` to allow sequential
  advancement to the next step in order.
</ParamField>

## **Returns**

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

## **Example**

```python {10}
from signalwire import AgentBase

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

contexts = agent.define_contexts()
ctx = contexts.add_context("default")
ctx.add_step("greet").set_text("Welcome the caller.")
step = ctx.add_step("collect_info")
step.set_text("Collect the caller's information.")
step.set_valid_steps(["process_request", "escalate"])
ctx.add_step("process_request").set_text("Process the caller's request.")
ctx.add_step("escalate").set_text("Escalate to a human agent.")

agent.serve()
```