***

title: set_valid_contexts
slug: /reference/python/agents/context-builder/context/set-valid-contexts
description: Set which contexts the agent can navigate to from this context.
max-toc-depth: 3
---------------------

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

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

Set which contexts the agent can navigate to from this context. Acts as a
context-level default; step-level `set_valid_contexts()` can further restrict or
expand navigation for individual steps.

## **Parameters**

<ParamField path="contexts" type="list[str]" required={true} toc={true}>
  List of context names that are reachable from this context.
</ParamField>

## **Returns**

[`Context`][ref-context] -- Self for method chaining.

## **Example**

```python {9}
from signalwire import AgentBase

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

contexts = agent.define_contexts()
default = contexts.add_context("default")
default.add_step("greet").set_text("Welcome the caller.")
support = contexts.add_context("support")
support.set_valid_contexts(["default", "billing"])
support.add_step("help").set_text("Help the caller with their issue.")
billing = contexts.add_context("billing")
billing.add_step("invoice").set_text("Help with billing inquiries.")

agent.serve()
```