Backends
- In Deep Agents, agents gets file-like tools such as
- ls
- read_file
- write_file
- glob
- grep
-
These tolls do not directly decide where the fles are stored, The backend decides
-
Refer Here for official docs
-
Why do we need a backend
- Temporary notes for a current thread => StateBackend
- Read files on your laptop/system => FileSystemBackend
- Long-term memory across conversations => StoreBackend
- Run code safely => Sandbox Backend
- Run shell on host machine => LocalShellBackend
- Run different folders differently => CompositeBackend
-
FileSystemBackend read and writes files under a configurable root_dir
# linux
FileSystemBackend(
root_dir="/home/khaja/agent_workspace",
virtual_mode=True
)
# Windows
FileSystemBackend(
root_dir="./agent_workspace",
virtual_mode=True
)
- root_dir is the main folder the agent can access and virtual_mode=True with root_dir enables path-based restrictions and blocks unsafe paths
~, /
Lets create a simple Article writer
-
Refer Here for the changes done where we have an agentworkspace and an article on algebra
-
Cleaner production-style design with CompositeBackend Refer Here for the composite version
