Skip to main content

Usage

Deep Agent provides an isolated virtual filesystem for file operations during task execution. Files are stored in the deep_agent_state.files dictionary and persist across the completion loop.

Params

ls

List all files in the virtual filesystem.
ls() -> List[str]
Return Value: List of file paths.

read_file

Read a file from the virtual filesystem with optional pagination.
read_file(file_path: str, offset: int = 0, limit: int = 2000) -> str
ParameterTypeDefaultDescription
file_pathstrRequiredAbsolute path to the file to read
offsetint0Line number to start reading from (0-based)
limitint2000Maximum number of lines to read
Return Value: File content with line numbers (cat -n format), or error message if file not found. Notes:
  • Line numbers start at 1
  • Lines longer than 2000 characters are truncated
  • Empty files return system reminder

write_file

Create or overwrite a file in the virtual filesystem.
write_file(file_path: str, content: str) -> str
ParameterTypeDescription
file_pathstrAbsolute path where the file should be written
contentstrContent to write to the file
Return Value: Confirmation message.

edit_file

Perform exact string replacement in a file.
edit_file(file_path: str, old_string: str, new_string: str, replace_all: bool = False) -> str
ParameterTypeDefaultDescription
file_pathstrRequiredAbsolute path to the file to edit
old_stringstrRequiredExact string to find and replace
new_stringstrRequiredString to replace old_string with
replace_allboolFalseIf True, replace all occurrences; if False, require uniqueness
Return Value: Confirmation message or error if string not found/not unique.