deepagents 0.0.11rc1__tar.gz → 0.0.12rc2__tar.gz

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.
Files changed (31) hide show
  1. {deepagents-0.0.11rc1 → deepagents-0.0.12rc2}/PKG-INFO +13 -12
  2. {deepagents-0.0.11rc1 → deepagents-0.0.12rc2}/README.md +7 -7
  3. deepagents-0.0.12rc2/pyproject.toml +96 -0
  4. deepagents-0.0.12rc2/src/deepagents/__init__.py +7 -0
  5. deepagents-0.0.12rc2/src/deepagents/graph.py +140 -0
  6. deepagents-0.0.12rc2/src/deepagents/middleware/__init__.py +6 -0
  7. deepagents-0.0.12rc2/src/deepagents/middleware/filesystem.py +1125 -0
  8. deepagents-0.0.12rc2/src/deepagents/middleware/subagents.py +481 -0
  9. {deepagents-0.0.11rc1 → deepagents-0.0.12rc2/src}/deepagents.egg-info/PKG-INFO +13 -12
  10. deepagents-0.0.12rc2/src/deepagents.egg-info/SOURCES.txt +14 -0
  11. deepagents-0.0.12rc2/src/deepagents.egg-info/requires.txt +12 -0
  12. {deepagents-0.0.11rc1 → deepagents-0.0.12rc2/src}/deepagents.egg-info/top_level.txt +0 -1
  13. deepagents-0.0.12rc2/tests/test_middleware.py +165 -0
  14. deepagents-0.0.11rc1/deepagents.egg-info/SOURCES.txt +0 -20
  15. deepagents-0.0.11rc1/deepagents.egg-info/requires.txt +0 -11
  16. deepagents-0.0.11rc1/pyproject.toml +0 -35
  17. deepagents-0.0.11rc1/src/deepagents/__init__.py +0 -5
  18. deepagents-0.0.11rc1/src/deepagents/graph.py +0 -142
  19. deepagents-0.0.11rc1/src/deepagents/middleware.py +0 -198
  20. deepagents-0.0.11rc1/src/deepagents/model.py +0 -5
  21. deepagents-0.0.11rc1/src/deepagents/prompts.py +0 -423
  22. deepagents-0.0.11rc1/src/deepagents/state.py +0 -33
  23. deepagents-0.0.11rc1/src/deepagents/tools.py +0 -201
  24. deepagents-0.0.11rc1/src/deepagents/types.py +0 -21
  25. deepagents-0.0.11rc1/tests/test_deepagents.py +0 -136
  26. deepagents-0.0.11rc1/tests/test_hitl.py +0 -51
  27. deepagents-0.0.11rc1/tests/test_middleware.py +0 -57
  28. deepagents-0.0.11rc1/tests/utils.py +0 -81
  29. {deepagents-0.0.11rc1 → deepagents-0.0.12rc2}/LICENSE +0 -0
  30. {deepagents-0.0.11rc1 → deepagents-0.0.12rc2}/setup.cfg +0 -0
  31. {deepagents-0.0.11rc1 → deepagents-0.0.12rc2/src}/deepagents.egg-info/dependency_links.txt +0 -0
@@ -1,21 +1,22 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepagents
3
- Version: 0.0.11rc1
3
+ Version: 0.0.12rc2
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
  Requires-Python: <4.0,>=3.11
7
7
  Description-Content-Type: text/markdown
8
8
  License-File: LICENSE
9
- Requires-Dist: langgraph>=1.0.0a3
10
- Requires-Dist: langchain-anthropic>=0.1.23
11
- Requires-Dist: langchain>=1.0.0a10
9
+ Requires-Dist: langgraph>=1.0.0a4
10
+ Requires-Dist: langchain-anthropic>=1.0.0a4
11
+ Requires-Dist: langchain>=1.0.0a15
12
12
  Requires-Dist: langgraph-prebuilt>=0.7.0a2
13
- Requires-Dist: ai-filesystem>=0.1.4
13
+ Requires-Dist: langchain-core>=1.0.0a6
14
14
  Provides-Extra: dev
15
15
  Requires-Dist: pytest; extra == "dev"
16
16
  Requires-Dist: pytest-cov; extra == "dev"
17
17
  Requires-Dist: build; extra == "dev"
