deepagents 0.3.0__py3-none-any.whl → 0.3.1__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.
- deepagents/middleware/subagents.py +12 -5
- {deepagents-0.3.0.dist-info → deepagents-0.3.1.dist-info}/METADATA +5 -4
- {deepagents-0.3.0.dist-info → deepagents-0.3.1.dist-info}/RECORD +5 -5
- {deepagents-0.3.0.dist-info → deepagents-0.3.1.dist-info}/WHEEL +0 -0
- {deepagents-0.3.0.dist-info → deepagents-0.3.1.dist-info}/top_level.txt +0 -0
|
@@ -60,8 +60,13 @@ class CompiledSubAgent(TypedDict):
|
|
|
60
60
|
|
|
61
61
|
DEFAULT_SUBAGENT_PROMPT = "In order to complete the objective that the user asks of you, you have access to a number of standard tools."
|
|
62
62
|
|
|
63
|
-
# State keys that
|
|
64
|
-
|
|
63
|
+
# State keys that are excluded when passing state to subagents and when returning
|
|
64
|
+
# updates from subagents.
|
|
65
|
+
# When returning updates:
|
|
66
|
+
# 1. The messages key is handled explicitly to ensure only the final message is included
|
|
67
|
+
# 2. The todos and structured_response keys are excluded as they do not have a defined reducer
|
|
68
|
+
# and no clear meaning for returning them from a subagent to the main agent.
|
|
69
|
+
_EXCLUDED_STATE_KEYS = {"messages", "todos", "structured_response"}
|
|
65
70
|
|
|
66
71
|
TASK_TOOL_DESCRIPTION = """Launch an ephemeral subagent to handle complex, multi-step independent tasks with isolated context windows.
|
|
67
72
|
|
|
@@ -314,10 +319,12 @@ def _create_task_tool(
|
|
|
314
319
|
|
|
315
320
|
def _return_command_with_state_update(result: dict, tool_call_id: str) -> Command:
|
|
316
321
|
state_update = {k: v for k, v in result.items() if k not in _EXCLUDED_STATE_KEYS}
|
|
322
|
+
# Strip trailing whitespace to prevent API errors with Anthropic
|
|
323
|
+
message_text = result["messages"][-1].text.rstrip() if result["messages"][-1].text else ""
|
|
317
324
|
return Command(
|
|
318
325
|
update={
|
|
319
326
|
**state_update,
|
|
320
|
-
"messages": [ToolMessage(
|
|
327
|
+
"messages": [ToolMessage(message_text, tool_call_id=tool_call_id)],
|
|
321
328
|
}
|
|
322
329
|
)
|
|
323
330
|
|
|
@@ -345,7 +352,7 @@ def _create_task_tool(
|
|
|
345
352
|
allowed_types = ", ".join([f"`{k}`" for k in subagent_graphs])
|
|
346
353
|
return f"We cannot invoke subagent {subagent_type} because it does not exist, the only allowed types are {allowed_types}"
|
|
347
354
|
subagent, subagent_state = _validate_and_prepare_state(subagent_type, description, runtime)
|
|
348
|
-
result = subagent.invoke(subagent_state)
|
|
355
|
+
result = subagent.invoke(subagent_state, runtime.config)
|
|
349
356
|
if not runtime.tool_call_id:
|
|
350
357
|
value_error_msg = "Tool call ID is required for subagent invocation"
|
|
351
358
|
raise ValueError(value_error_msg)
|
|
@@ -360,7 +367,7 @@ def _create_task_tool(
|
|
|
360
367
|
allowed_types = ", ".join([f"`{k}`" for k in subagent_graphs])
|
|
361
368
|
return f"We cannot invoke subagent {subagent_type} because it does not exist, the only allowed types are {allowed_types}"
|
|
362
369
|
subagent, subagent_state = _validate_and_prepare_state(subagent_type, description, runtime)
|
|
363
|
-
result = await subagent.ainvoke(subagent_state)
|
|
370
|
+
result = await subagent.ainvoke(subagent_state, runtime.config)
|
|
364
371
|
if not runtime.tool_call_id:
|
|
365
372
|
value_error_msg = "Tool call ID is required for subagent invocation"
|
|
366
373
|
raise ValueError(value_error_msg)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepagents
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
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
|
|
@@ -12,6 +12,7 @@ Project-URL: Reddit, https://www.reddit.com/r/LangChain/
|
|
|
12
12
|
Requires-Python: <4.0,>=3.11
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
Requires-Dist: langchain-anthropic<2.0.0,>=1.2.0
|
|
15
|
+
Requires-Dist: langchain-google-genai
|
|
15
16
|
Requires-Dist: langchain<2.0.0,>=1.1.0
|
|
16
17
|
Requires-Dist: langchain-core<2.0.0,>=1.1.0
|
|
17
18
|
Requires-Dist: wcmatch
|
|
@@ -218,7 +219,7 @@ A main feature of Deep Agents is their ability to spawn subagents. You can speci
|
|
|
218
219
|
class SubAgent(TypedDict):
|
|
219
220
|
name: str
|
|
220
221
|
description: str
|
|
221
|
-
|
|
222
|
+
system_prompt: str
|
|
222
223
|
tools: Sequence[BaseTool | Callable | dict[str, Any]]
|
|
223
224
|
model: NotRequired[str | BaseChatModel]
|
|
224
225
|
middleware: NotRequired[list[AgentMiddleware]]
|
|
@@ -233,7 +234,7 @@ class CompiledSubAgent(TypedDict):
|
|
|
233
234
|
**SubAgent fields:**
|
|
234
235
|
- **name**: This is the name of the subagent, and how the main agent will call the subagent
|
|
235
236
|
- **description**: This is the description of the subagent that is shown to the main agent
|
|
236
|
-
- **
|
|
237
|
+
- **system_prompt**: This is the system prompt used for the subagent
|
|
237
238
|
- **tools**: This is the list of tools that the subagent has access to.
|
|
238
239
|
- **model**: Optional model name or model instance.
|
|
239
240
|
- **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.
|
|
@@ -484,7 +485,7 @@ Prior versions of deepagents separated sync and async agent factories.
|
|
|
484
485
|
|
|
485
486
|
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).
|
|
486
487
|
|
|
487
|
-
**NOTE:**
|
|
488
|
+
**NOTE:** MCP tools are async, so you'll need to use `agent.ainvoke()` or `agent.astream()` for invocation.
|
|
488
489
|
|
|
489
490
|
(To run the example below, will need to `pip install langchain-mcp-adapters`)
|
|
490
491
|
|
|
@@ -11,8 +11,8 @@ deepagents/backends/utils.py,sha256=Iyk2jW-gfoLvMnz-W_2FRCoJW_j3r1zoumU9iww-jd0,
|
|
|
11
11
|
deepagents/middleware/__init__.py,sha256=_OGIHcHZ2pRD0gzUBS7R48agwI6P7-FCBKBgjyaWlsg,303
|
|
12
12
|
deepagents/middleware/filesystem.py,sha256=8_W5XNDYMN37BQjbqMyUAVWYv2KmRP87xwwomQ37K1w,44568
|
|
13
13
|
deepagents/middleware/patch_tool_calls.py,sha256=PdNhxPaQqwnFkhEAZEE2kEzadTNAOO3_iJRA30WqpGE,1981
|
|
14
|
-
deepagents/middleware/subagents.py,sha256=
|
|
15
|
-
deepagents-0.3.
|
|
16
|
-
deepagents-0.3.
|
|
17
|
-
deepagents-0.3.
|
|
18
|
-
deepagents-0.3.
|
|
14
|
+
deepagents/middleware/subagents.py,sha256=Gpky0NsQehZ-iyXIetczmu4CkBuxAnDQv6pZXIDHp8M,24427
|
|
15
|
+
deepagents-0.3.1.dist-info/METADATA,sha256=dB87JCH_TuKxuOj8_ZbP3czRMRjfM6p7pe9cfyC5FPU,18809
|
|
16
|
+
deepagents-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
17
|
+
deepagents-0.3.1.dist-info/top_level.txt,sha256=drAzchOzPNePwpb3_pbPuvLuayXkN7SNqeIKMBWJoAo,11
|
|
18
|
+
deepagents-0.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|