For translation, open lesson in new tab and use Chrome translate
The video and the text below cover the same material, so pick whichever format you prefer. If they ever differ, the text is the most up-to-date version.
A deep agent runs inside an environment: the place where it can store files, run commands, and optionally execute code inside the agent loop.
Every Deep Agent environment has:
execute tool when the environment supports command executionWe will look at those three capabilities first, then define the backend layer that implements the filesystem and optional shell. The interpreter is separate from the backend: it is added as its own tool/capability in the agent loop.
The LLM calls standard filesystem tools; the backend determines where the data actually lives.
A filesystem gives the agent a place to work. It can use files as a scratchpad for notes, intermediate results, plans, and generated artifacts.
Deep Agents always provide filesystem tools such as ls, read_file, write_file, edit_file, glob, and grep. The agent sees the same tool surface even if the backend implementation changes.
That backend detail matters when you care where files live, but this lesson only needs the core idea: the filesystem is always part of the environment.
A shell-capable backend adds execute to the filesystem interface.
A shell lets the agent run commands through the execute tool: scripts, tests, package commands, and other process-level work. This is powerful, so the implementation matters.
Different backends can provide different implementations of execute. Two common families are:
Sandbox providers run commands in isolated environments such as containers, VMs, or remote sandboxes. This limits what code can affect compared with running directly on your machine, but safety still depends on sandbox configuration, network access, credentials, and provider isolation.
Local shell runs commands directly on your machine. It has no isolation overhead and can access local resources, but it should be used only when that local access is actually required.
When shell execution is available, the environment backend provides it.
The LLM writes code-like instructions; the interpreter runs them and returns the real result.
The snippet is pseudo-code.
An interpreter works differently from a shell. It runs as a separate tool inside the agent loop and never goes through the backend.
Use an interpreter when the agent needs code-like control flow without starting a full shell process. For example, instead of asking the model to call a tool 100 times, the interpreter can run a loop, collect intermediate results in variables, and return only the final summary to the model.
Most agent work alternates between model reasoning and tool calls. A model can fire several tool calls in one turn, but that batch is fixed the moment it is emitted. Nothing can loop, branch on a result, retry a failure, or feed one call's output into the next without another model turn, and every result returns to the model's context.
Interpreters give the agent a runtime for that work. A loop runs every iteration, intermediate values stay in variables, and only a compact result returns to the model.
Now that you have seen the environment surface, we can name the implementation layer.
execute, and optional interpreter.A backend answers questions like:
execute available?execute is available, where do commands run?There is an abstract backend interface with multiple implementations. Some implementations only provide filesystem storage. Some also provide shell execution. Shell execution can be backed by a local shell or by different sandbox providers.
The agent's tool surface can stay the same while the backend changes. The agent can still call read_file or write_file; the backend decides what those calls mean underneath.
The interpreter is not part of this backend layer. It is a separate capability added to the agent loop.
execute tool when the backend supports command executionDocumentation:
Go deeper: read the source (optional)
The lesson shows how to use this. To see how it's implemented, start with these files:
backends/protocol.py: the backend interface every filesystem and sandbox implementsGo deeper: read the source (optional)
The lesson shows how to use this. To see how it's implemented, start with these files:
backends/protocol.ts: the backend interface every filesystem and sandbox implements