deepagents 0.0.6rc2__tar.gz → 0.0.7__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 (28) hide show
  1. {deepagents-0.0.6rc2 → deepagents-0.0.7}/PKG-INFO +30 -57
  2. {deepagents-0.0.6rc2 → deepagents-0.0.7}/README.md +26 -54
  3. {deepagents-0.0.6rc2 → deepagents-0.0.7}/deepagents.egg-info/PKG-INFO +30 -57
  4. {deepagents-0.0.6rc2 → deepagents-0.0.7}/deepagents.egg-info/SOURCES.txt +7 -4
  5. deepagents-0.0.7/deepagents.egg-info/requires.txt +4 -0
  6. {deepagents-0.0.6rc2 → deepagents-0.0.7}/deepagents.egg-info/top_level.txt +1 -0
  7. {deepagents-0.0.6rc2 → deepagents-0.0.7}/pyproject.toml +6 -4
  8. deepagents-0.0.7/src/deepagents/__init__.py +5 -0
  9. deepagents-0.0.7/src/deepagents/graph.py +146 -0
  10. deepagents-0.0.7/src/deepagents/middleware.py +198 -0
  11. {deepagents-0.0.6rc2 → deepagents-0.0.7}/src/deepagents/prompts.py +14 -13
  12. {deepagents-0.0.6rc2 → deepagents-0.0.7}/src/deepagents/state.py +9 -1
  13. {deepagents-0.0.6rc2 → deepagents-0.0.7}/src/deepagents/tools.py +7 -8
  14. deepagents-0.0.7/src/deepagents/types.py +21 -0
  15. deepagents-0.0.7/tests/test_deepagents.py +136 -0
  16. deepagents-0.0.7/tests/test_hitl.py +51 -0
  17. deepagents-0.0.7/tests/test_middleware.py +57 -0
  18. deepagents-0.0.7/tests/utils.py +81 -0
  19. deepagents-0.0.6rc2/deepagents.egg-info/requires.txt +0 -3
  20. deepagents-0.0.6rc2/src/deepagents/__init__.py +0 -9
  21. deepagents-0.0.6rc2/src/deepagents/builder.py +0 -84
  22. deepagents-0.0.6rc2/src/deepagents/graph.py +0 -219
  23. deepagents-0.0.6rc2/src/deepagents/interrupt.py +0 -122
  24. deepagents-0.0.6rc2/src/deepagents/sub_agent.py +0 -169
  25. {deepagents-0.0.6rc2 → deepagents-0.0.7}/LICENSE +0 -0
  26. {deepagents-0.0.6rc2 → deepagents-0.0.7}/deepagents.egg-info/dependency_links.txt +0 -0
  27. {deepagents-0.0.6rc2 → deepagents-0.0.7}/setup.cfg +0 -0
  28. {deepagents-0.0.6rc2 → deepagents-0.0.7}/src/deepagents/model.py +0 -0
@@ -1,14 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepagents
3
- Version: 0.0.6rc2
3
+ Version: 0.0.7
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>=0.2.6
9
+ Requires-Dist: langgraph>=1.0.0a3
10
10
  Requires-Dist: langchain-anthropic>=0.1.23
11
- Requires-Dist: langchain>=0.2.14
11
+ Requires-Dist: langchain>=1.0.0a8
12
+ Requires-Dist: langgraph-prebuilt>=0.7.0a2
12
13
  Dynamic: license-file
13
14
 
14
15
  # 🧠🤖Deep Agents