18
18
  Requires-Dist: twine; extra == "dev"
19
+ Requires-Dist: langchain-openai; extra == "dev"
19
20
  Dynamic: license-file
20
21
 
21
22
  # 🧠🤖Deep Agents
@@ -77,8 +78,8 @@ Use this to run an internet search for a given query. You can specify the number
77
78
 
78
79
  # Create the agent
79
80
  agent = create_deep_agent(
80
- [internet_search],
81
- research_instructions,
81
+ tools=[internet_search],
82
+ system_prompt=research_instructions,
82
83
  )
83
84
 
84
85
  # Invoke the agent
@@ -226,7 +227,7 @@ critique_sub_agent = {
226
227
  "description": "Critique the final report",
227
228
  "prompt": "You are a tough editor.",
228
229
  "model_settings": {
229
- "model": "anthropic:claude-3-5-haiku-20241022",
230
+ "model": "claude-sonnet-4-202505142",
230
231
  "temperature": 0,
231
232
  "max_tokens": 8192
232
233
  }
@@ -244,10 +245,10 @@ agent = create_deep_agent(
244
245
  ### `middleware` (Optional)
245
246
  Both the main agent and sub-agents can take additional custom AgentMiddleware. Middleware is the best supported approach for extending the state_schema, adding additional tools, and adding pre / post model hooks. See this [doc](https://docs.langchain.com/oss/python/langchain/middleware) to learn more about Middleware and how you can use it!
246
247
 
247
- ### `tool_configs` (Optional)
248
+ ### `interrupt_on` (Optional)
248
249
  Tool configs are used to specify how to handle Human In The Loop interactions on certain tools that require additional human oversight.
249
250
 
250
- These tool_configs are passed to our prebuilt [HITL middleware](https://docs.langchain.com/oss/python/langchain/middleware#human-in-the-loop) so that the agent pauses execution and waits for feedback from the user before executing configured tools.
251
+ These tool configs are passed to our prebuilt [HITL middleware](https://docs.langchain.com/oss/python/langchain/middleware#human-in-the-loop) so that the agent pauses execution and waits for feedback from the user before executing configured tools.
251
252
 
252
253
  ## Deep Agent Details
253
254
 
@@ -314,7 +315,7 @@ If you want to omit some deepagents functionality, use specific middleware compo
314
315
 
315
316
  ### Human-in-the-Loop
316
317
 
317
- `deepagents` supports human-in-the-loop approval for tool execution. You can configure specific tools to require human approval before execution using the `tool_configs` parameter, which maps tool names to a `HumanInTheLoopConfig`.
318
+ `deepagents` supports human-in-the-loop approval for tool execution. You can configure specific tools to require human approval before execution using the `interrupt_on` parameter, which maps tool names to a `HumanInTheLoopConfig`.
318
319
 
319
320
  `HumanInTheLoopConfig` is how you specify what type of human in the loop patterns are supported.
320
321
  It is a dictionary with four specific keys:
@@ -338,7 +339,7 @@ from langgraph.checkpoint.memory import InMemorySaver
338
339
  agent = create_deep_agent(
339
340
  tools=[your_tools],
340
341
  instructions="Your instructions here",
341
- tool_configs={
342
+ interrupt_on={
342
343
  # You can specify a dictionary for fine grained control over what interrupt options exist
343
344
  "tool_1": {
344
345
  "allow_respond": True,
@@ -57,8 +57,8 @@ Use this to run an internet search for a given query. You can specify the number
57
57
 
58
58
  # Create the agent
59
59
  agent = create_deep_agent(
60
- [internet_search],
61
- research_instructions,
60
+ tools=[internet_search],
61
+ system_prompt=research_instructions,
62
62
  )
63
63
 
64
64
  # Invoke the agent
@@ -206,7 +206,7 @@ critique_sub_agent = {
206
206
  "description": "Critique the final report",
207
207
  "prompt": "You are a tough editor.",
208
208
  "model_settings": {
209
- "model": "anthropic:claude-3-5-haiku-20241022",
209
+ "model": "claude-sonnet-4-202505142",
210
210
  "temperature": 0,
211
211
  "max_tokens": 8192
212
212
  }
@@ -224,10 +224,10 @@ agent = create_deep_agent(
224
224
  ### `middleware` (Optional)
225
225
  Both the main agent and sub-agents can take additional custom AgentMiddleware. Middleware is the best supported approach for extending the state_schema, adding additional tools, and adding pre / post model hooks. See this [doc](https://docs.langchain.com/oss/python/langchain/middleware) to learn more about Middleware and how you can use it!
226
226
 
227
- ### `tool_configs` (Optional)
227
+ ### `interrupt_on` (Optional)
228
228
  Tool configs are used to specify how to handle Human In The Loop interactions on certain tools that require additional human oversight.
229
229
 
230
- These tool_configs are passed to our prebuilt [HITL middleware](https://docs.langchain.com/oss/python/langchain/middleware#human-in-the-loop) so that the agent pauses execution and waits for feedback from the user before executing configured tools.
230
+ These tool configs are passed to our prebuilt [HITL middleware](https://docs.langchain.com/oss/python/langchain/middleware#human-in-the-loop) so that the agent pauses execution and waits for feedback from the user before executing configured tools.
231
231
 
232
232
  ## Deep Agent Details
233
233
 
@@ -294,7 +294,7 @@ If you want to omit some deepagents functionality, use specific middleware compo
294
294
 
295
295
  ### Human-in-the-Loop
296
296
 
297
- `deepagents` supports human-in-the-loop approval for tool execution. You can configure specific tools to require human approval before execution using the `tool_configs` parameter, which maps tool names to a `HumanInTheLoopConfig`.
297
+ `deepagents` supports human-in-the-loop approval for tool execution. You can configure specific tools to require human approval before execution using the `interrupt_on` parameter, which maps tool names to a `HumanInTheLoopConfig`.
298
298
 
299
299
  `HumanInTheLoopConfig` is how you specify what type of human in the loop patterns are supported.
300
300
  It is a dictionary with four specific keys:
@@ -318,7 +318,7 @@ from langgraph.checkpoint.memory import InMemorySaver
318
318
  agent = create_deep_agent(
319
319
  tools=[your_tools],
320
320
  instructions="Your instructions here",
321
- tool_configs={
321
+ interrupt_on={
322
322
  # You can specify a dictionary for fine grained control over what interrupt options exist
323
323
  "tool_1": {
324
324
  "allow_respond": True,
@@ -0,0 +1,96 @@
1
+ [project]
2
+ name = "deepagents"
3
+ version = "0.0.12rc2"
4
+ description = "General purpose 'deep agent' with sub-agent spawning, todo list capabilities, and mock file system. Built on LangGraph."
5
+ readme = "README.md"
6
+ license = { text = "MIT" }
7
+ requires-python = ">=3.11,<4.0"
8
+ dependencies = [
9
+ "langgraph>=1.0.0a4",
10
+ "langchain-anthropic>=1.0.0a4",
11
+ "langchain>=1.0.0a15",
12
+ "langgraph-prebuilt>=0.7.0a2",
13
+ "langchain-core>=1.0.0a6"
14
+ ]
15
+
16
+ [project.optional-dependencies]
17
+ dev = [
18
+ "pytest",
19
+ "pytest-cov",
20
+ "build",
21
+ "twine",
22
+ "langchain-openai"
23
+ ]
24
+
25
+ [dependency-groups]
26
+ lint = [
27
+ "ruff>=0.12.2,<0.13.0",
28
+ ]
29
+ typing = [
30
+ "mypy>=1.18.1,<1.19.0",
31
+ ]
32
+
33
+ [build-system]
34
+ requires = ["setuptools>=73.0.0", "wheel"]
35
+ build-backend = "setuptools.build_meta"
36
+
37
+ [tool.setuptools]
38
+ [tool.setuptools.packages.find]
39
+ where = ["src"]
40
+ include = ["deepagents*"]
41
+
42
+ [tool.setuptools.package-dir]
43
+ "" = "src"
44
+
45
+ [tool.setuptools.package-data]
46
+ "*" = ["py.typed"]
47
+
48
+ [tool.ruff]
49
+ line-length = 150
50
+ # Exclude any files that shouldn't be linted
51
+ exclude = []
52
+
53
+ [tool.ruff.format]
54
+ docstring-code-format = true # Formats code blocks in docstrings
55
+
56
+ [tool.ruff.lint]
57
+ select = [
58
+ "ALL" # Enable all rules by default
59
+ ]
60
+ ignore = [
61
+ "COM812", # Messes with the formatter
62
+ "ISC001", # Messes with the formatter
63
+ "PERF203", # Rarely useful
64
+ "SLF001", # Private member access
65
+ "PLC0415", # Imports should be at the top. Not always desirable
66
+ "PLR0913", # Too many arguments in function definition
67
+ "PLC0414", # Inconsistent with how type checkers expect to be notified of intentional re-exports
68
+ "C901", # Too complex
69
+ ]
70
+ unfixable = ["B028"] # Rules that shouldn't be auto-fixed
71
+
72
+ [tool.ruff.lint.pyupgrade]
73
+ keep-runtime-typing = true
74
+
75
+ [tool.ruff.lint.flake8-annotations]
76
+ allow-star-arg-any = true
77
+
78
+ [tool.ruff.lint.pydocstyle]
79
+ convention = "google" # Google-style docstrings
80
+ ignore-var-parameters = true
81
+
82
+ [tool.ruff.lint.per-file-ignores]
83
+ "tests/*" = [
84
+ "D1", # Skip documentation rules in tests
85
+ "S101", # Allow asserts in tests
86
+ "S311", # Allow pseudo-random generators in tests
87
+ # Add more test-specific ignores
88
+ ]
89
+
90
+ [tool.mypy]
91
+ strict = true
92
+ ignore_missing_imports = true
93
+ enable_error_code = ["deprecated"]
94
+ # Optional: reduce strictness if needed
95
+ disallow_any_generics = false
96
+ warn_return_any = false
@@ -0,0 +1,7 @@
1
+ """DeepAgents package."""
2
+
3
+ from deepagents.graph import create_deep_agent
4
+ from deepagents.middleware.filesystem import FilesystemMiddleware
5
+ from deepagents.middleware.subagents import CompiledSubAgent, SubAgent, SubAgentMiddleware
6
+
7
+ __all__ = ["CompiledSubAgent", "FilesystemMiddleware", "SubAgent", "SubAgentMiddleware", "create_deep_agent"]
@@ -0,0 +1,140 @@
1
+ """Deepagents come with planning, filesystem, and subagents."""
2
+
3
+ from collections.abc import Callable, Sequence
4
+ from typing import Any
5
+
6
+ from langchain.agents import create_agent
7
+ from langchain.agents.middleware import HumanInTheLoopMiddleware, InterruptOnConfig, TodoListMiddleware
8
+ from langchain.agents.middleware.summarization import SummarizationMiddleware
9
+ from langchain.agents.middleware.types import AgentMiddleware
10
+ from langchain.agents.structured_output import ResponseFormat
11
+ from langchain_anthropic import ChatAnthropic
12
+ from langchain_core.language_models import BaseChatModel
13
+ from langchain_core.tools import BaseTool
14
+ from langgraph.cache.base import BaseCache
15
+ from langgraph.graph.state import CompiledStateGraph
16
+ from langgraph.store.base import BaseStore
17
+ from langgraph.types import Checkpointer
18
+
19
+ from deepagents.middleware.filesystem import FilesystemMiddleware
20
+ from deepagents.middleware.subagents import CompiledSubAgent, SubAgent, SubAgentMiddleware
21
+
22
+ BASE_AGENT_PROMPT = "In order to complete the objective that the user asks of you, you have access to a number of standard tools."
23
+
24
+
25
+ def get_default_model() -> ChatAnthropic:
26
+ """Get the default model for deep agents.
27
+
28
+ Returns:
29
+ ChatAnthropic instance configured with Claude Sonnet 4.
30
+ """
31
+ return ChatAnthropic(
32
+ model_name="claude-sonnet-4-20250514",
33
+ max_tokens=64000,
34
+ )
35
+
36
+
37
+ def create_deep_agent(
38
+ model: str | BaseChatModel | None = None,
39
+ tools: Sequence[BaseTool | Callable | dict[str, Any]] | None = None,
40
+ *,
41
+ system_prompt: str | None = None,
42
+ middleware: Sequence[AgentMiddleware] = (),
43
+ subagents: list[SubAgent | CompiledSubAgent] | None = None,
44
+ response_format: ResponseFormat | None = None,
45
+ context_schema: type[Any] | None = None,
46
+ checkpointer: Checkpointer | None = None,
47
+ store: BaseStore | None = None,
48
+ use_longterm_memory: bool = False,
49
+ interrupt_on: dict[str, bool | InterruptOnConfig] | None = None,
50
+ debug: bool = False,
51
+ name: str | None = None,
52
+ cache: BaseCache | None = None,
53
+ ) -> CompiledStateGraph:
54
+ """Create a deep agent.
55
+
56
+ This agent will by default have access to a tool to write todos (write_todos),
57
+ four file editing tools: write_file, ls, read_file, edit_file, and a tool to call
58
+ subagents.
59
+
60
+ Args:
61
+ tools: The tools the agent should have access to.
62
+ system_prompt: The additional instructions the agent should have. Will go in
63
+ the system prompt.
64
+ middleware: Additional middleware to apply after standard middleware.
65
+ model: The model to use.
66
+ subagents: The subagents to use. Each subagent should be a dictionary with the
67
+ following keys:
68
+ - `name`
69
+ - `description` (used by the main agent to decide whether to call the
70
+ sub agent)
71
+ - `prompt` (used as the system prompt in the subagent)
72
+ - (optional) `tools`
73
+ - (optional) `model` (either a LanguageModelLike instance or dict
74
+ settings)
75
+ - (optional) `middleware` (list of AgentMiddleware)
76
+ response_format: A structured output response format to use for the agent.
77
+ context_schema: The schema of the deep agent.
78
+ checkpointer: Optional checkpointer for persisting agent state between runs.
79
+ store: Optional store for persisting longterm memories.
80
+ use_longterm_memory: Whether to use longterm memory - you must provide a store
81
+ in order to use longterm memory.
82
+ interrupt_on: Optional Dict[str, bool | InterruptOnConfig] mapping tool names to
83
+ interrupt configs.
84
+ debug: Whether to enable debug mode. Passed through to create_agent.
85
+ name: The name of the agent. Passed through to create_agent.
86
+ cache: The cache to use for the agent. Passed through to create_agent.
87
+
88
+ Returns:
89
+ A configured deep agent.
90
+ """
91
+ if model is None:
92
+ model = get_default_model()
93
+
94
+ deepagent_middleware = [
95
+ TodoListMiddleware(),
96
+ FilesystemMiddleware(
97
+ long_term_memory=use_longterm_memory,
98
+ ),
99
+ SubAgentMiddleware(
100
+ default_model=model,
101
+ default_tools=tools,
102
+ subagents=subagents if subagents is not None else [],
103
+ default_middleware=[
104
+ TodoListMiddleware(),
105
+ FilesystemMiddleware(
106
+ long_term_memory=use_longterm_memory,
107
+ ),
108
+ SummarizationMiddleware(
109
+ model=model,
110
+ max_tokens_before_summary=120000,
111
+ messages_to_keep=20,
112
+ ),
113
+ ],
114
+ default_interrupt_on=interrupt_on,
115
+ general_purpose_agent=True,
116
+ ),
117
+ SummarizationMiddleware(
118
+ model=model,
119
+ max_tokens_before_summary=120000,
120
+ messages_to_keep=20,
121
+ ),
122
+ ]
123
+ if interrupt_on is not None:
124
+ deepagent_middleware.append(HumanInTheLoopMiddleware(interrupt_on=interrupt_on))
125
+ if middleware is not None:
126
+ deepagent_middleware.extend(middleware)
127
+
128
+ return create_agent(
129
+ model,
130
+ system_prompt=system_prompt + "\n\n" + BASE_AGENT_PROMPT if system_prompt else BASE_AGENT_PROMPT,
131
+ tools=tools,
132
+ middleware=deepagent_middleware,
133
+ response_format=response_format,
134
+ context_schema=context_schema,
135
+ checkpointer=checkpointer,
136
+ store=store,
137
+ debug=debug,
138
+ name=name,
139
+ cache=cache,
140
+ )
@@ -0,0 +1,6 @@
1
+ """Middleware for the DeepAgent."""
2
+
3
+ from deepagents.middleware.filesystem import FilesystemMiddleware
4
+ from deepagents.middleware.subagents import CompiledSubAgent, SubAgent, SubAgentMiddleware
5
+
6
+ __all__ = ["CompiledSubAgent", "FilesystemMiddleware", "SubAgent", "SubAgentMiddleware"]