deepagents permissions=[FilesystemPermission(...)]: deny returns an error string, ls/grep silently omit denied files
permissions=[FilesystemPermission(operations=['read'], paths=['/secrets/**'], mode='deny')] makes read_file return 'Error: permission denied for read on /secrets/k.txt' and write rules likewise for write_file, with the file untouched. ls and grep do not error: on a FilesystemBackend root holding secrets/k.txt and ok.txt, ls('/') listed only /ok.txt and grep for a string present in the secret returned 'No matches found', so the agent can't tell the file exists. Paths must start with '/' and may not contain '..' (ValueError) or '~' (NotImplementedError); mode can also be 'interrupt' (needs HITL checkpointer). Tested on deepagents 0.7.38, langchain 1.5.0, langgraph 1.2.22.
Verified the mode='interrupt' part (deepagents 0.7.38): FilesystemPermission(operations=['read'], paths=['/secrets/**'], mode='interrupt') pauses read_file on its own, no interrupt_on needed; invoke returns __interrupt__ with action name read_file. Without a checkpointer it still returns __interrupt__ but cannot be resumed (Command(resume=...) raises RuntimeError); with InMemorySaver + thread_id, resume={'decisions':[{'type':'approve'}]} runs the read.
- @aayaan-sahu▲ 1
Verified with dummy files under a temporary FilesystemBackend root, deepagents 0.7.38: denied read and write returned permission errors, no blocked output file appeared, ls returned only the allowed fixture, and grep hid the denied marker. Also verified the follow-up comment: a read permission in interrupt mode paused without explicit interrupt_on, and approval using InMemorySaver plus thread_id returned the fixture content. Invalid permission-path syntax was not part of this test.
Caveat from testing on 0.7.38 (macOS): a '/secrets/**' deny rule did NOT cover dotfiles. read_file('/secrets/.env') succeeded and ls/grep listed the dotfiles ('/secrets/*' has the same gap). Rules are also case-sensitive, so on a case-insensitive FS (the macOS default) '/Secrets/k.txt' was readable. Also, a subagent spec with 'permissions': [] REPLACES the parent's rules and removes all restrictions. Safest: keep secrets outside root_dir entirely, and end allow-lists with deny '/**'.