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
Copy file name to clipboardExpand all lines: docs/blog/agent-container.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,13 @@ introduction: 'Keming is one of the envd maintainers. He is working on the machi
7
7
8
8
# Why the code agents should run inside the containers
9
9
10
-
The rapid rise of AI code agents unlocks an entirely new way of building software. They can generate code, execute scripts, install dependencies, run tests, and orchestrate multi-step development workflows—all autonomously. But with this power comes a fundamental truth:
10
+
The rapid rise of AI code agents unlocks an entirely new way of building software. They can generate code, execute scripts, install dependencies, run tests, and orchestrate multi-step development workflows autonomously. But with this power comes a fundamental truth:
11
11
12
12
> **Any system that lets an agent execute code must be isolated inside a secure container.**
13
13
14
-
It’s a baseline safety requirement because agents execute arbitrary code.
14
+
It's a baseline safety requirement because agents execute arbitrary code.
15
15
16
-
A code agent’s superpower is also its biggest risk: it executes arbitrary instructions based on the user’s goal. Not the _user’s exact words_, not the _literal command_, but the agent’s _interpretation_ of the goal.
16
+
A code agent's superpower is also its biggest risk: it executes arbitrary instructions based on the user's goal. Not the _user's exact words_, not the _literal command_, but the agent's _interpretation_ of the goal.
17
17
18
18
This means the runtime must assume:
19
19
@@ -23,15 +23,15 @@ This means the runtime must assume:
23
23
- The agent might misunderstand intent.
24
24
- The agent might invoke tools aggressively or destructively.
25
25
26
-
A “safe” agent is not one that never makes mistakes—it’s one that makes mistakes in a sandbox where they can’t cause real damage.
26
+
A "safe" agent is not one that never makes mistakes, it's one that makes mistakes in a sandbox where they can't cause real damage.
27
27
28
28
## Installing unexpected packages could be dangerous
29
29
30
30
We already know that importing packages can execute arbitrary code, while installing packages can also be dangerous. For Python packages, this happens when installing from the source code:
31
31
32
32
- the package can only be installed from the git repository
33
33
- the package only provides source distribution on PyPI
34
-
- the package wheel doesn’t match the host environment and falls back to using the source distribution
34
+
- the package wheel doesn't match the host environment and falls back to using the source distribution
35
35
36
36
Even though [PEP 517](https://peps.python.org/pep-0517/) requires creating an isolated environment for each build by default, this isolated environment is only for Python standard library and required build dependencies, meaning that it can still read the local secrets, send them through the network.
37
37
@@ -76,9 +76,9 @@ Examples of sensitive data an agent could leak:
76
76
- Kubernetes certificates.
77
77
- Browser-stored OAuth tokens.
78
78
79
-
Accessing these files doesn’t require any privilege. Even though the code agent can run in the mode that requires approval for each commands, users are unlikely to carefully review every commands, especially when the agent is working on complex tasks that require plenty of commands to be approved.
79
+
Accessing these files doesn't require any privilege. Even though the code agent can run in the mode that requires approval for each commands, users are unlikely to carefully review every commands, especially when the agent is working on complex tasks that require plenty of commands to be approved.
80
80
81
-
You may wonder why the agents are trying to steal those secrets while your prompt doesn’t ask for. Here is a real case:
81
+
You may wonder why the agents are trying to steal those secrets while your prompt doesn't ask for. Here is a real case:
@@ -123,17 +123,17 @@ Running the agent inside a container changes the threat model:
123
123
124
124
## **Agents Can Break Your Local Environment**
125
125
126
-
Even if an agent isn’t malicious, it can still be “creatively destructive.”
126
+
Even if an agent isn't malicious, it can still be "creatively destructive".
127
127
128
128
Typical failure modes:
129
129
130
130
- Deleting or overwriting important project files.
131
131
- Modifying `/etc/*` configuration on Unix systems.
132
132
- Messing with global package managers.
133
133
- Killing local processes.
134
-
- Running cleanup commands that don’t discriminate.
134
+
- Running cleanup commands that don't discriminate.
135
135
136
-
A stray `rm -rf .` isn’t theoretical—it happens in the wild when agents attempt to “clean up” a workspace. Here is an example from Reddit:
136
+
A stray `rm -rf .` isn't theoretical, it happens in the wild when agents attempt to "clean up" a workspace. Here is an example from Reddit:
137
137
138
138
-[Google Antigravity just deleted the contents of my whole drive](https://old.reddit.com/r/google_antigravity/comments/1p82or6/google_antigravity_just_deleted_the_contents_of/)
139
139
@@ -146,24 +146,24 @@ In a container:
146
146
- The damage is contained.
147
147
- Rebuilding the environment is a single command.
148
148
149
-
The difference between “oops” and “disaster” is the presence of isolation.
149
+
The difference between "oops" and "disaster" is the presence of isolation.
150
150
151
151
## **Agents Misinterpret Prompts**
152
152
153
153
LLMs are probabilistic systems, not deterministic interpreters.
154
154
155
155
Common misbehavior patterns:
156
156
157
-
-**Over-action**: taking steps you didn’t explicitly ask for.
157
+
-**Over-action**: taking steps you didn't explicitly ask for.
158
158
-**Hallucinated commands**: fabricating CLI tools, URLs, or configs.
159
-
-**Overgeneralization**: interpreting “clean this up” too broadly.
159
+
-**Overgeneralization**: interpreting "clean this up" too broadly.
160
160
-**Misunderstanding safety constraints**.
161
161
162
162
Examples seen in the wild:
163
163
164
-
-“Remove some unnecessary files” → deletes the entire working directory.
165
-
-“Optimize this config” → rewrites the global environment.
166
-
-“Fix networking issues” → modifies system DNS settings.
164
+
-"Remove some unnecessary files" → deletes the entire working directory.
165
+
-"Optimize this config" → rewrites the global environment.
166
+
-"Fix networking issues" → modifies system DNS settings.
0 commit comments