***

title: set_consolidate
slug: /reference/python/agents/context-builder/context/set-consolidate
description: Set whether to consolidate conversation history when entering 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 whether to consolidate (summarize) conversation history when entering this
context. Reduces token usage while preserving key information.

## **Parameters**

<ParamField path="consolidate" type="bool" required={true} toc={true}>
  Whether to consolidate previous conversation on entry.
</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()
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()
```