# ConversationBufferWindowMemory

> **Class** in `langchain_classic`

📖 [View in docs](https://reference.langchain.com/python/langchain-classic/memory/buffer_window/ConversationBufferWindowMemory)

Use to keep track of the last k turns of a conversation.

If the number of messages in the conversation is more than the maximum number
of messages to keep, the oldest messages are dropped.

## Signature

```python
ConversationBufferWindowMemory()
```

## Extends

- `BaseChatMemory`

## Properties

- `human_prefix`
- `ai_prefix`
- `memory_key`
- `k`
- `buffer`
- `buffer_as_str`
- `buffer_as_messages`
- `memory_variables`

## Methods

- [`load_memory_variables()`](https://reference.langchain.com/python/langchain-classic/memory/buffer_window/ConversationBufferWindowMemory/load_memory_variables)

## ⚠️ Deprecated

Deprecated since version 0.3.1. Use langchain.agents.create_agent instead. Will be removed in version 2.0.0. For agents that need to remember prior interactions, use `create_agent` with checkpointing or the `Store` API. See https://docs.langchain.com/oss/python/langchain/short-term-memory and https://docs.langchain.com/oss/python/langchain/long-term-memory

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/f4bc5031dbcf24edb0374a07830915a285222567/libs/langchain/langchain_classic/memory/buffer_window.py#L10)