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

# set_consolidate

> Set whether to consolidate conversation history when entering this context.

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

Set whether to consolidate (summarize) conversation history when entering this
context. Reduces token usage while preserving key information.

## **Parameters**

**`consolidate`** `bool` — required

Whether to consolidate previous conversation on entry.

---

## **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()
contexts.add_context("default").add_step("menu").set_text("Ask what the caller needs.")

support = contexts.add_context("support")
support.set_consolidate(True)
support.set_system_prompt("You are a patient technical support engineer.")
support.add_step("diagnose").set_text("Understand the customer's issue.")

agent.serve()
```