set_consolidate

View as MarkdownOpen in Claude

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

Parameters

consolidate
boolRequired

Whether to consolidate previous conversation on entry.

Returns

Context — Self for method chaining.

Example

1from signalwire import AgentBase
2
3agent = AgentBase(name="my-agent", route="/agent")
4
5contexts = agent.define_contexts()
6contexts.add_context("default").add_step("menu").set_text("Ask what the caller needs.")
7
8support = contexts.add_context("support")
9support.set_consolidate(True)
10support.set_system_prompt("You are a patient technical support engineer.")
11support.add_step("diagnose").set_text("Understand the customer's issue.")
12
13agent.serve()