> ## Documentation Index
> Fetch the complete documentation index at: https://daily-docs-flows-declarative.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Context Strategies

> Manage Pipecat Flows conversation context across node transitions: the append and reset strategies, and deprecated summarization.

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.

<Warning>
  `RESET_WITH_SUMMARY` is deprecated and will be removed in 2.0. Use Pipecat's
  native
  [`LLMSummarizeContextFrame`](/pipecat/fundamentals/context-summarization)
  instead. To trigger on-demand summarization during a node transition, push an
  `LLMSummarizeContextFrame` in a pre-action.
</Warning>

## 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** *(deprecated)* for long conversations where you need to preserve key points but reduce context size. Prefer Pipecat's native [context summarization](/pipecat/fundamentals/context-summarization) for new code.

## Global Configuration

The default strategy for every node is set on the `FlowManager` constructor, in both forms of flow:

```python theme={null}
from pipecat.flows import ContextStrategy, ContextStrategyConfig

flow_manager = FlowManager(
    worker=worker,
    llm=llm,
    context_aggregator=context_aggregator,
    context_strategy=ContextStrategyConfig(
        strategy=ContextStrategy.APPEND,
    )
)
```

## Per-Node Configuration

A node can override the global strategy:

<Tabs>
  <Tab title="Declarative">
    ```yaml theme={null}
    nodes:
      new_topic:
        context_strategy: reset
        task_messages:
          - role: developer
            content: Ask the customer what else you can help with.
    ```

    A node's `context_strategy` is either `append` or `reset`. Omit it to use the `FlowManager`'s strategy.

    <Note>
      `RESET_WITH_SUMMARY` is not available in a flow config. It takes a
      `summary_prompt` alongside the strategy, which a node's single
      `context_strategy` key has nowhere to put. It is deprecated in any case —
      prefer [context summarization](/pipecat/fundamentals/context-summarization).
    </Note>
  </Tab>

  <Tab title="Programmatic">
    ```python theme={null}
    node_config = NodeConfig(
        task_messages=[...],
        functions=[...],
        context_strategy=ContextStrategyConfig(
            strategy=ContextStrategy.RESET,
        ),
    )
    ```

    The deprecated `RESET_WITH_SUMMARY` takes a prompt for the summary it generates:

    ```python theme={null}
    node_config = NodeConfig(
        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.",
        ),
    )
    ```
  </Tab>
</Tabs>
