Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
561d1bf
pluggable backend
hwchase17 Oct 22, 2025
3d341cb
cr
hwchase17 Oct 22, 2025
aa6fc34
cr
hwchase17 Oct 22, 2025
0692a30
cr
hwchase17 Oct 22, 2025
aebdfb9
cr
hwchase17 Oct 22, 2025
f0d2be0
cli pluggable
hwchase17 Oct 22, 2025
39515a1
cr
hwchase17 Oct 22, 2025
72d82be
cr
hwchase17 Oct 22, 2025
99f8200
cr
hwchase17 Oct 22, 2025
3b622da
cr
hwchase17 Oct 22, 2025
1205afe
Add glob and grep tools
nhuang-lc Oct 22, 2025
b5859df
cr
hwchase17 Oct 22, 2025
eca83b9
Add pagination
nhuang-lc Oct 22, 2025
9197920
cr
hwchase17 Oct 22, 2025
38dcca8
cr
hwchase17 Oct 22, 2025
875d28e
cr
hwchase17 Oct 22, 2025
fbc90a5
cr
hwchase17 Oct 22, 2025
1b56d6a
cr
hwchase17 Oct 22, 2025
1f69d58
cr
hwchase17 Oct 22, 2025
8c8382c
cr
hwchase17 Oct 22, 2025
dd5fa27
cr
hwchase17 Oct 22, 2025
3861a1e
cr
hwchase17 Oct 23, 2025
a2d1f4a
cr
hwchase17 Oct 23, 2025
c4f3198
cr
hwchase17 Oct 23, 2025
cead1d6
cr
hwchase17 Oct 23, 2025
e285ada
Change API to accept a single memory_backend, and fix all tests (#201)
nhuang-lc Oct 23, 2025
a3b85f8
cr
hwchase17 Oct 23, 2025
14bdf0b
cr
hwchase17 Oct 24, 2025
a1854a9
cr
hwchase17 Oct 24, 2025
e6f85cb
cr
hwchase17 Oct 24, 2025
36a42b3
cr
hwchase17 Oct 24, 2025
44fe582
cr
hwchase17 Oct 24, 2025
e0fd94b
Truncate logic (#205)
nhuang-lc Oct 24, 2025
a49910e
cr
hwchase17 Oct 26, 2025
3555879
cr
hwchase17 Oct 26, 2025
1a1295c
cr
hwchase17 Oct 26, 2025
282b086
cr
hwchase17 Oct 26, 2025
2208db2
cr
hwchase17 Oct 26, 2025
1097eb6
cr
hwchase17 Oct 26, 2025
d9c1fa9
cr
hwchase17 Oct 26, 2025
2d491ed
cr
hwchase17 Oct 26, 2025
0befe9d
cr
hwchase17 Oct 26, 2025
ba4d908
cr
hwchase17 Oct 26, 2025
1a733ec
cr
hwchase17 Oct 26, 2025
d151f2a
cr
hwchase17 Oct 26, 2025
b3bca9e
pluggable backend
hwchase17 Oct 26, 2025
5ae5f27
cr
hwchase17 Oct 26, 2025
a028ac3
cr
hwchase17 Oct 26, 2025
d99124f
cr
hwchase17 Oct 26, 2025
78ed761
cr
hwchase17 Oct 26, 2025
bb75097
Merge branch 'harrison/pluggable-backend' into harrison/cli-pluggable
hwchase17 Oct 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ By default, `deepagents` uses `"claude-sonnet-4-5-20250929"`. You can customize
from langchain.chat_models import init_chat_model
from deepagents import create_deep_agent

model = init_chat_model(
model="openai:gpt-5",
)
model = init_chat_model("openai:gpt-4o")
agent = create_deep_agent(
model=model,
)
Expand Down Expand Up @@ -296,19 +294,29 @@ agent = create_deep_agent(
)
```

### `use_longterm_memory`
Deep agents come with a local filesystem to offload memory to. This filesystem is stored in state, and is therefore transient to a single thread.
### `backend`
Deep agents come with a local filesystem to offload memory to. By default, this filesystem is stored in state (ephemeral, transient to a single thread).

You can extend deep agents with long-term memory by providing a Store and setting use_longterm_memory=True.
You can configure persistent long-term memory using a CompositeBackend with StoreBackend:

```python
from deepagents import create_deep_agent
from deepagents.backends import (
CompositeStateBackendProvider,
StoreBackendProvider,
)
from langgraph.store.memory import InMemoryStore

store = InMemoryStore() # Or any other Store object

# Create a hybrid backend: ephemeral files in / and persistent files in /memories/
backend = CompositeStateBackendProvider(
routes={"/memories/": StoreBackendProvider()}
)

agent = create_deep_agent(
store=store,
use_longterm_memory=True
backend=backend,
store=store
)
```

Expand Down Expand Up @@ -384,15 +392,24 @@ Context engineering is one of the main challenges in building effective agents.
```python
from langchain.agents import create_agent
from deepagents.middleware.filesystem import FilesystemMiddleware
from deepagents.backends import (
StateBackendProvider,
CompositeStateBackendProvider,
StoreBackendProvider,
)

# FilesystemMiddleware is included by default in create_deep_agent
# You can customize it if building a custom agent
agent = create_agent(
model="anthropic:claude-sonnet-4-20250514",
middleware=[
FilesystemMiddleware(
long_term_memory=False, # Enables access to long-term memory, defaults to False. You must attach a store to use long-term memory.
system_prompt="Write to the filesystem when...", # Optional custom addition to the system prompt
backend=StateBackendProvider(), # Optional: customize storage backend (defaults to StateBackendProvider)
# For persistent memory, use CompositeStateBackendProvider:
# backend=CompositeStateBackendProvider(
# routes={"/memories/": StoreBackendProvider()}
# )
system_prompt="Write to the filesystem when...", # Optional custom system prompt override
custom_tool_descriptions={
"ls": "Use the ls tool when...",
"read_file": "Use the read_file tool to..."
Expand Down
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@ readme = "README.md"
license = { text = "MIT" }
requires-python = ">=3.11,<4.0"
dependencies = [
"tavily-python",
"python-dotenv",
"requests",
"rich>=13.0.0",
"langchain-anthropic>=1.0.0,<2.0.0",
"langchain>=1.0.0,<2.0.0",
"langchain-core>=1.0.0,<2.0.0",
"wcmatch"
]

[project.scripts]
deepagents = "deepagents.cli:cli_main"

[project.optional-dependencies]
dev = [
"pytest",
"pytest-recording",
"pytest-cov",
"build",
"twine",
Expand Down Expand Up @@ -42,6 +51,7 @@ include = ["deepagents*"]

[tool.setuptools.package-data]
"*" = ["py.typed"]
"deepagents" = ["*.md"]

[tool.ruff]
line-length = 150
Expand Down Expand Up @@ -92,3 +102,9 @@ enable_error_code = ["deprecated"]
# Optional: reduce strictness if needed
disallow_any_generics = false
warn_return_any = false

[tool.pytest.ini_options]
markers = [
"vcr: record/replay HTTP via VCR"
]
addopts = "--record-mode=once"
18 changes: 18 additions & 0 deletions src/deepagents/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Memory backends for pluggable file storage."""

from deepagents.backends.composite import CompositeBackend, CompositeStateBackendProvider
from deepagents.backends.filesystem import FilesystemBackend
from deepagents.backends.state import StateBackend, StateBackendProvider
from deepagents.backends.store import StoreBackend, StoreBackendProvider
from deepagents.backends.protocol import BackendProtocol

__all__ = [
"BackendProtocol",
"CompositeBackend",
"CompositeStateBackendProvider",
"FilesystemBackend",
"StateBackend",
"StateBackendProvider",
"StoreBackend",
"StoreBackendProvider",
]
Loading