Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

remove memory

mertunsall5039c5aec629
diff --git a/README.md b/README.md
index f35c75a54..ae8bb36a1 100644
--- a/README.md
+++ b/README.md
@@ -28,12 +28,6 @@ With pip (Python>=3.11):
pip install browser-use
```
-For memory functionality (requires Python<3.13 due to PyTorch compatibility):
-
-```bash
-pip install "browser-use[memory]"
-```
-
Install the browser:
```bash
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index f71d8e56d..e5801bbff 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -33,7 +33,6 @@ from pydantic import ValidationError
from uuid_extensions import uuid7str
from browser_use.agent.gif import create_history_gif
-
from browser_use.agent.message_manager.service import (
MessageManager,
)
@@ -183,12 +182,14 @@ class Agent(Generic[Context]):
):
# Check for deprecated memory parameters
if kwargs.get('enable_memory', False) or kwargs.get('memory_config') is not None:
- raise ValueError(
- "Memory support has been removed as of version 0.3.2. "
- "The agent context for memory is significantly improved and no longer requires the old memory system. "
+ logger.warning(
+ 'Memory support has been removed as of version 0.3.2. '
+ 'The agent context for memory is significantly improved and no longer requires the old memory system. '
"Please remove the 'enable_memory' and 'memory_config' parameters."
)
-
+ kwargs['enable_memory'] = False
+ kwargs['memory_config'] = None
+
if page_extraction_llm is None:
page_extraction_llm = llm
if available_file_paths is None:
@@ -238,8 +239,6 @@ class Agent(Generic[Context]):
if self.settings.planner_llm:
self.token_cost_service.register_llm(self.settings.planner_llm)
-
-
# Initialize state
self.state = injected_agent_state or AgentState()
@@ -309,8 +308,6 @@ class Agent(Generic[Context]):
sensitive_data=sensitive_data,
)
-
-
if isinstance(browser, BrowserSession):
browser_session = browser_session or browser
@@ -638,8 +635,6 @@ class Agent(Generic[Context]):
self._log_step_context(current_page, browser_state_summary)
-
-
await self._raise_if_stopped_or_paused()
# Update action models with page-specific actions
diff --git a/browser_use/logging_config.py b/browser_use/logging_config.py
index 41899ea6f..ae1a90fe3 100644
--- a/browser_use/logging_config.py
+++ b/browser_use/logging_config.py
@@ -128,10 +128,6 @@ def setup_logging():
'PIL.PngImagePlugin',
'trafilatura.htmlprocessing',
'trafilatura',
- 'mem0',
- 'mem0.vector_stores.faiss',
- 'mem0.vector_stores',
- 'mem0.memory',
'groq',
]
for logger_name in third_party_loggers:
diff --git a/docs/customize/agent-settings.mdx b/docs/customize/agent-settings.mdx
index 008c5e856..7be0eb7de 100644
--- a/docs/customize/agent-settings.mdx
+++ b/docs/customize/agent-settings.mdx
@@ -232,128 +232,18 @@ Using a separate planner model can help:
- `retry_delay`: Time to wait between retries in seconds when rate limited. Defaults to `10`.
- `generate_gif`: Enable/disable GIF generation. Defaults to `False`. Set to `True` or a string path to save the GIF.
-## Memory Management
+## Memory
-Browser Use includes a procedural memory system using [Mem0](https://mem0.ai) that automatically summarizes the agent's conversation history at regular intervals to optimize context window usage during long tasks.
+Memory management in browser-use has been significantly improved since version 0.3.2. The agent's context handling and state management are now robust enough that the previous memory system (`mem0`) is no longer needed or supported.
-```python
-from browser_use.agent.memory import MemoryConfig
-
-agent = Agent(
- task="your task",
- llm=llm,
- enable_memory=True,
- memory_config=MemoryConfig( # Ensure llm_instance is passed if not using default LLM config
- llm_instance=llm, # Important: Pass the agent's LLM instance here
- agent_id="my_custom_agent",
- memory_interval=15
- )
-)
-```
-
-### Memory Parameters
-
-- `enable_memory`: Enable/disable the procedural memory system. Defaults to `True`.
-- `memory_config`: A `MemoryConfig` Pydantic model instance (required if `enable_memory` is `True`). Dictionary format is not supported.
-
-### Using MemoryConfig
-
-You must configure the memory system using the `MemoryConfig` Pydantic model for a type-safe approach:
-
-```python
-from browser_use.agent.memory import MemoryConfig
-from browser_use.llm import ChatOpenAI # Assuming llm is an instance of ChatOpenAI
-
-llm_for_agent = ChatOpenAI(model="gpt-4o")
-
-agent = Agent(
- task=task_description,
- llm=llm_for_agent,
- enable_memory=True, # This is True by default
- memory_config=MemoryConfig(
- llm_instance=llm_for_agent, # Pass the LLM instance for Mem0
- agent_id="my_agent",
- memory_interval=15, # Summarize every 15 steps
- embedder_provider="openai",
- embedder_model="text-embedding-3-large",
- embedder_dims=1536,
- # --- Vector Store Customization ---
- vector_store_provider="qdrant", # e.g., Qdrant, Pinecone, Chroma, etc.
- vector_store_collection_name="my_browser_use_memories", # Optional: custom collection name
- vector_store_config_override={ # Provider-specific config
- "host": "localhost",
- "port": 6333
- # Add other Qdrant specific configs here if needed, e.g., api_key for cloud
- }
- )
-)
-```
-
-The `MemoryConfig` model provides these configuration options:
-
-#### Memory Settings
-
-- `agent_id`: Unique identifier for the agent (default: `"browser_use_agent"`). Essential for persistent memory sessions if using a persistent vector store.
-- `memory_interval`: Number of steps between memory summarization (default: `10`)
+The agent maintains its context and task progress through:
-#### LLM Settings (for Mem0's internal operations)
+- Detailed history tracking of actions and results
+- Structured state management
+- Clear goal setting and evaluation at each step
-- `llm_instance`: The `BaseChatModel` instance that Mem0 will use for its internal summarization and processing. You must pass the same LLM instance used by the main agent, or another compatible one, here.
-
-#### Embedder Settings
-
-- `embedder_provider`: Provider for embeddings (`'openai'`, `'gemini'`, `'ollama'`, or `'huggingface'`)
-- `embedder_model`: Model name for the embedder
-- `embedder_dims`: Dimensions for the embeddings
-
-#### Vector Store Settings
-
-- `vector_store_provider`: Choose the vector store backend. Supported options include:
- `'faiss'` (default), `'qdrant'`, `'pinecone'`, `'supabase'`, `'elasticsearch'`, `'chroma'`, `'weaviate'`, `'milvus'`, `'pgvector'`, `'upstash_vector'`, `'vertex_ai_vector_search'`, `'azure_ai_search'`, `'lancedb'`, `'mongodb'`, `'redis'`, `'memory'` (in-memory, non-persistent).
-- `vector_store_collection_name`: (Optional) Specify a custom name for the collection or index in your vector store. If not provided, a default name is generated (especially for local stores like FAISS/Chroma) or used by Mem0.
-- `vector_store_base_path`: Path for local vector stores like FAISS or Chroma (e.g., `/tmp/mem0`). Default is `/tmp/mem0`.
-- `vector_store_config_override`: (Optional) A dictionary to provide or override specific configuration parameters required by Mem0 for the chosen `vector_store_provider`. This is where you'd put connection details like `host`, `port`, `api_key`, `url`, `environment`, etc., for cloud-based or server-based vector stores.
-
-The model automatically sets appropriate defaults based on the LLM being used:
-
-- For `ChatOpenAI`: Uses OpenAI's `text-embedding-3-small` embeddings
-- For `ChatGoogleGenerativeAI`: Uses Gemini's `models/text-embedding-004` embeddings
-- For `ChatOllama`: Uses Ollama's `nomic-embed-text` embeddings
-- Default: Uses Hugging Face's `all-MiniLM-L6-v2` embeddings
-
-<Note>
- **Important:** - Always pass a properly constructed `MemoryConfig` object to
- the `memory_config` parameter. - Ensure the `llm_instance` is provided to
- `MemoryConfig` so Mem0 can perform its operations. - For persistent memory
- across agent runs or for shared memory, choose a scalable vector store
- provider (like Qdrant, Pinecone, etc.) and configure it correctly using
- `vector_store_provider` and `vector_store_config_override`. The default
- 'faiss' provider stores data locally in `vector_store_base_path`.
-</Note>
-
-### How Memory Works
-
-When enabled, the agent periodically compresses its conversation history into concise summaries:
-
-1. Every `memory_interval` steps, the agent reviews its recent interactions.
-2. It uses Mem0 (configured with your chosen LLM and vector store) to create a procedural memory summary.
-3. The original messages in the agent's active context are replaced with this summary, reducing token usage.
-4. This process helps maintain important context while freeing up the context window for new information.
-
-### Disabling Memory
-
-If you want to disable the memory system (for debugging or for shorter tasks), set `enable_memory` to `False`:
-
-```python
-agent = Agent(
- task="your task",
- llm=llm,
- enable_memory=False
-)
-```
+The `enable_memory` parameter has been removed as the new system provides better context management by default.
<Note>
- Disabling memory may be useful for debugging or short tasks, but for longer
- tasks, it can lead to context window overflow as the conversation history
- grows. The memory system helps maintain performance during extended sessions.
+ If you're upgrading from an older version that used `enable_memory`, simply remove this parameter. The agent will automatically use the improved context management system.
</Note>
diff --git a/pyproject.toml b/pyproject.toml
index acc95e300..11abe2084 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -47,12 +47,6 @@ dependencies = [
# textual: used for terminal UI
[project.optional-dependencies]
-memory = [
- # sentence-transformers: depends on pytorch, which does not support python 3.13 yet
- # faiss-cpu: >= 1.11.0 breaks on some macOS hosts, make sure to test before upgrading
- "faiss-cpu>=1.10.0",
- "sentence-transformers>=4.0.2",
-]
cli = [
"rich>=14.0.0",
"click>=8.1.8",
@@ -72,7 +66,7 @@ eval = [
"psutil>=7.0.0",
]
all = [
- "browser-use[memory,cli,examples]",
+ "browser-use[cli,examples]",
]
# will prefer to use local source code checked out in ../../browser-use (if present) instead of pypi browser-use package