You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: update deepagents docs to reference permissions across pages (#3539)
## Description
Updates deepagents docs pages to properly reference the new permissions
system.
**Permissions page improvements:**
- Reordered examples: "Isolate to a workspace directory" first, "Deny
all access" last
- Renamed "Sandbox" to "Isolate" to avoid overloaded terminology
- Added "Read-only memory" example protecting both `/memories/` and
`/policies/`
- Fixed "Protect specific files" example to include trailing deny-all
rule
**Cross-page references added:**
- `going-to-production.mdx`: New "Filesystem permissions" subsection
under Guardrails
- `memory.mdx`: References permissions alongside policy hooks for
read-only enforcement
- `backends.mdx`: Tip before "Add policy hooks" pointing to permissions
as a simpler alternative
- `harness.mdx`: New "Filesystem permissions" section in the
capabilities overview
- `subagents.mdx`: Added `permissions` field to SubAgent spec tables
(Python and JS)
- `overview.mdx`: Added permissions to "When to use" list, Core
capabilities cards, and Get started card groups
## Test Plan
- [ ] Verify permissions page examples are reordered sensibly (isolate
first, deny-all last)
- [ ] Verify "Protect specific files" example has trailing deny-all
- [ ] Verify "Read-only memory" example denies writes to both
`/memories/` and `/policies/`
- [ ] Verify going-to-production guardrails section mentions permissions
- [ ] Verify memory read-only section references permissions
- [ ] Verify backends page has tip before policy hooks section
- [ ] Verify harness page has new filesystem permissions section
- [ ] Verify subagents page lists `permissions` field in both Python and
JS tables
- [ ] Verify overview page has permissions in capabilities and card
groups
_Opened collaboratively by Nick Hollon and open-swe._
---------
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Co-authored-by: Nick Hollon <274035459+nick-hollon-lc@users.noreply.github.com>
Co-authored-by: Nick Hollon <nick.hollon@langchain.dev>
Copy file name to clipboardExpand all lines: src/oss/deepagents/backends.mdx
+35-1Lines changed: 35 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,7 @@ This page explains how to:
27
27
-[choose a backend](#specify-a-backend),
28
28
-[route different paths to different backends](#route-to-different-backends),
29
29
-[implement your own virtual filesystem](#use-a-virtual-filesystem) (e.g., S3 or Postgres),
30
+
-[set permissions](#permissions) on filesystem access,
30
31
:::js
31
32
-[add policy hooks](#add-policy-hooks),
32
33
[work with binary and multimodal files](#multimodal-and-binary-files),
@@ -544,9 +545,42 @@ Postgres-style outline:
544
545
-`grep` can fetch candidate rows by extension or last modified time, then scan lines (skip rows where `mime_type` is binary) → return `GrepResult`
545
546
:::
546
547
548
+
## Permissions
549
+
550
+
Use [permissions](/oss/deepagents/permissions) to declaratively control which files and directories the agent can read or write. Permissions apply to the built-in filesystem tools and are evaluated before the backend is called.
551
+
552
+
:::python
553
+
```python
554
+
from deepagents import create_deep_agent, FilesystemPermission
For the full set of options including rule ordering, subagent permissions, and composite backend interactions, see the [permissions guide](/oss/deepagents/permissions).
580
+
547
581
## Add policy hooks
548
582
549
-
Enforce enterprise rules by subclassing or wrapping a backend.
583
+
For custom validation logic beyond path-based allow/deny rules (rate limiting, audit logging, content inspection), enforce enterprise rules by subclassing or wrapping a backend.
550
584
551
585
Block writes/edits under selected prefixes (subclass):
Copy file name to clipboardExpand all lines: src/oss/deepagents/going-to-production.mdx
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -184,7 +184,7 @@ Memory is always persistent across conversations. The main question is how it's
184
184
|**Global**|`(org_id)`| Read-only policies for all users and assistants | "Never disclose internal pricing" |
185
185
186
186
<Warning>
187
-
Shared memory (assistant, user, or organization scope) is a vector for prompt injection. If one user can write to memory that another user's conversation reads, a malicious user could inject instructions into that shared state. Enforce read-only access where appropriate. For example, make organization-wide policies writable only through application code, not by the agent itself.
187
+
Shared memory (assistant, user, or organization scope) is a vector for prompt injection. If one user can write to memory that another user's conversation reads, a malicious user could inject instructions into that shared state. Enforce read-only access where appropriate. For example, make organization-wide policies writable only through application code, not by the agent itself. Use [permissions](/oss/deepagents/permissions) to declaratively deny writes to shared paths, or [backend policy hooks](/oss/deepagents/backends#add-policy-hooks) for custom validation logic.
188
188
</Warning>
189
189
190
190
### Configuration
@@ -878,7 +878,10 @@ Avoid passing secrets into sandboxes via environment variables or file uploads.
878
878
879
879
## Guardrails
880
880
881
-
Agents in production run autonomously, which means they can loop indefinitely, hit rate limits, or process user data that contains sensitive information. Deep Agents support [middleware](/oss/langchain/middleware/built-in) that wraps model and tool calls to handle these concerns.
881
+
Agents in production run autonomously, which means they can loop indefinitely, hit rate limits, or process user data that contains sensitive information. Deep Agents provide two layers of protection:
882
+
883
+
-**[Permissions](/oss/deepagents/permissions)**: declarative allow/deny rules that control which files and directories the agent can read or write. Use permissions to isolate the agent to a working directory, protect sensitive files, or enforce read-only memory.
884
+
-**[Middleware](/oss/langchain/middleware/built-in)**: hooks that wrap model and tool calls for rate limiting, error handling, and data privacy.
-[Context and token management](#context-management)
12
13
-[Code execution](#code-execution)
@@ -55,6 +56,24 @@ You can also use the file system when building custom tools and middleware for D
55
56
56
57
For more information, see [backends](/oss/deepagents/backends).
57
58
59
+
## Filesystem permissions
60
+
61
+
The harness supports declarative permission rules that control which files and directories the agent can read or write. Permissions apply to the built-in filesystem tools listed above and are evaluated in declaration order with first-match-wins semantics.
62
+
63
+
**How it works:**
64
+
- Pass a list of rules to `permissions=` when creating the agent
65
+
- Each rule specifies `operations` (`"read"`, `"write"`), `paths` (glob patterns), and `mode` (`"allow"` or `"deny"`)
66
+
- The first matching rule wins. If no rule matches, the operation is allowed.
67
+
68
+
**Why it's useful:**
69
+
- Restrict agents to specific directories (e.g., `/workspace/`)
- Give subagents narrower access than the parent agent
72
+
73
+
Permissions do not apply to [sandbox backends](/oss/deepagents/sandboxes), which support arbitrary command execution via the `execute` tool. For custom validation logic, use [backend policy hooks](/oss/deepagents/backends#add-policy-hooks).
74
+
75
+
For the full rule structure, examples, and subagent inheritance, see [Permissions](/oss/deepagents/permissions).
76
+
58
77
## Task delegation (subagents)
59
78
60
79
The harness allows the main agent to create ephemeral "subagents" for isolated multi-step tasks.
Copy file name to clipboardExpand all lines: src/oss/deepagents/memory.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -629,7 +629,7 @@ await client.store.putItem(
629
629
```
630
630
:::
631
631
632
-
Use [policy hooks](/oss/deepagents/backends#add-policy-hooks) to enforce that org-level memory is read-only.
632
+
Use [permissions](/oss/deepagents/permissions) to enforce that org-level memory is read-only, or [policy hooks](/oss/deepagents/backends#add-policy-hooks) for custom validation logic.
633
633
634
634
### Background consolidation
635
635
@@ -827,15 +827,15 @@ By default, the agent can both read and write memory files. For shared state lik
827
827
| Permission | Use case | How it works |
828
828
|---|---|---|
829
829
|**Read-write** (default) | User preferences, agent self-improvement, learned [skills](/oss/deepagents/skills)| Agent updates files via `edit_file` tool |
830
-
|**Read-only**| Organization policies, compliance rules, shared knowledge bases, developer-defined [skills](/oss/deepagents/skills)| Populate via application code or the [Store API](/langsmith/custom-store). Use [policy hooks](/oss/deepagents/backends#add-policy-hooks)to block agent writes. |
830
+
|**Read-only**| Organization policies, compliance rules, shared knowledge bases, developer-defined [skills](/oss/deepagents/skills)| Populate via application code or the [Store API](/langsmith/custom-store). Use [permissions](/oss/deepagents/permissions) to deny writes to specific paths, or [policy hooks](/oss/deepagents/backends#add-policy-hooks)for custom validation logic. |
831
831
832
832
**Security considerations:** If one user can write to memory that another user reads, a malicious user could inject instructions into shared state. To mitigate this:
833
833
834
834
-**Default to user scope**`(user_id)` unless you have a specific reason to share
835
835
- Use **read-only memory** for shared policies (populate via application code, not the agent)
836
836
- Add **human-in-the-loop** validation before the agent writes to shared memory. Use an [interrupt](/oss/langgraph/interrupts) to require human approval for writes to sensitive paths.
837
837
838
-
To enforce read-only memory, use [policy hooks](/oss/deepagents/backends#add-policy-hooks) on the backend to reject write operations to specific paths.
838
+
To enforce read-only memory, use [permissions](/oss/deepagents/permissions)to declaratively deny writes to specific paths. For custom validation logic (rate limiting, audit logging, content inspection), use [backend policy hooks](/oss/deepagents/backends#add-policy-hooks).
Copy file name to clipboardExpand all lines: src/oss/deepagents/overview.mdx
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,6 +95,7 @@ Use the **Deep Agents SDK** when you want to build agents that can:
95
95
-**Execute shell commands** via the `execute` tool when using a [sandbox backend](/oss/deepagents/sandboxes)
96
96
-**Delegate work** to specialized subagents for context isolation
97
97
-**Persist memory** across conversations and threads
98
+
-**Control filesystem access** with declarative [permission rules](/oss/deepagents/permissions) that restrict which files agents can read or write
98
99
-**Require human approval** for sensitive operations with [human-in-the-loop](/oss/deepagents/human-in-the-loop) workflows
99
100
-**Use any model** that supports tool calling — [provider agnostic](/oss/deepagents/models) across frontier and open models
100
101
@@ -126,6 +127,9 @@ For building simpler agents, consider using LangChain's [`createAgent`](/oss/lan
126
127
<Cardtitle="Long-term memory"icon="database">
127
128
Extend agents with persistent memory across threads using LangGraph's [Memory Store](/oss/langgraph/persistence#memory-store). Agents can save and retrieve information from previous conversations.
128
129
</Card>
130
+
<Cardtitle="Filesystem permissions"icon="lock">
131
+
Declare [permission rules](/oss/deepagents/permissions) that control which files and directories agents can read or write. Subagents can inherit or override the parent's rules.
132
+
</Card>
129
133
<Cardtitle="Human-in-the-loop"icon="user-check">
130
134
Configure [human approval](/oss/deepagents/human-in-the-loop) for sensitive tool operations using LangGraph's interrupt capabilities. Control which tools require confirmation before execution.
131
135
</Card>
@@ -155,6 +159,9 @@ For building simpler agents, consider using LangChain's [`createAgent`](/oss/lan
Allow the agent to read memory files but prevent it from modifying them. This is useful for organization-wide policies or shared knowledge bases that should only be updated by application code. See [read-only vs writable memory](/oss/deepagents/memory#read-only-vs-writable-memory) for more context.
Copy file name to clipboardExpand all lines: src/oss/deepagents/subagents.mdx
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,7 @@ For most use cases, define subagents as dictionaries matching the @[`SubAgent`]
60
60
|`middleware`|`list[Middleware]`| Optional. Additional middleware for custom behavior, logging, or rate limiting.<br></br>Does not inherit from main agent. |
61
61
|`interrupt_on`|`dict[str, bool]`| Optional. Configure [human-in-the-loop](/oss/deepagents/human-in-the-loop) for specific tools. Subagent value overrides main agent. Requires checkpointer.<br></br>Inherits from main agent by default. Subagent value overrides the default. |
62
62
|`skills`|`list[str]`| Optional. [Skills](/oss/deepagents/skills) source paths. When specified, the subagent will load skills from these directories (e.g., `["/skills/research/", "/skills/web-search/"]`). This allows subagents to have different skill sets than the main agent.<br></br>Does not inherit from main agent. Only the general-purpose subagent inherits the main agent's skills. When a subagent has skills, it runs its own independent @[`SkillsMiddleware`] instance. Skill state is fully isolated—a subagent's loaded skills are not visible to the parent, and vice versa. |
63
+
|`permissions`|`list[FilesystemPermission]`| Optional. [Filesystem permission rules](/oss/deepagents/permissions) for the subagent. When set, **replaces** the parent agent's permissions entirely.<br></br>Inherits from main agent by default. |
0 commit comments