***

title: add_step
slug: /reference/python/agents/context-builder/context/add-step
description: Add a new step to this context.
max-toc-depth: 3
---------------------

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

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

Add a new step to this context. When called with only `name`, the returned Step
can be configured via method chaining. When keyword arguments are provided, the
step is fully configured in one call.

Raises `ValueError` if the step name already exists in this context or the maximum
steps per context limit (100) is exceeded.

## **Parameters**

<ParamField path="name" type="str" required={true} toc={true}>
  Step name. Must be unique within this context.
</ParamField>

<ParamField path="task" type="str" toc={true}>
  Text for a "Task" POM section. Equivalent to calling `step.add_section("Task", task)`.
</ParamField>

<ParamField path="bullets" type="list[str]" toc={true}>
  List of bullet strings for a "Process" POM section. Equivalent to calling
  `step.add_bullets("Process", bullets)`. Requires `task` to also be set.
</ParamField>

<ParamField path="criteria" type="str" toc={true}>
  Step-completion criteria. Equivalent to calling `step.set_step_criteria(criteria)`.
</ParamField>

<ParamField path="functions" type="str | list[str]" toc={true}>
  Tool names the step may call, or `"none"` to disable all tools.
  Equivalent to calling `step.set_functions(functions)`.
</ParamField>

<ParamField path="valid_steps" type="list[str]" toc={true}>
  Names of steps the agent may transition to. Equivalent to calling
  `step.set_valid_steps(valid_steps)`.
</ParamField>

## **Returns**

[`Step`][step] -- The new step
for optional further chaining.

## **Examples**

### Compact syntax

```python {8,13}
from signalwire import AgentBase

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

contexts = agent.define_contexts()
ctx = contexts.add_context("default")

ctx.add_step("get_name",
    task="Ask for the customer's full name.",
    criteria="Customer has provided their full name",
    valid_steps=["get_email"]
)
ctx.add_step("get_email").set_text("Ask for the customer's email address.")

agent.serve()
```

### Method chaining

```python {8,12}
from signalwire import AgentBase

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

contexts = agent.define_contexts()
ctx = contexts.add_context("default")

ctx.add_step("get_name") \
    .add_section("Task", "Ask for the customer's full name.") \
    .set_step_criteria("Customer has provided their full name") \
    .set_valid_steps(["get_email"])
ctx.add_step("get_email").set_text("Ask for the customer's email address.")

agent.serve()
```