deepagents 0.3.0__py3-none-any.whl → 0.3.2__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.
@@ -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 should be excluded when passing state to subagents
64
- _EXCLUDED_STATE_KEYS = ("messages", "todos")
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(result["messages"][-1].text, tool_call_id=tool_call_id)],
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.0
3
+ Version: 0.3.2
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,8 +12,9 @@ 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
- Requires-Dist: langchain-core<2.0.0,>=1.1.0
17
+ Requires-Dist: langchain-core<2.0.0,>=1.2.5
17
18
  Requires-Dist: wcmatch
18
19
 
19
20
  # 🧠🤖Deep Agents
@@ -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
- prompt: str
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
- - **prompt**: This is the prompt used for the subagent
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:** You will want to use `from deepagents import async_create_deep_agent` to use the async version of `deepagents`, since MCP tools are async
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
 
@@ -0,0 +1,20 @@
1
+ deepagents/__init__.py,sha256=LHQm0v_7N9Gd4pmpRjhnlOCMIK2O0jQ4cEU8RiXEI8k,447
2
+ deepagents/graph.py,sha256=lzC6Z8ylu3GFXbwbybYZcRVnX1jAnBQPIx2E5VJM8Zw,8677
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=kGBFuW3ie0LLz4wXCPGJm3WAiYpimJTgEwodJSnXWCs,21477
6
+ deepagents/backends/protocol.py,sha256=HUmIrwYGduPfDcs_wtOzVU2QPA9kICZuGO-sUwxzz5I,15997
7
+ deepagents/backends/sandbox.py,sha256=8Bi8itqjW2PpXORlIfT8thMN1aBXExgHz8cm8xwVaxI,10864
8
+ deepagents/backends/state.py,sha256=Qq4uRjKg6POEqLl4tNnWnXzbmLBpu3bZdMkcUROIgHw,7899
9
+ deepagents/backends/store.py,sha256=0mmeTsim4J8bjcf62dljwNrDv4PavT2KHdGbaBzVzRE,15197
10
+ deepagents/backends/utils.py,sha256=Iyk2jW-gfoLvMnz-W_2FRCoJW_j3r1zoumU9iww-jd0,13973
11
+ deepagents/middleware/__init__.py,sha256=2smUxjwghA3Eml_wp0kd4dAY-rwLyW-XQPBE3dAoo50,467
12
+ deepagents/middleware/filesystem.py,sha256=8_W5XNDYMN37BQjbqMyUAVWYv2KmRP87xwwomQ37K1w,44568
13
+ deepagents/middleware/memory.py,sha256=5nFB6ypaOyPuCYveVvDk5odPBXlS4eYVXaJ3Zv4xr7M,11781
14
+ deepagents/middleware/patch_tool_calls.py,sha256=PdNhxPaQqwnFkhEAZEE2kEzadTNAOO3_iJRA30WqpGE,1981
15
+ deepagents/middleware/skills.py,sha256=EABvIq4ES_NHGFL9USUnlH1WwiZgnAacoOLz2kkkVkw,24043
16
+ deepagents/middleware/subagents.py,sha256=Gpky0NsQehZ-iyXIetczmu4CkBuxAnDQv6pZXIDHp8M,24427
17
+ deepagents-0.3.2.dist-info/METADATA,sha256=xhvV_74LyBBQKGuXHMrRgFWo0bFRhuzWf5nJZrKq_KQ,18809
18
+ deepagents-0.3.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ deepagents-0.3.2.dist-info/top_level.txt,sha256=drAzchOzPNePwpb3_pbPuvLuayXkN7SNqeIKMBWJoAo,11
20
+ deepagents-0.3.2.dist-info/RECORD,,
@@ -1,18 +0,0 @@
1
- deepagents/__init__.py,sha256=9BVNn4lfF5N8l2KY8Ttxi82zO609I-fGqoSIF7DAxiU,342
2
- deepagents/graph.py,sha256=u3gLVZMLA1xdZV_Mo0RPyQGOqO5VZkckoz1xPRWuZxw,6776
3
- deepagents/backends/__init__.py,sha256=BOKu2cQ1OdMyO_l2rLqZQiXppYFmQbx7OIQb7WYwvZc,457
4
- deepagents/backends/composite.py,sha256=A7J301EPlKJtTM1q1dL3hX-rDns-wallUsT66R_TaVA,22557
5
- deepagents/backends/filesystem.py,sha256=kGBFuW3ie0LLz4wXCPGJm3WAiYpimJTgEwodJSnXWCs,21477
6
- deepagents/backends/protocol.py,sha256=HUmIrwYGduPfDcs_wtOzVU2QPA9kICZuGO-sUwxzz5I,15997
7
- deepagents/backends/sandbox.py,sha256=8Bi8itqjW2PpXORlIfT8thMN1aBXExgHz8cm8xwVaxI,10864
8
- deepagents/backends/state.py,sha256=yRfrEyHAl5NemkpMhBTU0TLAfgxF5t-TZpE3Pd3_PJg,6387
9
- deepagents/backends/store.py,sha256=0mmeTsim4J8bjcf62dljwNrDv4PavT2KHdGbaBzVzRE,15197
10
- deepagents/backends/utils.py,sha256=Iyk2jW-gfoLvMnz-W_2FRCoJW_j3r1zoumU9iww-jd0,13973
11
- deepagents/middleware/__init__.py,sha256=_OGIHcHZ2pRD0gzUBS7R48agwI6P7-FCBKBgjyaWlsg,303
12
- deepagents/middleware/filesystem.py,sha256=8_W5XNDYMN37BQjbqMyUAVWYv2KmRP87xwwomQ37K1w,44568
13
- deepagents/middleware/patch_tool_calls.py,sha256=PdNhxPaQqwnFkhEAZEE2kEzadTNAOO3_iJRA30WqpGE,1981
14
- deepagents/middleware/subagents.py,sha256=JOvFBXT-wqy-7zWKFL4-76zI0cfD-2f1ALDUTJDZVuE,23886
15
- deepagents-0.3.0.dist-info/METADATA,sha256=g2Xwexi4cMWi6GcCt-_sJGJCieGnOQWMNyMP_LuI45s,18790
16
- deepagents-0.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
- deepagents-0.3.0.dist-info/top_level.txt,sha256=drAzchOzPNePwpb3_pbPuvLuayXkN7SNqeIKMBWJoAo,11
18
- deepagents-0.3.0.dist-info/RECORD,,