Introduction

Deep agent simplifies AI Agent development. 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:

a filesystem: always present, for reading and writing files a shell: optional, exposed through the execute tool when the environment supports command execution an interpreter: optional, a separate capability for running code inside the agent loop

File System

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.

Shell

Optional environment that allows agnet to run script, invoke processes using execute tool. Shell can run in containers, VMs .cloud or it can also run as local shell on your machine.

Interpreter

Its a tool/capability inside the loop 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.

Client -> LLM -> Interpreter (return final result)

Interpreter sounds simple but internally it generates javascript code to execute the logic and returns the results without invoking LLM. Its best suited to perform some calculation logic or functionality which involves to execute in few steps. It saves cost and reduces number of LLM invocation.

CodeInterpreterMiddleware can be leveraged while creating a deepagent as below

`` agent = create_deep_agent(model=model ,middleware=[CodeInterpreterMiddleware()]

Backend

Backend is independent of agent ,however it intereacts with agent tools like filesystem or shell to connect and read the files from different sources without any change to function tools. Fore.g files can live on cloud (Composite backend) or local file system (FileSsystemBackend/local disk). Backend connects to the sources without change to any model execution

You define backend while creating an agent as below -

agent = create_deep_agent(model=model , backend=StateBackend()) - for agent internal file system or

agent = create_deep_agent(model=model , backend=FilesystemBackend(rootpath="path/to/dir"))  --local file system