Skip to main content
Flows provides three built-in ways to manage conversation context as you move between nodes.

Strategy Types

  1. APPEND (Default): New node messages are added to the existing context, preserving the full conversation history. The context grows as the conversation progresses.
  2. RESET: The context is cleared and replaced with only the new node’s messages. Useful when previous conversation history is no longer relevant or to reduce context window size.
  3. RESET_WITH_SUMMARY: The context is cleared but includes an AI-generated summary of the previous conversation along with the new node’s messages. Helps reduce context size while preserving key information.

When to Use Each Strategy

  • Use APPEND when full conversation history is important for context
  • Use RESET when starting a new topic or when previous context might confuse the current task
  • Use RESET_WITH_SUMMARY for long conversations where you need to preserve key points but reduce context size

Configuration

Context strategies can be defined globally in the FlowManager constructor:
from pipecat_flows import ContextStrategy, ContextStrategyConfig

# Global strategy configuration
flow_manager = FlowManager(
    task=task,
    llm=llm,
    context_aggregator=context_aggregator,
    context_strategy=ContextStrategyConfig(
        strategy=ContextStrategy.APPEND,
    )
)
Or on a per-node basis:
# Per-node strategy configuration
node_config = {
    "task_messages": [...],
    "functions": [...],
    "context_strategy": ContextStrategyConfig(
        strategy=ContextStrategy.RESET_WITH_SUMMARY,
        summary_prompt="Provide a concise summary of the customer's order details and preferences."
    )
}