deepagents 0.3.8__py3-none-any.whl → 0.3.10__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/__init__.py +3 -1
- deepagents/_version.py +3 -0
- deepagents/backends/__init__.py +2 -0
- deepagents/backends/composite.py +2 -2
- deepagents/backends/filesystem.py +13 -21
- deepagents/backends/local_shell.py +305 -0
- deepagents/backends/sandbox.py +431 -24
- deepagents/backends/utils.py +69 -24
- deepagents/middleware/filesystem.py +482 -522
- deepagents/middleware/skills.py +1 -1
- deepagents/middleware/subagents.py +23 -9
- deepagents/middleware/summarization.py +9 -4
- deepagents/py.typed +0 -0
- deepagents-0.3.10.dist-info/METADATA +76 -0
- deepagents-0.3.10.dist-info/RECORD +25 -0
- {deepagents-0.3.8.dist-info → deepagents-0.3.10.dist-info}/WHEEL +1 -1
- deepagents-0.3.8.dist-info/METADATA +0 -527
- deepagents-0.3.8.dist-info/RECORD +0 -22
- {deepagents-0.3.8.dist-info → deepagents-0.3.10.dist-info}/top_level.txt +0 -0
deepagents/middleware/skills.py
CHANGED
|
@@ -155,7 +155,7 @@ class SkillsState(AgentState):
|
|
|
155
155
|
"""State for the skills middleware."""
|
|
156
156
|
|
|
157
157
|
skills_metadata: NotRequired[Annotated[list[SkillMetadata], PrivateStateAttr]]
|
|
158
|
-
"""List of loaded skill metadata from
|
|
158
|
+
"""List of loaded skill metadata from configured sources. Not propagated to parent agents."""
|
|
159
159
|
|
|
160
160
|
|
|
161
161
|
class SkillsStateUpdate(TypedDict):
|
|
@@ -34,11 +34,11 @@ class SubAgent(TypedDict):
|
|
|
34
34
|
system_prompt: Instructions for the subagent.
|
|
35
35
|
|
|
36
36
|
Include tool usage guidance and output format requirements.
|
|
37
|
-
tools: Tools the subagent can use.
|
|
38
|
-
|
|
39
|
-
Keep this minimal and include only what's needed.
|
|
40
37
|
|
|
41
38
|
Optional fields:
|
|
39
|
+
tools: Tools the subagent can use.
|
|
40
|
+
|
|
41
|
+
If not specified, inherits tools from the main agent via `default_tools`.
|
|
42
42
|
model: Override the main agent's model.
|
|
43
43
|
|
|
44
44
|
Use the format `'provider:model-name'` (e.g., `'openai:gpt-4o'`).
|
|
@@ -57,8 +57,8 @@ class SubAgent(TypedDict):
|
|
|
57
57
|
system_prompt: str
|
|
58
58
|
"""Instructions for the subagent."""
|
|
59
59
|
|
|
60
|
-
tools: Sequence[BaseTool | Callable | dict[str, Any]]
|
|
61
|
-
"""Tools the subagent can use."""
|
|
60
|
+
tools: NotRequired[Sequence[BaseTool | Callable | dict[str, Any]]]
|
|
61
|
+
"""Tools the subagent can use. If not specified, inherits from main agent."""
|
|
62
62
|
|
|
63
63
|
model: NotRequired[str | BaseChatModel]
|
|
64
64
|
"""Override the main agent's model. Use `'provider:model-name'` format."""
|
|
@@ -108,9 +108,10 @@ DEFAULT_SUBAGENT_PROMPT = "In order to complete the objective that the user asks
|
|
|
108
108
|
# updates from subagents.
|
|
109
109
|
# When returning updates:
|
|
110
110
|
# 1. The messages key is handled explicitly to ensure only the final message is included
|
|
111
|
-
# 2. The todos and
|
|
112
|
-
# and no clear meaning for returning them from a subagent to the main agent.
|
|
113
|
-
|
|
111
|
+
# 2. The todos, structured_response, and skills_metadata keys are excluded as they do not have
|
|
112
|
+
# a defined reducer and no clear meaning for returning them from a subagent to the main agent.
|
|
113
|
+
# Each agent loads its own skills independently based on its middleware configuration.
|
|
114
|
+
_EXCLUDED_STATE_KEYS = {"messages", "todos", "structured_response", "skills_metadata"}
|
|
114
115
|
|
|
115
116
|
TASK_TOOL_DESCRIPTION = """Launch an ephemeral subagent to handle complex, multi-step independent tasks with isolated context windows.
|
|
116
117
|
|
|
@@ -523,7 +524,20 @@ class SubAgentMiddleware(AgentMiddleware):
|
|
|
523
524
|
) -> None:
|
|
524
525
|
"""Initialize the `SubAgentMiddleware`."""
|
|
525
526
|
super().__init__()
|
|
526
|
-
|
|
527
|
+
|
|
528
|
+
# Build list of available agents for system prompt
|
|
529
|
+
subagent_descriptions = []
|
|
530
|
+
if general_purpose_agent:
|
|
531
|
+
subagent_descriptions.append(f"- general-purpose: {DEFAULT_GENERAL_PURPOSE_DESCRIPTION}")
|
|
532
|
+
subagent_descriptions.extend(f"- {agent_['name']}: {agent_['description']}" for agent_ in subagents or [])
|
|
533
|
+
|
|
534
|
+
# Append available agents to system prompt if we have any
|
|
535
|
+
if system_prompt is not None and subagent_descriptions:
|
|
536
|
+
agents_section = "\n\nAvailable subagent types:\n" + "\n".join(subagent_descriptions)
|
|
537
|
+
self.system_prompt = system_prompt + agents_section
|
|
538
|
+
else:
|
|
539
|
+
self.system_prompt = system_prompt
|
|
540
|
+
|
|
527
541
|
task_tool = _create_task_tool(
|
|
528
542
|
default_model=default_model,
|
|
529
543
|
default_tools=default_tools or [],
|
|
@@ -34,6 +34,7 @@ from __future__ import annotations
|
|
|
34
34
|
|
|
35
35
|
import logging
|
|
36
36
|
import uuid
|
|
37
|
+
import warnings
|
|
37
38
|
from datetime import UTC, datetime
|
|
38
39
|
from typing import TYPE_CHECKING, Any, cast
|
|
39
40
|
|
|
@@ -658,8 +659,10 @@ A condensed summary follows:
|
|
|
658
659
|
backend = self._get_backend(state, runtime)
|
|
659
660
|
file_path = self._offload_to_backend(backend, messages_to_summarize)
|
|
660
661
|
if file_path is None:
|
|
661
|
-
|
|
662
|
-
|
|
662
|
+
warnings.warn(
|
|
663
|
+
"Offloading conversation history to backend failed during summarization.",
|
|
664
|
+
stacklevel=2,
|
|
665
|
+
)
|
|
663
666
|
|
|
664
667
|
# Generate summary
|
|
665
668
|
summary = self._create_summary(messages_to_summarize)
|
|
@@ -740,8 +743,10 @@ A condensed summary follows:
|
|
|
740
743
|
backend = self._get_backend(state, runtime)
|
|
741
744
|
file_path = await self._aoffload_to_backend(backend, messages_to_summarize)
|
|
742
745
|
if file_path is None:
|
|
743
|
-
|
|
744
|
-
|
|
746
|
+
warnings.warn(
|
|
747
|
+
"Offloading conversation history to backend failed during summarization.",
|
|
748
|
+
stacklevel=2,
|
|
749
|
+
)
|
|
745
750
|
|
|
746
751
|
# Generate summary
|
|
747
752
|
summary = await self._acreate_summary(messages_to_summarize)
|
deepagents/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deepagents
|
|
3
|
+
Version: 0.3.10
|
|
4
|
+
Summary: General purpose 'deep agent' with sub-agent spawning, todo list capabilities, and mock file system. Built on LangGraph.
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://docs.langchain.com/oss/python/deepagents/overview
|
|
7
|
+
Project-URL: Documentation, https://reference.langchain.com/python/deepagents/
|
|
8
|
+
Project-URL: Repository, https://github.com/langchain-ai/deepagents
|
|
9
|
+
Project-URL: Issues, https://github.com/langchain-ai/deepagents/issues
|
|
10
|
+
Project-URL: Twitter, https://x.com/LangChain
|
|
11
|
+
Project-URL: Slack, https://www.langchain.com/join-community
|
|
12
|
+
Project-URL: Reddit, https://www.reddit.com/r/LangChain/
|
|
13
|
+
Keywords: agents,ai,llm,langgraph,langchain,deep-agent,sub-agents,agentic
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: <4.0,>=3.11
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
Requires-Dist: langchain-core<2.0.0,>=1.2.7
|
|
27
|
+
Requires-Dist: langchain<2.0.0,>=1.2.7
|
|
28
|
+
Requires-Dist: langchain-anthropic<2.0.0,>=1.3.1
|
|
29
|
+
Requires-Dist: langchain-google-genai<5.0.0,>=4.2.0
|
|
30
|
+
Requires-Dist: wcmatch
|
|
31
|
+
|
|
32
|
+
# 🧠🤖 Deep Agents
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/deepagents/#history)
|
|
35
|
+
[](https://opensource.org/licenses/MIT)
|
|
36
|
+
[](https://pypistats.org/packages/deepagents)
|
|
37
|
+
[](https://x.com/langchain)
|
|
38
|
+
|
|
39
|
+
Looking for the JS/TS version? Check out [Deep Agents.js](https://github.com/langchain-ai/deepagentsjs).
|
|
40
|
+
|
|
41
|
+
To help you ship LangChain apps to production faster, check out [LangSmith](https://smith.langchain.com).
|
|
42
|
+
LangSmith is a unified developer platform for building, testing, and monitoring LLM applications.
|
|
43
|
+
|
|
44
|
+
## Quick Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install deepagents
|
|
48
|
+
# or
|
|
49
|
+
uv add deepagents
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 🤔 What is this?
|
|
53
|
+
|
|
54
|
+
Using an LLM to call tools in a loop is the simplest form of an agent. This architecture, however, can yield agents that are "shallow" and fail to plan and act over longer, more complex tasks.
|
|
55
|
+
|
|
56
|
+
Applications like "Deep Research", "Manus", and "Claude Code" have gotten around this limitation by implementing a combination of four things: a **planning tool**, **sub agents**, access to a **file system**, and a **detailed prompt**.
|
|
57
|
+
|
|
58
|
+
`deepagents` is a Python package that implements these in a general purpose way so that you can easily create a Deep Agent for your application. For a full overview and quickstart of Deep Agents, the best resource is our [docs](https://docs.langchain.com/oss/python/deepagents/overview).
|
|
59
|
+
|
|
60
|
+
**Acknowledgements: This project was primarily inspired by Claude Code, and initially was largely an attempt to see what made Claude Code general purpose, and make it even more so.**
|
|
61
|
+
|
|
62
|
+
## 📖 Resources
|
|
63
|
+
|
|
64
|
+
- **[Documentation](https://docs.langchain.com/oss/python/deepagents)** — Full documentation
|
|
65
|
+
- **[API Reference](https://reference.langchain.com/python/deepagents/)** — Full SDK reference documentation
|
|
66
|
+
- **[Chat LangChain](https://chat.langchain.com)** - Chat interactively with the docs
|
|
67
|
+
|
|
68
|
+
## 📕 Releases & Versioning
|
|
69
|
+
|
|
70
|
+
See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.
|
|
71
|
+
|
|
72
|
+
## 💁 Contributing
|
|
73
|
+
|
|
74
|
+
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
|
|
75
|
+
|
|
76
|
+
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
deepagents/__init__.py,sha256=I3SO951ndc3UC8EG4V2Jx4R6N7Y0_viVcvZUNusSifE,511
|
|
2
|
+
deepagents/_version.py,sha256=wJC6K-43C-1aQ53TQtlkummd0uoyDohQSuHv9VnxbMg,90
|
|
3
|
+
deepagents/graph.py,sha256=czbV_e5wMyt7K83LwcpKzKdJq8Tr9Ha7iSmAh32WC_4,10520
|
|
4
|
+
deepagents/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
deepagents/backends/__init__.py,sha256=Gd5SJA8Atk9FUyyBkWB_ukul4piJbmgE-0fdKyPrs3g,544
|
|
6
|
+
deepagents/backends/composite.py,sha256=_yPSbhmUOvBRTKxUPBe5-ChEmtAOHNpB6GDGXMf7f7c,26216
|
|
7
|
+
deepagents/backends/filesystem.py,sha256=WxX959tCsV7niiqqAU2XEb83rcu8zEU3K-7xEn9a4L0,26709
|
|
8
|
+
deepagents/backends/local_shell.py,sha256=M88igtVCBj8MWs723JSphrszwvkSn6J8iH-YdEMsra0,12728
|
|
9
|
+
deepagents/backends/protocol.py,sha256=HUmIrwYGduPfDcs_wtOzVU2QPA9kICZuGO-sUwxzz5I,15997
|
|
10
|
+
deepagents/backends/sandbox.py,sha256=Q1Ck_vMivVc8no8iIbK27mpbmJKHs80A4VxqoDeWPjM,26737
|
|
11
|
+
deepagents/backends/state.py,sha256=Qq4uRjKg6POEqLl4tNnWnXzbmLBpu3bZdMkcUROIgHw,7899
|
|
12
|
+
deepagents/backends/store.py,sha256=9gdUQqPWChYgHVoopOUaocUdyUbFBpf-PxhTiXRXCto,18219
|
|
13
|
+
deepagents/backends/utils.py,sha256=6YZjmT2VQRBekQSsnlmS_FhmU12lA2_0irf_YBQWBC4,16033
|
|
14
|
+
deepagents/middleware/__init__.py,sha256=tATwi3JI-90-Wuf3Wg-szWkSBuKO9F2iyc5NoHP9q4g,566
|
|
15
|
+
deepagents/middleware/_utils.py,sha256=ojy62kQLASQ2GabevWJaPGLItyccdNxLMPpYV25Lf20,687
|
|
16
|
+
deepagents/middleware/filesystem.py,sha256=8Xk-u-Qc2BcT8TMAijJs0qz_qhK11kf5TFXSECdSYfw,56722
|
|
17
|
+
deepagents/middleware/memory.py,sha256=D6CNDeh5wUGLuY0CZWubFn_cfW81XuzxEZGJK02vFiU,15860
|
|
18
|
+
deepagents/middleware/patch_tool_calls.py,sha256=PdNhxPaQqwnFkhEAZEE2kEzadTNAOO3_iJRA30WqpGE,1981
|
|
19
|
+
deepagents/middleware/skills.py,sha256=ICQy6ZEGKU55UfJh8qs06m-fKq9nrK0okCO4-BcXkLc,24210
|
|
20
|
+
deepagents/middleware/subagents.py,sha256=kIyV6aOOKt5--nX9CpJmY4d7x4RXGc80rZN9_gLZJ4c,28139
|
|
21
|
+
deepagents/middleware/summarization.py,sha256=y5oXrepdJ0BkGcqdUQ3qO-cNVHb_QKVWjEFRurUF5sM,29127
|
|
22
|
+
deepagents-0.3.10.dist-info/METADATA,sha256=ct0p_mGT-BgJ0hU6sU5JuiIUJa3cyLBqoY5V9zJBxSo,4203
|
|
23
|
+
deepagents-0.3.10.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
24
|
+
deepagents-0.3.10.dist-info/top_level.txt,sha256=drAzchOzPNePwpb3_pbPuvLuayXkN7SNqeIKMBWJoAo,11
|
|
25
|
+
deepagents-0.3.10.dist-info/RECORD,,
|