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

# reset

> Remove all contexts, returning the builder to its initial state.

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

[resetcontexts]: /docs/server-sdks/reference/python/agents/agent-base/reset-contexts

[setdynamicconfig]: /docs/server-sdks/reference/python/agents/agent-base/set-dynamic-config-callback

Remove all contexts from the builder, returning it to its initial empty state. Use
this in a [dynamic config callback][setdynamicconfig] when you need to rebuild
contexts from scratch for a specific request -- for example, skipping a greeting
context on transfers.

For convenience at the agent level, see
[`AgentBase.reset_contexts()`][resetcontexts], which wraps `define_contexts().reset()`.

## **Parameters**

None.

## **Returns**

[`ContextBuilder`][contextbuilder] -- Self for method chaining.

## **Example**

```python {6}
from signalwire import AgentBase

def on_dynamic_config(query, body, headers, agent):
    if query.get("transfer"):
        # Wipe the default contexts and rebuild for transfer flow
        agent.define_contexts().reset()
        ctx = agent.define_contexts().add_context("default")
        ctx.add_step("route").set_text("Route the caller.")

agent = AgentBase(name="router", route="/router")
agent.set_dynamic_config_callback(on_dynamic_config)
agent.serve()
```