Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions libs/deepagents/deepagents/backends/composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ def read(
"""Read file content, routing to appropriate backend.

Args:
file_path: Absolute file path
offset: Line offset to start reading from (0-indexed)
limit: Maximum number of lines to readReturns:
file_path: Absolute file path.
offset: Line offset to start reading from (0-indexed).
limit: Maximum number of lines to read.

Returns:
Formatted file content with line numbers, or error message.
"""
backend, stripped_key = self._get_backend_and_key(file_path)
Expand Down Expand Up @@ -175,8 +177,10 @@ def write(
"""Create a new file, routing to appropriate backend.

Args:
file_path: Absolute file path
content: File content as a stringReturns:
file_path: Absolute file path.
content: File content as a string.

Returns:
Success message or Command object, or error if file already exists.
"""
backend, stripped_key = self._get_backend_and_key(file_path)
Expand Down Expand Up @@ -204,10 +208,12 @@ def edit(
"""Edit a file, routing to appropriate backend.

Args:
file_path: Absolute file path
old_string: String to find and replace
new_string: Replacement string
replace_all: If True, replace all occurrencesReturns:
file_path: Absolute file path.
old_string: String to find and replace.
new_string: Replacement string.
replace_all: If True, replace all occurrences.

Returns:
Success message or Command object, or error message on failure.
"""
backend, stripped_key = self._get_backend_and_key(file_path)
Expand Down
8 changes: 5 additions & 3 deletions libs/deepagents/deepagents/backends/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,11 @@ def read(
"""Read file content with line numbers.

Args:
file_path: Absolute or relative file path
offset: Line offset to start reading from (0-indexed)
limit: Maximum number of lines to readReturns:
file_path: Absolute or relative file path.
offset: Line offset to start reading from (0-indexed).
limit: Maximum number of lines to read.

Returns:
Formatted file content with line numbers, or error message.
"""
resolved_path = self._resolve_path(file_path)
Expand Down
8 changes: 5 additions & 3 deletions libs/deepagents/deepagents/backends/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ def read(
"""Read file content with line numbers.

Args:
file_path: Absolute file path
offset: Line offset to start reading from (0-indexed)
limit: Maximum number of lines to readReturns:
file_path: Absolute file path.
offset: Line offset to start reading from (0-indexed).
limit: Maximum number of lines to read.

Returns:
Formatted file content with line numbers, or error message.
"""
files = self.runtime.state.get("files", {})
Expand Down
12 changes: 7 additions & 5 deletions libs/deepagents/deepagents/backends/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ def __init__(self, runtime: "ToolRuntime"):
"""Initialize StoreBackend with runtime.
Args:
runtime: The ToolRuntime instance providing store access and configuration.
"""
self.runtime = runtime

def _get_store(self) -> BaseStore:
"""Get the store instance.
Args:Returns:
BaseStore instance
Returns:
BaseStore instance from the runtime.
Raises:
ValueError: If no store is available or runtime not provided
ValueError: If no store is available in the runtime.
"""
store = self.runtime.store
if store is None:
Expand Down Expand Up @@ -257,8 +258,9 @@ def read(
"""Read file content with line numbers.
Args:
file_path: Absolute file path
offset: Line offset to start reading from (0-indexed)limit: Maximum number of lines to read
file_path: Absolute file path.
offset: Line offset to start reading from (0-indexed).
limit: Maximum number of lines to read.
Returns:
Formatted file content with line numbers, or error message.
Expand Down