deepagents 0.3.7__py3-none-any.whl → 0.3.7a1__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/backends/filesystem.py +7 -55
- deepagents/graph.py +10 -29
- deepagents/middleware/__init__.py +1 -3
- deepagents/middleware/filesystem.py +75 -76
- deepagents/middleware/memory.py +7 -11
- deepagents/middleware/skills.py +2 -4
- deepagents/middleware/subagents.py +19 -35
- {deepagents-0.3.7.dist-info → deepagents-0.3.7a1.dist-info}/METADATA +1 -1
- deepagents-0.3.7a1.dist-info/RECORD +21 -0
- {deepagents-0.3.7.dist-info → deepagents-0.3.7a1.dist-info}/WHEEL +1 -1
- deepagents/middleware/summarization.py +0 -758
- deepagents-0.3.7.dist-info/RECORD +0 -22
- {deepagents-0.3.7.dist-info → deepagents-0.3.7a1.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Middleware for providing subagents to an agent via a `task` tool."""
|
|
2
2
|
|
|
3
3
|
from collections.abc import Awaitable, Callable, Sequence
|
|
4
|
-
from typing import
|
|
4
|
+
from typing import Any, NotRequired, TypedDict, cast
|
|
5
5
|
|
|
6
6
|
from langchain.agents import create_agent
|
|
7
7
|
from langchain.agents.middleware import HumanInTheLoopMiddleware, InterruptOnConfig
|
|
@@ -73,14 +73,10 @@ class SubAgent(TypedDict):
|
|
|
73
73
|
class CompiledSubAgent(TypedDict):
|
|
74
74
|
"""A pre-compiled agent spec.
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
The runnable's state schema must include a 'messages' key.
|
|
79
|
-
|
|
80
|
-
This is required for the subagent to communicate results back to the main agent.
|
|
81
|
-
|
|
76
|
+
Important: The runnable's state schema must include a 'messages' key.
|
|
77
|
+
This is required for the subagent to communicate results back to the main agent.
|
|
82
78
|
When the subagent completes, the final message in the 'messages' list will be
|
|
83
|
-
extracted and returned as a
|
|
79
|
+
extracted and returned as a ToolMessage to the parent agent.
|
|
84
80
|
"""
|
|
85
81
|
|
|
86
82
|
name: str
|
|
@@ -94,8 +90,8 @@ class CompiledSubAgent(TypedDict):
|
|
|
94
90
|
|
|
95
91
|
Create a custom agent using either:
|
|
96
92
|
|
|
97
|
-
1. LangChain's
|
|
98
|
-
2. A custom graph using
|
|
93
|
+
1. LangChain's `create_agent()`: https://docs.langchain.com/oss/python/langchain/quickstart
|
|
94
|
+
2. A custom graph using langgraph: https://docs.langchain.com/oss/python/langgraph/quickstart
|
|
99
95
|
|
|
100
96
|
If you're creating a custom graph, make sure the state schema includes a 'messages' key.
|
|
101
97
|
This is required for the subagent to communicate results back to the main agent.
|
|
@@ -399,11 +395,8 @@ def _create_task_tool(
|
|
|
399
395
|
task_description = task_description.format(available_agents=subagent_description_str)
|
|
400
396
|
|
|
401
397
|
def task(
|
|
402
|
-
description:
|
|
403
|
-
|
|
404
|
-
"A detailed description of the task for the subagent to perform autonomously. Include all necessary context and specify the expected output format.", # noqa: E501
|
|
405
|
-
],
|
|
406
|
-
subagent_type: Annotated[str, "The type of subagent to use. Must be one of the available agent types listed in the tool description."],
|
|
398
|
+
description: str,
|
|
399
|
+
subagent_type: str,
|
|
407
400
|
runtime: ToolRuntime,
|
|
408
401
|
) -> str | Command:
|
|
409
402
|
if subagent_type not in subagent_graphs:
|
|
@@ -417,11 +410,8 @@ def _create_task_tool(
|
|
|
417
410
|
return _return_command_with_state_update(result, runtime.tool_call_id)
|
|
418
411
|
|
|
419
412
|
async def atask(
|
|
420
|
-
description:
|
|
421
|
-
|
|
422
|
-
"A detailed description of the task for the subagent to perform autonomously. Include all necessary context and specify the expected output format.", # noqa: E501
|
|
423
|
-
],
|
|
424
|
-
subagent_type: Annotated[str, "The type of subagent to use. Must be one of the available agent types listed in the tool description."],
|
|
413
|
+
description: str,
|
|
414
|
+
subagent_type: str,
|
|
425
415
|
runtime: ToolRuntime,
|
|
426
416
|
) -> str | Command:
|
|
427
417
|
if subagent_type not in subagent_graphs:
|
|
@@ -460,24 +450,18 @@ class SubAgentMiddleware(AgentMiddleware):
|
|
|
460
450
|
|
|
461
451
|
Args:
|
|
462
452
|
default_model: The model to use for subagents.
|
|
463
|
-
|
|
464
|
-
Can be a `LanguageModelLike` or a dict for `init_chat_model`.
|
|
453
|
+
Can be a LanguageModelLike or a dict for init_chat_model.
|
|
465
454
|
default_tools: The tools to use for the default general-purpose subagent.
|
|
466
|
-
default_middleware: Default middleware to apply to all subagents.
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
Pass a list to specify custom middleware.
|
|
471
|
-
default_interrupt_on: The tool configs to use for the default general-purpose subagent.
|
|
472
|
-
|
|
473
|
-
These are also the fallback for any subagents that don't specify their own tool configs.
|
|
455
|
+
default_middleware: Default middleware to apply to all subagents. If `None` (default),
|
|
456
|
+
no default middleware is applied. Pass a list to specify custom middleware.
|
|
457
|
+
default_interrupt_on: The tool configs to use for the default general-purpose subagent. These
|
|
458
|
+
are also the fallback for any subagents that don't specify their own tool configs.
|
|
474
459
|
subagents: A list of additional subagents to provide to the agent.
|
|
475
460
|
system_prompt: Full system prompt override. When provided, completely replaces
|
|
476
461
|
the agent's system prompt.
|
|
477
|
-
general_purpose_agent: Whether to include the general-purpose agent.
|
|
478
|
-
task_description: Custom description for the task tool.
|
|
479
|
-
|
|
480
|
-
If `None`, uses the default description template.
|
|
462
|
+
general_purpose_agent: Whether to include the general-purpose agent. Defaults to `True`.
|
|
463
|
+
task_description: Custom description for the task tool. If `None`, uses the
|
|
464
|
+
default description template.
|
|
481
465
|
|
|
482
466
|
Example:
|
|
483
467
|
```python
|
|
@@ -521,7 +505,7 @@ class SubAgentMiddleware(AgentMiddleware):
|
|
|
521
505
|
general_purpose_agent: bool = True,
|
|
522
506
|
task_description: str | None = None,
|
|
523
507
|
) -> None:
|
|
524
|
-
"""Initialize the
|
|
508
|
+
"""Initialize the SubAgentMiddleware."""
|
|
525
509
|
super().__init__()
|
|
526
510
|
self.system_prompt = system_prompt
|
|
527
511
|
task_tool = _create_task_tool(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepagents
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.7a1
|
|
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
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
deepagents/__init__.py,sha256=LHQm0v_7N9Gd4pmpRjhnlOCMIK2O0jQ4cEU8RiXEI8k,447
|
|
2
|
+
deepagents/graph.py,sha256=Rk1qDzPpjSKGHc1NJ1CQcbFrFoMlPgKIGFm2EWW3--0,9802
|
|
3
|
+
deepagents/backends/__init__.py,sha256=BOKu2cQ1OdMyO_l2rLqZQiXppYFmQbx7OIQb7WYwvZc,457
|
|
4
|
+
deepagents/backends/composite.py,sha256=WZ_dnn63BmrU19ZJ5-m728f99pSa0Uq_CnwZjwmxz1U,26198
|
|
5
|
+
deepagents/backends/filesystem.py,sha256=Okr4zUJkDc_tx01Sya8sHTsYzahsRiDdFWWX2A_G-RQ,24617
|
|
6
|
+
deepagents/backends/protocol.py,sha256=HUmIrwYGduPfDcs_wtOzVU2QPA9kICZuGO-sUwxzz5I,15997
|
|
7
|
+
deepagents/backends/sandbox.py,sha256=PE4-DkVRU5Z3zp4NViHCkNHUHKiFUKh55UAXCicBvRo,10884
|
|
8
|
+
deepagents/backends/state.py,sha256=Qq4uRjKg6POEqLl4tNnWnXzbmLBpu3bZdMkcUROIgHw,7899
|
|
9
|
+
deepagents/backends/store.py,sha256=9gdUQqPWChYgHVoopOUaocUdyUbFBpf-PxhTiXRXCto,18219
|
|
10
|
+
deepagents/backends/utils.py,sha256=CE_HXddNTr954auqFIVgYLLD4Gdsfr9U8b384g07Wuc,13932
|
|
11
|
+
deepagents/middleware/__init__.py,sha256=2smUxjwghA3Eml_wp0kd4dAY-rwLyW-XQPBE3dAoo50,467
|
|
12
|
+
deepagents/middleware/_utils.py,sha256=ojy62kQLASQ2GabevWJaPGLItyccdNxLMPpYV25Lf20,687
|
|
13
|
+
deepagents/middleware/filesystem.py,sha256=z6jrmXuksloebN6ZlNbjKw847AC8IjLS-TYz6ELyXFY,52745
|
|
14
|
+
deepagents/middleware/memory.py,sha256=1w-laeDHCiY0hxf5fURFnwcXvI78FhPo7_mYjvZudWE,15826
|
|
15
|
+
deepagents/middleware/patch_tool_calls.py,sha256=PdNhxPaQqwnFkhEAZEE2kEzadTNAOO3_iJRA30WqpGE,1981
|
|
16
|
+
deepagents/middleware/skills.py,sha256=3UhHWGzVlmX6qubvhFTx14LUhd6-ZK6nhkhxV8XrIMQ,24045
|
|
17
|
+
deepagents/middleware/subagents.py,sha256=jU1a45CTlMNz1D3U9f3V5J2AoWzKMDXOf-55N6PNG00,26596
|
|
18
|
+
deepagents-0.3.7a1.dist-info/METADATA,sha256=P8TN8XaOCgNTfy9R-7VLgVMl7S1WkAggGqJqtmubAj0,19764
|
|
19
|
+
deepagents-0.3.7a1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
20
|
+
deepagents-0.3.7a1.dist-info/top_level.txt,sha256=drAzchOzPNePwpb3_pbPuvLuayXkN7SNqeIKMBWJoAo,11
|
|
21
|
+
deepagents-0.3.7a1.dist-info/RECORD,,
|