deep-agents-memory

Configure pluggable memory and filesystem backends for Deep Agents across threads and sessions.

Updated May 1, 2026
One-click install
npx skills add https://github.com/ricardoo022/4dill --skill deep-agents-memory-ricardoo022
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: deep-agents-memory
Source: https://github.com/ricardoo022/4dill/tree/main/.gemini/skills/deep-agents-memory
Command: npx skills add https://github.com/ricardoo022/4dill --skill deep-agents-memory-ricardoo022

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Deep Agents need a way to persist files and memory beyond a single conversation thread, but choosing and wiring the right backend (ephemeral, persistent, or hybrid) is error-prone and easy to misconfigure. ## Core Features & Use Cases - Backend Selection Guidance: Explains when to use StateBackend (ephemeral, thread-scoped), StoreBackend (persistent across threads), FilesystemBackend (real disk access), and CompositeBackend (path-based routing). - FilesystemMiddleware Tools: Documents the built-in file tools (ls, read_file, write_file, edit_file, glob, grep) and what agents can and cannot configure. - Common Pitfall Fixes: Shows correct patterns for store requirements, thread-scoping issues, route prefix matching, production PostgresStore usage, and virtual_mode security. - Use Case: You want user preferences saved in one thread to be readable in another. Route /memories/ to StoreBackend via CompositeBackend so files persist across thread IDs. ## Quick Start Ask the agent to configure a Deep Agent with CompositeBackend so that files under /memories/ persist across threads while everything else stays ephemeral.

Frequently Asked Questions about deep-agents-memory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add long-term memory to a Deep Agent?▼

Use StoreBackend with a store instance such as InMemoryStore or PostgresStore, passing both the backend factory and store to create_deep_agent. Files written through StoreBackend persist across threads and sessions.

What is the difference between StateBackend and StoreBackend in deepagents?▼

StateBackend stores files ephemerally within a single thread and loses them when the thread ends. StoreBackend persists files across threads and sessions, but requires an explicit store instance to be provided.

How do I route different file paths to different backends?▼

Use CompositeBackend with a default backend and a routes dictionary mapping path prefixes to backends, such as routing /memories/ to StoreBackend. CompositeBackend matches the longest prefix first when resolving paths.

Why can't my agent read a file written in another thread?▼

StateBackend files are thread-scoped, so a different thread_id cannot see them. Either reuse the same thread_id or route the path to StoreBackend via CompositeBackend for cross-thread access.

Is FilesystemBackend safe to use in a web server?▼

No, FilesystemBackend should never be used in web servers; use StateBackend or a sandbox instead. For local development, enable virtual_mode=True to restrict access to the root directory and prevent path escapes.

Why does StoreBackend fail without a store instance?▼

StoreBackend requires a store instance passed to create_deep_agent, such as InMemoryStore for development or PostgresStore for production. Without it, the backend has no underlying storage to persist data.