> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# set_history

> Set the default history visibility mode for every step in this context.

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

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

Set the default visibility mode for every step in this context. A step's own
[`set_history()`][ref-step-set-history] overrides it. See that page for what
each mode does.

## Parameters

**`history`** `str` — required

One of `"keep"`, `"default"`, or `"hide"`.

---

## Returns

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

## Raises

`ValueError` if `history` is not one of the three modes.

## Example

```python {6}
from signalwire import AgentBase

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

contexts = agent.define_contexts()
ctx = contexts.add_context("default").set_history("hide")
ctx.add_step("greet").set_text("Greet the caller.")
ctx.add_step("help").set_text("Previously: ${step_history.prev.summary}. Help them.")

agent.serve()
```