@@ -37,7 +38,6 @@ pip install deepagents
37
38
  ```python
38
39
  import os
39
40
  from typing import Literal
40
-
41
41
  from tavily import TavilyClient
42
42
  from deepagents import create_deep_agent
43
43
 
@@ -86,7 +86,7 @@ in the same way you would any LangGraph agent.
86
86
 
87
87
  ## Creating a custom deep agent
88
88
 
89
- There are three parameters you can pass to `create_deep_agent` to create your own custom deep agent.
89
+ There are several parameters you can pass to `create_deep_agent` to create your own custom deep agent.
90
90
 
91
91
  ### `tools` (Required)
92
92
 
@@ -98,7 +98,7 @@ The agent (and any subagents) will have access to these tools.
98
98
 
99
99
  The second argument to `create_deep_agent` is `instructions`.
100
100
  This will serve as part of the prompt of the deep agent.
101
- Note that there is a [built in system prompt](src/deepagents/prompts.py) as well, so this is not the *entire* prompt the agent will see.
101
+ Note that our deep agent middleware appends further instructions to the deep agent regarding to-do list, filesystem, and subagent usage, so this is not the *entire* prompt the agent will see.
102
102
 
103
103
  ### `subagents` (Optional)
104
104
 
@@ -114,7 +114,8 @@ class SubAgent(TypedDict):
114
114
  description: str
115
115
  prompt: str
116
116
  tools: NotRequired[list[str]]
117
- model_settings: NotRequired[dict[str, Any]]
117
+ model: NotRequired[Union[LanguageModelLike, dict[str, Any]]]
118
+ middleware: NotRequired[list[AgentMiddleware]]
118
119
 
119
120
  class CustomSubAgent(TypedDict):
120
121
  name: str
@@ -127,7 +128,8 @@ class CustomSubAgent(TypedDict):
127
128
  - **description**: This is the description of the subagent that is shown to the main agent
128
129
  - **prompt**: This is the prompt used for the subagent
129
130
  - **tools**: This is the list of tools that the subagent has access to. By default will have access to all tools passed in, as well as all built-in tools.
130
- - **model_settings**: Optional dictionary for per-subagent model configuration (inherits the main model when omitted).
131
+ - **model**: Optional model instance OR dictionary for per-subagent model configuration (inherits the main model when omitted).
132
+ - **middleware** Additional middleware to attach to the subagent. See [here](https://docs.langchain.com/oss/python/langchain/middleware) for an introduction into middleware and how it works with create_agent.
131
133
 
132
134
  **CustomSubAgent fields:**
133
135
  - **name**: This is the name of the subagent, and how the main agent will call the subagent
@@ -141,6 +143,7 @@ research_subagent = {
141
143
  "name": "research-agent",
142
144
  "description": "Used to research more in depth questions",
143
145
  "prompt": sub_research_prompt,
146
+ "tools": [internet_search]
144
147
  }
145
148
  subagents = [research_subagent]
146
149
  agent = create_deep_agent(
@@ -183,18 +186,6 @@ agent = create_deep_agent(
183
186
 
184
187
  By default, `deepagents` uses `"claude-sonnet-4-20250514"`. You can customize this by passing any [LangChain model object](https://python.langchain.com/docs/integrations/chat/).
185
188
 
186
- ### `builtin_tools` (Optional)
187
-
188
- By default, a deep agent will have access to a number of [built-in tools](#builtintools--optional-).
189
- You can change this by specifying the tools (by name) that the agent should have access to with this parameter.
190
-
191
- Example:
192
- ```python
193
- # Only give agent access to todo tool, none of the filesystem tools
194
- builtin_tools = ["write_todos"]
195
- agent = create_deep_agent(..., builtin_tools=builtin_tools, ...)
196
- ```
197
-
198
189
  #### Example: Using a Custom Model
199
190
 
200
191
  Here's how to use a custom model (like OpenAI's `gpt-oss` model via Ollama):
@@ -243,6 +234,15 @@ agent = create_deep_agent(
243
234
  )
244
235
  ```
245
236
 
237
+
238
+ ### `middleware` (Optional)
239
+ 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!
240
+
241
+ ### `tool_configs` (Optional)
242
+ Tool configs are used to specify how to handle Human In The Loop interactions on certain tools that require additional human oversight.
243
+
244
+ 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.
245
+
246
246
  ## Deep Agent Details
247
247
 
248
248
  The below components are built into `deepagents` and helps make it work for deep tasks off-the-shelf.
@@ -304,25 +304,20 @@ By default, deep agents come with five built-in tools:
304
304
  - `ls`: Tool for listing files in the virtual filesystem
305
305
  - `edit_file`: Tool for editing a file in the virtual filesystem
306
306
 
