[PR #646] [MERGED] feature(deepagents): add memory #798

Closed
opened 2026-02-16 09:17:12 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagents/pull/646
Author: @vtrivedy
Created: 1/3/2026
Status: Merged
Merged: 1/7/2026
Merged by: @vtrivedy

Base: masterHead: vivek-skills-memory


📝 Commits (10+)

  • 7aeeb4b x
  • 3838cdd x
  • 92dd49c x
  • 8f6ab28 skills updates
  • e8bef37 add tests and verify works across backends
  • ea87efa memory implementation, can remove the memory_demo.py for actual PR
  • 0e996aa Merge branch 'master' into vivek-skills-memory
  • 5328aba chore: run ruff linting and formatting
  • f66e6b4 feat: memory should use async accesses to load the memory in abefore_agent (#664)
  • 3394c4f Merge branch 'master' into vivek-skills-memory

📊 Changes

8 files changed (+2487 additions, -1 deletions)

View changed files

📝 libs/deepagents/deepagents/__init__.py (+9 -1)
📝 libs/deepagents/deepagents/graph.py (+8 -0)
📝 libs/deepagents/deepagents/middleware/__init__.py (+2 -0)
libs/deepagents/deepagents/middleware/memory.py (+379 -0)
libs/deepagents/tests/integration_tests/test_full_agent_integration.py (+407 -0)
libs/deepagents/tests/integration_tests/test_memory_integration.py (+492 -0)
libs/deepagents/tests/unit_tests/middleware/test_memory_middleware.py (+827 -0)
libs/deepagents/tests/unit_tests/middleware/test_memory_middleware_async.py (+363 -0)

📄 Description

Summary

MemoryMiddleware (new)

  • Loads persistent context from AGENTS.md files following the agents.md spec
  • Always-on injection into system prompt (unlike skills which are on-demand)
  • Supports multiple sources (e.g., user-level + project-level)
  • Content wrapped in XML tags (<user_memory>, <project_memory>)

Usage

Memory (always-on context)

memory = MemoryMiddleware(
    backend=FilesystemBackend(root_dir="/"),
    sources=[
        {"path": "~/.deepagents/AGENTS.md", "name": "user"},
        {"path": "./.deepagents/AGENTS.md", "name": "project"},
    ],
)

- Sources are loaded in order, combined into prompt
- Each wrapped in XML: <user_memory>, <project_memory>
- Missing files skipped silently
- File format: plain markdown

---

<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagents/pull/646 **Author:** [@vtrivedy](https://github.com/vtrivedy) **Created:** 1/3/2026 **Status:** ✅ Merged **Merged:** 1/7/2026 **Merged by:** [@vtrivedy](https://github.com/vtrivedy) **Base:** `master` ← **Head:** `vivek-skills-memory` --- ### 📝 Commits (10+) - [`7aeeb4b`](https://github.com/langchain-ai/deepagents/commit/7aeeb4bae6875f20f44d058b575104b5c88a8b00) x - [`3838cdd`](https://github.com/langchain-ai/deepagents/commit/3838cdd2accbc01d1794a61a9895e5c2c41536f1) x - [`92dd49c`](https://github.com/langchain-ai/deepagents/commit/92dd49c7d0901cccbb59e7e2863e4c4819d22f7b) x - [`8f6ab28`](https://github.com/langchain-ai/deepagents/commit/8f6ab28ae99cecbcec0ee2f730be86c4b047005d) skills updates - [`e8bef37`](https://github.com/langchain-ai/deepagents/commit/e8bef3722d05e831b5dc577fb6e5312fb200bfa1) add tests and verify works across backends - [`ea87efa`](https://github.com/langchain-ai/deepagents/commit/ea87efa3aba12eb1e62c29c6099f9d4006e6f6d0) memory implementation, can remove the memory_demo.py for actual PR - [`0e996aa`](https://github.com/langchain-ai/deepagents/commit/0e996aa253a1607132354e37971623dacc50c710) Merge branch 'master' into vivek-skills-memory - [`5328aba`](https://github.com/langchain-ai/deepagents/commit/5328abafd8d89f85d1f8d90715e700516d31ad5e) chore: run ruff linting and formatting - [`f66e6b4`](https://github.com/langchain-ai/deepagents/commit/f66e6b4c9eda69474d3d9d2f6e089e1f02394fe6) feat: memory should use async accesses to load the memory in abefore_agent (#664) - [`3394c4f`](https://github.com/langchain-ai/deepagents/commit/3394c4f70bbe29b9b47a216517820769c6ff4645) Merge branch 'master' into vivek-skills-memory ### 📊 Changes **8 files changed** (+2487 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `libs/deepagents/deepagents/__init__.py` (+9 -1) 📝 `libs/deepagents/deepagents/graph.py` (+8 -0) 📝 `libs/deepagents/deepagents/middleware/__init__.py` (+2 -0) ➕ `libs/deepagents/deepagents/middleware/memory.py` (+379 -0) ➕ `libs/deepagents/tests/integration_tests/test_full_agent_integration.py` (+407 -0) ➕ `libs/deepagents/tests/integration_tests/test_memory_integration.py` (+492 -0) ➕ `libs/deepagents/tests/unit_tests/middleware/test_memory_middleware.py` (+827 -0) ➕ `libs/deepagents/tests/unit_tests/middleware/test_memory_middleware_async.py` (+363 -0) </details> ### 📄 Description ## Summary **MemoryMiddleware** (new) - Loads persistent context from `AGENTS.md` files following the [agents.md](https://agents.md) spec - Always-on injection into system prompt (unlike skills which are on-demand) - Supports multiple sources (e.g., user-level + project-level) - Content wrapped in XML tags (`<user_memory>`, `<project_memory>`) ## Usage ### Memory (always-on context) ```python memory = MemoryMiddleware( backend=FilesystemBackend(root_dir="/"), sources=[ {"path": "~/.deepagents/AGENTS.md", "name": "user"}, {"path": "./.deepagents/AGENTS.md", "name": "project"}, ], ) - Sources are loaded in order, combined into prompt - Each wrapped in XML: <user_memory>, <project_memory> - Missing files skipped silently - File format: plain markdown --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 09:17:12 -05:00
yindo closed this issue 2026-02-16 09:17:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagents#798