deepagents 0.3.7__py3-none-any.whl → 0.3.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,8 +20,9 @@ from langgraph.types import Command
20
20
  from typing_extensions import TypedDict
21
21
 
22
22
  from deepagents.backends import StateBackend
23
+ from deepagents.backends.composite import CompositeBackend
23
24
  from deepagents.backends.protocol import (
24
- BACKEND_TYPES as BACKEND_TYPES, # Re-export for backwards compatibility
25
+ BACKEND_TYPES as BACKEND_TYPES, # Re-export type here for backwards compatibility
25
26
  BackendProtocol,
26
27
  EditResult,
27
28
  SandboxBackendProtocol,
@@ -666,9 +667,6 @@ def _supports_execution(backend: BackendProtocol) -> bool:
666
667
  Returns:
667
668
  True if the backend supports execution, False otherwise.
668
669
  """
669
- # Import here to avoid circular dependency
670
- from deepagents.backends.composite import CompositeBackend
671
-
672
670
  # For CompositeBackend, check the default backend
673
671
  if isinstance(backend, CompositeBackend):
674
672
  return isinstance(backend.default, SandboxBackendProtocol)
@@ -766,6 +764,37 @@ def _execute_tool_generator(
766
764
  )
767
765
 
768
766
 
767
+ # Tools that should be excluded from the large result eviction logic.
768
+ #
769
+ # This tuple contains tools that should NOT have their results evicted to the filesystem
770
+ # when they exceed token limits. Tools are excluded for different reasons:
771
+ #
772
+ # 1. Tools with built-in truncation (ls, glob, grep):
773
+ # These tools truncate their own output when it becomes too large. When these tools
774
+ # produce truncated output due to many matches, it typically indicates the query
775
+ # needs refinement rather than full result preservation. In such cases, the truncated
776
+ # matches are potentially more like noise and the LLM should be prompted to narrow
777
+ # its search criteria instead.
778
+ #
779
+ # 2. Tools with problematic truncation behavior (read_file):
780
+ # read_file is tricky to handle as the failure mode here is single long lines
781
+ # (e.g., imagine a jsonl file with very long payloads on each line). If we try to
782
+ # truncate the result of read_file, the agent may then attempt to re-read the
783
+ # truncated file using read_file again, which won't help.
784
+ #
785
+ # 3. Tools that never exceed limits (edit_file, write_file):
786
+ # These tools return minimal confirmation messages and are never expected to produce
787
+ # output large enough to exceed token limits, so checking them would be unnecessary.
788
+ TOOLS_EXCLUDED_FROM_EVICTION = (
789
+ "ls",
790
+ "glob",
791
+ "grep",
792
+ "read_file",
793
+ "edit_file",
794
+ "write_file",
795
+ )
796
+
797
+
769
798
  TOOL_GENERATORS = {
770
799
  "ls": _ls_tool_generator,
771
800
  "read_file": _read_file_tool_generator,
@@ -1248,7 +1277,7 @@ class FilesystemMiddleware(AgentMiddleware):
1248
1277
  Returns:
1249
1278
  The raw ToolMessage, or a pseudo tool message with the ToolResult in state.
1250
1279
  """
1251
- if self.tool_token_limit_before_evict is None or request.tool_call["name"] in TOOL_GENERATORS:
1280
+ if self.tool_token_limit_before_evict is None or request.tool_call["name"] in TOOLS_EXCLUDED_FROM_EVICTION:
1252
1281
  return handler(request)
1253
1282
 
1254
1283
  tool_result = handler(request)
@@ -1268,7 +1297,7 @@ class FilesystemMiddleware(AgentMiddleware):
1268
1297
  Returns:
1269
1298
  The raw ToolMessage, or a pseudo tool message with the ToolResult in state.
1270
1299
  """
1271
- if self.tool_token_limit_before_evict is None or request.tool_call["name"] in TOOL_GENERATORS:
1300
+ if self.tool_token_limit_before_evict is None or request.tool_call["name"] in TOOLS_EXCLUDED_FROM_EVICTION:
1272
1301
  return await handler(request)
1273
1302
 
1274
1303
  tool_result = await handler(request)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepagents
3
- Version: 0.3.7
3
+ Version: 0.3.8
4
4
  Summary: General purpose 'deep agent' with sub-agent spawning, todo list capabilities, and mock file system. Built on LangGraph.
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://docs.langchain.com/oss/python/deepagents/overview
@@ -10,13 +10,13 @@ deepagents/backends/store.py,sha256=9gdUQqPWChYgHVoopOUaocUdyUbFBpf-PxhTiXRXCto,
10
10
  deepagents/backends/utils.py,sha256=CE_HXddNTr954auqFIVgYLLD4Gdsfr9U8b384g07Wuc,13932
11
11
  deepagents/middleware/__init__.py,sha256=tATwi3JI-90-Wuf3Wg-szWkSBuKO9F2iyc5NoHP9q4g,566
12
12
  deepagents/middleware/_utils.py,sha256=ojy62kQLASQ2GabevWJaPGLItyccdNxLMPpYV25Lf20,687
13
- deepagents/middleware/filesystem.py,sha256=ZFy1ROZFHN7Qv_PPlLMO3sjuUKFoo3SSz-SMGWLYJRw,54301
13
+ deepagents/middleware/filesystem.py,sha256=ZHC6Nja1ix3M3XAML1mtOpE5XeLqwrHcm_Cei-5wupw,55690
14
14
  deepagents/middleware/memory.py,sha256=D6CNDeh5wUGLuY0CZWubFn_cfW81XuzxEZGJK02vFiU,15860
15
15
  deepagents/middleware/patch_tool_calls.py,sha256=PdNhxPaQqwnFkhEAZEE2kEzadTNAOO3_iJRA30WqpGE,1981
16
16
  deepagents/middleware/skills.py,sha256=0nOj7knAzPC9FmFK7Po3bsZeMAQJ8VJU6K1BEvoj3NM,24181
17
17
  deepagents/middleware/subagents.py,sha256=2pIwqC_0MUptX2TsBtTpr4tFDdQYkOWCG6lwAgPO_cw,27273
18
18
  deepagents/middleware/summarization.py,sha256=64exG7rsnxT9EZ7JaJ9DLi5CQNd8xWDfDf2GUhARngY,29011
19
- deepagents-0.3.7.dist-info/METADATA,sha256=QVdTXBnU35VMVRufuScZUgwrqoUcBWkK5I8h6gbeJGM,19762
20
- deepagents-0.3.7.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
21
- deepagents-0.3.7.dist-info/top_level.txt,sha256=drAzchOzPNePwpb3_pbPuvLuayXkN7SNqeIKMBWJoAo,11
22
- deepagents-0.3.7.dist-info/RECORD,,
19
+ deepagents-0.3.8.dist-info/METADATA,sha256=Vx426WnoWNPAqO8ruGtWpWdTwcQwYKGNOdr_c5PYSLM,19762
20
+ deepagents-0.3.8.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
21
+ deepagents-0.3.8.dist-info/top_level.txt,sha256=drAzchOzPNePwpb3_pbPuvLuayXkN7SNqeIKMBWJoAo,11
22
+ deepagents-0.3.8.dist-info/RECORD,,