307
- These can be disabled via the [`builtin_tools`](#builtintools--optional-) parameter.
307
+ If you want to omit some deepagents functionality, use specific middleware components directly!
308
308
 
309
309
  ### Human-in-the-Loop
310
310
 
311
- `deepagents` supports human-in-the-loop approval for tool execution. You can configure specific tools to require human approval before execution using the `interrupt_config` parameter, which maps tool names to `HumanInterruptConfig`.
311
+ `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`.
312
312
 
313
- `HumanInterruptConfig` is how you specify what type of human in the loop patterns are supported.
313
+ `HumanInTheLoopConfig` is how you specify what type of human in the loop patterns are supported.
314
314
  It is a dictionary with four specific keys:
315
315
 
316
- - `allow_ignore`: Whether the user can skip the tool call
317
- - `allow_respond`: Whether the user can add a text response
318
- - `allow_edit`: Whether the user can edit the tool arguments
319
- - `allow_accept`: Whether the user can accept the tool call
320
-
321
- Currently, `deepagents` does NOT support `allow_ignore`
316
+ - `allow_accept`: Whether the human can approve the current action without changes
317
+ - `allow_respond`: Whether the human can reject the current action with feedback
318
+ - `allow_edit`: Whether the human can approve the current action with edited content
322
319
 
323
- Currently, `deepagents` only support interrupting one tool at a time. If multiple tools are called in parallel, each requiring interrupts, then the agent will error.
324
-
325
- Instead of specifying a `HumanInterruptConfig` for a tool, you can also just set `True`. This will set `allow_ignore`, `allow_respond`, `allow_edit`, and `allow_accept` to be `True`.
320
+ Instead of specifying a `HumanInTheLoopConfig` for a tool, you can also just set `True`. This will set `allow_ignore`, `allow_respond`, `allow_edit`, and `allow_accept` to be `True`.
326
321
 
327
322
  In order to use human in the loop, you need to have a checkpointer attached.
328
323
  Note: if you are using LangGraph Platform, this is automatically attached.
@@ -337,10 +332,9 @@ from langgraph.checkpoint.memory import InMemorySaver
337
332
  agent = create_deep_agent(
338
333
  tools=[your_tools],
339
334
  instructions="Your instructions here",
340
- interrupt_config={
335
+ tool_configs={
341
336
  # You can specify a dictionary for fine grained control over what interrupt options exist
342
337
  "tool_1": {
343
- "allow_ignore": False,
344
338
  "allow_respond": True,
345
339
  "allow_edit": True,
346
340
  "allow_accept":True,
@@ -413,12 +407,12 @@ for s in agent.stream(Command(resume=[{"type": "response", "args": "..."}]), con
413
407
  ```
414
408
  ## Async
415
409
 
416
- If you are passing async tools to your agent, you will want to `from deepagents import async_create_deep_agent`
410
+ If you are passing async tools to your agent, you will want to use `from deepagents import async_create_deep_agent`
417
411
  ## MCP
418
412
 
419
413
  The `deepagents` library can be ran with MCP tools. This can be achieved by using the [Langchain MCP Adapter library](https://github.com/langchain-ai/langchain-mcp-adapters).
420
414
 
421
- **NOTE:** will want to use `from deepagents import async_create_deep_agent` to use the async version of `deepagents`, since MCP tools are async
415
+ **NOTE:** You will want to use `from deepagents import async_create_deep_agent` to use the async version of `deepagents`, since MCP tools are async
422
416
 
423
417
  (To run the example below, will need to `pip install langchain-mcp-adapters`)
424
418
 
@@ -446,27 +440,6 @@ async def main():
446
440
  asyncio.run(main())
447
441
  ```
448
442
 
449
- ## Configurable Agent
450
-
451
- Configurable agents allow you to control the agent via a config passed in.
452
-
453
- ```python
454
- from deepagents import create_configurable_agent
455
-
456
- agent_config = {"instructions": "foo", "subagents": []}
457
-
458
- build_agent = create_configurable_agent(
459
- agent_config['instructions'],
460
- agent_config['subagents'],
461
- [],
462
- agent_config={"recursion_limit": 1000}
463
- )
464
- ```
465
- You can now use `build_agent` in your `langgraph.json` and deploy it with `langgraph dev`
466
-
467
- For async tools, you can use `from deepagents import async_create_configurable_agent`
468
-
469
-
470
443
  ## Roadmap
471
444
  - [ ] Allow users to customize full system prompt
472
445
  - [ ] Code cleanliness (type hinting, docstrings, formating)
@@ -24,7 +24,6 @@ pip install deepagents
24
24
  ```python
25
25
  import os
26
26
  from typing import Literal
27
-
28
27
  from tavily import TavilyClient
29
28
  from deepagents import create_deep_agent
30
29
 
@@ -73,7 +72,7 @@ in the same way you would any LangGraph agent.
73
72
 
74
73
  ## Creating a custom deep agent
75
74
 
76
- There are three parameters you can pass to `create_deep_agent` to create your own custom deep agent.
75
+ There are several parameters you can pass to `create_deep_agent` to create your own custom deep agent.
77
76
 
78
77
  ### `tools` (Required)
79
78
 
@@ -85,7 +84,7 @@ The agent (and any subagents) will have access to these tools.
85
84
 
86
85
  The second argument to `create_deep_agent` is `instructions`.
87
86
  This will serve as part of the prompt of the deep agent.
88
- Note that there is a [built in system prompt](src/deepagents/prompts.py) as well, so this is not the *entire* prompt the agent will see.
87
+ Note that our deep agent middleware appends further instructions to the deep agent regarding to-do list, filesystem, and subagent usage, so this is not the *entire* prompt the agent will see.
89
88
 
90
89
  ### `subagents` (Optional)
91
90
 
@@ -101,7 +100,8 @@ class SubAgent(TypedDict):
101
100
  description: str
102
101
  prompt: str
103
102
  tools: NotRequired[list[str]]
104
- model_settings: NotRequired[dict[str, Any]]
103
+ model: NotRequired[Union[LanguageModelLike, dict[str, Any]]]
104
+ middleware: NotRequired[list[AgentMiddleware]]
105
105
 
106
106
  class CustomSubAgent(TypedDict):
107
107
  name: str
@@ -114,7 +114,8 @@ class CustomSubAgent(TypedDict):
114
114
  - **description**: This is the description of the subagent that is shown to the main agent
115
115
  - **prompt**: This is the prompt used for the subagent
116
116
  - **tools**: This is the list of tools that the subagent has access to. By default will have access to all tools passed in, as well as all built-in tools.
117
- - **model_settings**: Optional dictionary for per-subagent model configuration (inherits the main model when omitted).
117
+ - **model**: Optional model instance OR dictionary for per-subagent model configuration (inherits the main model when omitted).
118
+ - **middleware** Additional middleware to attach to the subagent. See [here](https://docs.langchain.com/oss/python/langchain/middleware) for an introduction into middleware and how it works with create_agent.
118
119
 
119
120
  **CustomSubAgent fields:**
120
121
  - **name**: This is the name of the subagent, and how the main agent will call the subagent
@@ -128,6 +129,7 @@ research_subagent = {
128
129
  "name": "research-agent",
129
130
  "description": "Used to research more in depth questions",
130
131
  "prompt": sub_research_prompt,
132
+ "tools": [internet_search]
131
133
  }
132
134
  subagents = [research_subagent]
133
135
  agent = create_deep_agent(
@@ -170,18 +172,6 @@ agent = create_deep_agent(
170
172
 
171
173
  By default, `deepagents` uses `"claude-sonnet-4-20250514"`. You can customize this by passing any [LangChain model object](https://python.langchain.com/docs/integrations/chat/).
172
174
 
173
- ### `builtin_tools` (Optional)
174
-
175
- By default, a deep agent will have access to a number of [built-in tools](#builtintools--optional-).
176
- You can change this by specifying the tools (by name) that the agent should have access to with this parameter.
177
-
178
- Example:
179
- ```python
180
- # Only give agent access to todo tool, none of the filesystem tools
181
- builtin_tools = ["write_todos"]
182
- agent = create_deep_agent(..., builtin_tools=builtin_tools, ...)
183
- ```
184
-
185
175
  #### Example: Using a Custom Model
186
176
 
187
177
  Here's how to use a custom model (like OpenAI's `gpt-oss` model via Ollama):
@@ -230,6 +220,15 @@ agent = create_deep_agent(
230
220
  )
231
221
  ```
232
222
 
223
+
224
+ ### `middleware` (Optional)
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
+
227
+ ### `tool_configs` (Optional)
228
+ Tool configs are used to specify how to handle Human In The Loop interactions on certain tools that require additional human oversight.
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.
231
+
233
232
  ## Deep Agent Details
234
233
 
235
234
  The below components are built into `deepagents` and helps make it work for deep tasks off-the-shelf.
@@ -291,25 +290,20 @@ By default, deep agents come with five built-in tools:
291
290
  - `ls`: Tool for listing files in the virtual filesystem
292
291
  - `edit_file`: Tool for editing a file in the virtual filesystem
293
292
 
294
- These can be disabled via the [`builtin_tools`](#builtintools--optional-) parameter.
293
+ If you want to omit some deepagents functionality, use specific middleware components directly!
295
294
 
296
295
  ### Human-in-the-Loop
297
296
 
298
- `deepagents` supports human-in-the-loop approval for tool execution. You can configure specific tools to require human approval before execution using the `interrupt_config` parameter, which maps tool names to `HumanInterruptConfig`.
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`.
299
298
 
300
- `HumanInterruptConfig` is how you specify what type of human in the loop patterns are supported.
299
+ `HumanInTheLoopConfig` is how you specify what type of human in the loop patterns are supported.
301
300
  It is a dictionary with four specific keys:
302
301
 
303
- - `allow_ignore`: Whether the user can skip the tool call
304
- - `allow_respond`: Whether the user can add a text response
305
- - `allow_edit`: Whether the user can edit the tool arguments
306
- - `allow_accept`: Whether the user can accept the tool call
307
-
308
- Currently, `deepagents` does NOT support `allow_ignore`
302
+ - `allow_accept`: Whether the human can approve the current action without changes
303
+ - `allow_respond`: Whether the human can reject the current action with feedback
304
+ - `allow_edit`: Whether the human can approve the current action with edited content
309
305
 
310
- Currently, `deepagents` only support interrupting one tool at a time. If multiple tools are called in parallel, each requiring interrupts, then the agent will error.
311
-
312
- Instead of specifying a `HumanInterruptConfig` for a tool, you can also just set `True`. This will set `allow_ignore`, `allow_respond`, `allow_edit`, and `allow_accept` to be `True`.
306
+ Instead of specifying a `HumanInTheLoopConfig` for a tool, you can also just set `True`. This will set `allow_ignore`, `allow_respond`, `allow_edit`, and `allow_accept` to be `True`.
313
307
 
314
308
  In order to use human in the loop, you need to have a checkpointer attached.
315
309
  Note: if you are using LangGraph Platform, this is automatically attached.
@@ -324,10 +318,9 @@ from langgraph.checkpoint.memory import InMemorySaver
324
318
  agent = create_deep_agent(
325
319
  tools=[your_tools],
326
320
  instructions="Your instructions here",
327
- interrupt_config={
321
+ tool_configs={
328
322
  # You can specify a dictionary for fine grained control over what interrupt options exist
329
323
  "tool_1": {
330
- "allow_ignore": False,
331
324
  "allow_respond": True,
332
325
  "allow_edit": True,
333
326
  "allow_accept":True,
@@ -400,12 +393,12 @@ for s in agent.stream(Command(resume=[{"type": "response", "args": "..."}]), con
400
393
  ```
401
394
  ## Async
402
395
 
403
- If you are passing async tools to your agent, you will want to `from deepagents import async_create_deep_agent`
396
+ If you are passing async tools to your agent, you will want to use `from deepagents import async_create_deep_agent`
404
397
  ## MCP
405
398
 
406
399
  The `deepagents` library can be ran with MCP tools. This can be achieved by using the [Langchain MCP Adapter library](https://github.com/langchain-ai/langchain-mcp-adapters).
407
400
 
408
- **NOTE:** will want to use `from deepagents import async_create_deep_agent` to use the async version of `deepagents`, since MCP tools are async
401
+ **NOTE:** You will want to use `from deepagents import async_create_deep_agent` to use the async version of `deepagents`, since MCP tools are async
409
402
 
410
403
  (To run the example below, will need to `pip install langchain-mcp-adapters`)
411
404
 
@@ -433,27 +426,6 @@ async def main():
433
426
  asyncio.run(main())
434
427
  ```
435
428
 
436
- ## Configurable Agent
437
-
438
- Configurable agents allow you to control the agent via a config passed in.
439
-
440
- ```python
441
- from deepagents import create_configurable_agent
442
-
443
- agent_config = {"instructions": "foo", "subagents": []}
444
-
445
- build_agent = create_configurable_agent(
446
- agent_config['instructions'],
447
- agent_config['subagents'],
448
- [],
449
- agent_config={"recursion_limit": 1000}
450
- )
451
- ```
452
- You can now use `build_agent` in your `langgraph.json` and deploy it with `langgraph dev`
453
-
454
- For async tools, you can use `from deepagents import async_create_configurable_agent`
455
-
456
-
457
429
  ## Roadmap
458
430
  - [ ] Allow users to customize full system prompt
459
431
  - [ ] Code cleanliness (type hinting, docstrings, formating)
@@ -1,14 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepagents
3
- Version: 0.0.6rc2
3
+ Version: 0.0.7
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>=0.2.6
9
+ Requires-Dist: langgraph>=1.0.0a3
10
10
  Requires-Dist: langchain-anthropic>=0.1.23
11
- Requires-Dist: langchain>=0.2.14
11
+ Requires-Dist: langchain>=1.0.0a8
12
+ Requires-Dist: langgraph-prebuilt>=0.7.0a2
12
13
  Dynamic: license-file
13
14
 
14
15
  # 🧠🤖Deep Agents
@@ -37,7 +38,6 @@ pip install deepagents
37
38
  ```python
38
39
  import os
39
40
  from typing import Literal
40
-
41
41
  from tavily import TavilyClient
42
42
  from deepagents import create_deep_agent
43
43
 
@@ -86,7 +86,7 @@ in the same way you would any LangGraph agent.
86
86
 
87
87
  ## Creating a custom deep agent
88
88
 
89
- There are three parameters you can pass to `create_deep_agent` to create your own custom deep agent.
89
+ There are several parameters you can pass to `create_deep_agent` to create your own custom deep agent.
90
90
 
91
91
  ### `tools` (Required)
92
92
 
@@ -98,7 +98,7 @@ The agent (and any subagents) will have access to these tools.
98
98
 
99
99
  The second argument to `create_deep_agent` is `instructions`.
100
100
  This will serve as part of the prompt of the deep agent.
101
- Note that there is a [built in system prompt](src/deepagents/prompts.py) as well, so this is not the *entire* prompt the agent will see.
101
+ Note that our deep agent middleware appends further instructions to the deep agent regarding to-do list, filesystem, and subagent usage, so this is not the *entire* prompt the agent will see.
102
102
 
103
103
  ### `subagents` (Optional)
104
104
 
@@ -114,7 +114,8 @@ class SubAgent(TypedDict):
114
114
  description: str
115
115
  prompt: str
116
116
  tools: NotRequired[list[str]]
117
- model_settings: NotRequired[dict[str, Any]]
117
+ model: NotRequired[Union[LanguageModelLike, dict[str, Any]]]
118
+ middleware: NotRequired[list[AgentMiddleware]]
118
119
 
119
120
  class CustomSubAgent(TypedDict):
120
121
  name: str
@@ -127,7 +128,8 @@ class CustomSubAgent(TypedDict):
127
128
  - **description**: This is the description of the subagent that is shown to the main agent
128
129
  - **prompt**: This is the prompt used for the subagent
129
130
  - **tools**: This is the list of tools that the subagent has access to. By default will have access to all tools passed in, as well as all built-in tools.
130
- - **model_settings**: Optional dictionary for per-subagent model configuration (inherits the main model when omitted).
131
+ - **model**: Optional model instance OR dictionary for per-subagent model configuration (inherits the main model when omitted).
132
+ - **middleware** Additional middleware to attach to the subagent. See [here](https://docs.langchain.com/oss/python/langchain/middleware) for an introduction into middleware and how it works with create_agent.
131
133
 
132
134
  **CustomSubAgent fields:**
133
135
  - **name**: This is the name of the subagent, and how the main agent will call the subagent
@@ -141,6 +143,7 @@ research_subagent = {
141
143
  "name": "research-agent",
142
144
  "description": "Used to research more in depth questions",
143
145
  "prompt": sub_research_prompt,
146
+ "tools": [internet_search]
144
147
  }
145
148
  subagents = [research_subagent]
146
149
  agent = create_deep_agent(
@@ -183,18 +186,6 @@ agent = create_deep_agent(
183
186
 
184
187
  By default, `deepagents` uses `"claude-sonnet-4-20250514"`. You can customize this by passing any [LangChain model object](https://python.langchain.com/docs/integrations/chat/).
185
188
 
186
- ### `builtin_tools` (Optional)
187
-
188
- By default, a deep agent will have access to a number of [built-in tools](#builtintools--optional-).
189
- You can change this by specifying the tools (by name) that the agent should have access to with this parameter.
190
-
191
- Example:
192
- ```python
193
- # Only give agent access to todo tool, none of the filesystem tools
194
- builtin_tools = ["write_todos"]
195
- agent = create_deep_agent(..., builtin_tools=builtin_tools, ...)
196
- ```
197
-
198
189
  #### Example: Using a Custom Model
199
190
 
200
191
  Here's how to use a custom model (like OpenAI's `gpt-oss` model via Ollama):
@@ -243,6 +234,15 @@ agent = create_deep_agent(
243
234
  )
244
235
  ```
245
236
 
237
+
238
+ ### `middleware` (Optional)
239
+ 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!
240
+
241
+ ### `tool_configs` (Optional)
242
+ Tool configs are used to specify how to handle Human In The Loop interactions on certain tools that require additional human oversight.
243
+
244
+ 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.
245
+
246
246
  ## Deep Agent Details
247
247
 
248
248
  The below components are built into `deepagents` and helps make it work for deep tasks off-the-shelf.
@@ -304,25 +304,20 @@ By default, deep agents come with five built-in tools:
304
304
  - `ls`: Tool for listing files in the virtual filesystem
305
305
  - `edit_file`: Tool for editing a file in the virtual filesystem
306
306
 
307
- These can be disabled via the [`builtin_tools`](#builtintools--optional-) parameter.
307
+ If you want to omit some deepagents functionality, use specific middleware components directly!
308
308
 
309
309
  ### Human-in-the-Loop
310
310
 
311
- `deepagents` supports human-in-the-loop approval for tool execution. You can configure specific tools to require human approval before execution using the `interrupt_config` parameter, which maps tool names to `HumanInterruptConfig`.
311
+ `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`.
312
312
 
313
- `HumanInterruptConfig` is how you specify what type of human in the loop patterns are supported.
313
+ `HumanInTheLoopConfig` is how you specify what type of human in the loop patterns are supported.
314
314
  It is a dictionary with four specific keys:
315
315
 
316
- - `allow_ignore`: Whether the user can skip the tool call
317
- - `allow_respond`: Whether the user can add a text response
318
- - `allow_edit`: Whether the user can edit the tool arguments
319
- - `allow_accept`: Whether the user can accept the tool call
320
-
321
- Currently, `deepagents` does NOT support `allow_ignore`
316
+ - `allow_accept`: Whether the human can approve the current action without changes
317
+ - `allow_respond`: Whether the human can reject the current action with feedback
318
+ - `allow_edit`: Whether the human can approve the current action with edited content
322
319
 
323
- Currently, `deepagents` only support interrupting one tool at a time. If multiple tools are called in parallel, each requiring interrupts, then the agent will error.
324
-
325
- Instead of specifying a `HumanInterruptConfig` for a tool, you can also just set `True`. This will set `allow_ignore`, `allow_respond`, `allow_edit`, and `allow_accept` to be `True`.
320
+ Instead of specifying a `HumanInTheLoopConfig` for a tool, you can also just set `True`. This will set `allow_ignore`, `allow_respond`, `allow_edit`, and `allow_accept` to be `True`.
326
321
 
327
322
  In order to use human in the loop, you need to have a checkpointer attached.
328
323
  Note: if you are using LangGraph Platform, this is automatically attached.
@@ -337,10 +332,9 @@ from langgraph.checkpoint.memory import InMemorySaver
337
332
  agent = create_deep_agent(
338
333
  tools=[your_tools],
339
334
  instructions="Your instructions here",
340
- interrupt_config={
335
+ tool_configs={
341
336
  # You can specify a dictionary for fine grained control over what interrupt options exist
342
337
  "tool_1": {
343
- "allow_ignore": False,
344
338
  "allow_respond": True,
345
339
  "allow_edit": True,
346
340
  "allow_accept":True,
@@ -413,12 +407,12 @@ for s in agent.stream(Command(resume=[{"type": "response", "args": "..."}]), con
413
407
  ```
414
408
  ## Async
415
409
 
416
- If you are passing async tools to your agent, you will want to `from deepagents import async_create_deep_agent`
410
+ If you are passing async tools to your agent, you will want to use `from deepagents import async_create_deep_agent`
417
411
  ## MCP
418
412
 
419
413
  The `deepagents` library can be ran with MCP tools. This can be achieved by using the [Langchain MCP Adapter library](https://github.com/langchain-ai/langchain-mcp-adapters).
420
414
 
421
- **NOTE:** will want to use `from deepagents import async_create_deep_agent` to use the async version of `deepagents`, since MCP tools are async
415
+ **NOTE:** You will want to use `from deepagents import async_create_deep_agent` to use the async version of `deepagents`, since MCP tools are async
422
416
 
423
417
  (To run the example below, will need to `pip install langchain-mcp-adapters`)
424
418
 
@@ -446,27 +440,6 @@ async def main():
446
440
  asyncio.run(main())
447
441
  ```
448
442
 
449
- ## Configurable Agent
450
-
451
- Configurable agents allow you to control the agent via a config passed in.
452
-
453
- ```python
454
- from deepagents import create_configurable_agent
455
-
456
- agent_config = {"instructions": "foo", "subagents": []}
457
-
458
- build_agent = create_configurable_agent(
459
- agent_config['instructions'],
460
- agent_config['subagents'],
461
- [],
462
- agent_config={"recursion_limit": 1000}
463
- )
464
- ```
465
- You can now use `build_agent` in your `langgraph.json` and deploy it with `langgraph dev`
466
-
467
- For async tools, you can use `from deepagents import async_create_configurable_agent`
468
-
469
-
470
443
  ## Roadmap
471
444
  - [ ] Allow users to customize full system prompt
472
445
  - [ ] Code cleanliness (type hinting, docstrings, formating)
@@ -7,11 +7,14 @@ deepagents.egg-info/dependency_links.txt
7
7
  deepagents.egg-info/requires.txt
8
8
  deepagents.egg-info/top_level.txt
9
9
  src/deepagents/__init__.py
10
- src/deepagents/builder.py
11
10
  src/deepagents/graph.py
12
- src/deepagents/interrupt.py
11
+ src/deepagents/middleware.py
13
12
  src/deepagents/model.py
14
13
  src/deepagents/prompts.py
15
14
  src/deepagents/state.py
16
- src/deepagents/sub_agent.py
17
- src/deepagents/tools.py
15
+ src/deepagents/tools.py
16
+ src/deepagents/types.py
17
+ tests/test_deepagents.py
18
+ tests/test_hitl.py
19
+ tests/test_middleware.py
20
+ tests/utils.py
@@ -0,0 +1,4 @@
1
+ langgraph>=1.0.0a3
2
+ langchain-anthropic>=0.1.23
3
+ langchain>=1.0.0a8
4
+ langgraph-prebuilt>=0.7.0a2
@@ -1,14 +1,15 @@
1
1
  [project]
2
2
  name = "deepagents"
3
- version = "0.0.6rc2"
3
+ version = "0.0.7"
4
4
  description = "General purpose 'deep agent' with sub-agent spawning, todo list capabilities, and mock file system. Built on LangGraph."
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
7
7
  requires-python = ">=3.11,<4.0"
8
8
  dependencies = [
9
- "langgraph>=0.2.6",
9
+ "langgraph>=1.0.0a3",
10
10
  "langchain-anthropic>=0.1.23",
11
- "langchain>=0.2.14",
11
+ "langchain>=1.0.0a8",
12
+ "langgraph-prebuilt>=0.7.0a2",
12
13
  ]
13
14
 
14
15
 
@@ -17,9 +18,10 @@ requires = ["setuptools>=73.0.0", "wheel"]
17
18
  build-backend = "setuptools.build_meta"
18
19
 
19
20
  [tool.setuptools]
20
- packages = ["deepagents"]
21
+ packages = ["deepagents", "tests"]
21
22
  [tool.setuptools.package-dir]
22
23
  "deepagents" = "src/deepagents"
24
+ "tests" = "tests"
23
25
 
24
26
  [tool.setuptools.package-data]
25
27
  "*" = ["py.typed"]
@@ -0,0 +1,5 @@
1
+ from deepagents.graph import create_deep_agent, async_create_deep_agent
2
+ from deepagents.middleware import PlanningMiddleware, FilesystemMiddleware, SubAgentMiddleware
3
+ from deepagents.state import DeepAgentState
4
+ from deepagents.types import SubAgent, CustomSubAgent
5
+ from deepagents.model import get_default_model