deepagents 0.7.44__tar.gz → 0.7.45__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 (72) hide show
  1. {deepagents-0.7.44 → deepagents-0.7.45}/PKG-INFO +5 -5
  2. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/_version.py +1 -1
  3. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/graph.py +45 -0
  4. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/_blob_offload.py +47 -11
  5. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/async_subagents.py +41 -3
  6. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/filesystem.py +9 -2
  7. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/skills.py +10 -15
  8. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/summarization.py +13 -2
  9. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/_builtin_profiles.py +4 -0
  10. deepagents-0.7.45/deepagents/profiles/harness/_fireworks_kimi_k3p1_pro.py +27 -0
  11. deepagents-0.7.45/deepagents/profiles/harness/_openai_gpt_6_1_sol.py +52 -0
  12. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents.egg-info/PKG-INFO +5 -5
  13. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents.egg-info/SOURCES.txt +2 -0
  14. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents.egg-info/requires.txt +4 -4
  15. {deepagents-0.7.44 → deepagents-0.7.45}/pyproject.toml +6 -6
  16. {deepagents-0.7.44 → deepagents-0.7.45}/LICENSE +0 -0
  17. {deepagents-0.7.44 → deepagents-0.7.45}/README.md +0 -0
  18. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/__init__.py +0 -0
  19. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/_api/__init__.py +0 -0
  20. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/_api/deprecation.py +0 -0
  21. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/_excluded_middleware.py +0 -0
  22. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/_models.py +0 -0
  23. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/_tools.py +0 -0
  24. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/__init__.py +0 -0
  25. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/_posix_process.py +0 -0
  26. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/_windows_process.py +0 -0
  27. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/composite.py +0 -0
  28. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/context_hub.py +0 -0
  29. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/filesystem.py +0 -0
  30. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/langsmith.py +0 -0
  31. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/local_shell.py +0 -0
  32. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/protocol.py +0 -0
  33. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/sandbox.py +0 -0
  34. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/state.py +0 -0
  35. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/store.py +0 -0
  36. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/backends/utils.py +0 -0
  37. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/__init__.py +0 -0
  38. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/_fs_interrupt.py +0 -0
  39. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/_message_eviction.py +0 -0
  40. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/_overflow_clip.py +0 -0
  41. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/_parent_notifier.py +0 -0
  42. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/_prompt_caching.py +0 -0
  43. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/_skill_tools.py +0 -0
  44. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/_state.py +0 -0
  45. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/_tool_disclosure.py +0 -0
  46. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/_tool_exclusion.py +0 -0
  47. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/_utils.py +0 -0
  48. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/_video.py +0 -0
  49. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/memory.py +0 -0
  50. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/patch_tool_calls.py +0 -0
  51. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/permissions.py +0 -0
  52. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/rubric.py +0 -0
  53. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/subagents.py +0 -0
  54. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/middleware/unsupported_content.py +0 -0
  55. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/__init__.py +0 -0
  56. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/_keys.py +0 -0
  57. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/harness/__init__.py +0 -0
  58. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/harness/_anthropic_haiku_4_5.py +0 -0
  59. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/harness/_anthropic_opus_4_7.py +0 -0
  60. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/harness/_anthropic_sonnet_4_6.py +0 -0
  61. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/harness/_nvidia_nemotron_3_ultra.py +0 -0
  62. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/harness/_openai_codex.py +0 -0
  63. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/harness/harness_profiles.py +0 -0
  64. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/provider/__init__.py +0 -0
  65. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/provider/_nvidia.py +0 -0
  66. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/provider/_openai.py +0 -0
  67. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/provider/_openrouter.py +0 -0
  68. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/profiles/provider/provider_profiles.py +0 -0
  69. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents/py.typed +0 -0
  70. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents.egg-info/dependency_links.txt +0 -0
  71. {deepagents-0.7.44 → deepagents-0.7.45}/deepagents.egg-info/top_level.txt +0 -0
  72. {deepagents-0.7.44 → deepagents-0.7.45}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepagents
3
- Version: 0.7.44
3
+ Version: 0.7.45
4
4
  Summary: Production-ready, extensible agent harness with a built-in filesystem and context management, sub-agent delegation, skills, and long-term memory.
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://docs.langchain.com/oss/python/deepagents/overview
@@ -25,11 +25,11 @@ Requires-Python: <4.0,>=3.11
25
25
  Description-Content-Type: text/markdown
26
26
  License-File: LICENSE
27
27
  Requires-Dist: langchain<2.0.0,>=1.5.2
28
- Requires-Dist: langchain-core<2.0.0,>=1.8.5
29
- Requires-Dist: langchain-anthropic<2.0.0,>=1.7.13
28
+ Requires-Dist: langchain-core<2.0.0,>=1.9.0
29
+ Requires-Dist: langchain-anthropic<2.0.0,>=1.8.0
30
30
  Requires-Dist: langchain-google-genai<5.0.0,>=4.4.3
31
- Requires-Dist: langgraph<2.0.0,>=1.2.24
32
- Requires-Dist: langsmith>=0.16.3
31
+ Requires-Dist: langgraph<2.0.0,>=1.2.25
32
+ Requires-Dist: langsmith>=0.16.7
33
33
  Requires-Dist: packaging>=23.2
34
34
  Requires-Dist: wcmatch>=11.0
35
35
  Provides-Extra: aws
@@ -18,7 +18,7 @@ logger = logging.getLogger(__name__)
18
18
  # uses it to keep `__version__` in sync with `pyproject.toml` on every release
19
19
  # PR. Without it, `__version__` silently drifts behind the package version. See
20
20
  # `.github/RELEASING.md` > Version Bumping.
21
- __version__ = "0.7.44" # x-release-please-version
21
+ __version__ = "0.7.45" # x-release-please-version
22
22
 
23
23
 
24
24
  def _distribution_name(dist: Distribution) -> str:
@@ -636,6 +636,51 @@ def create_deep_agent( # noqa: C901, PLR0912, PLR0915 # Complex graph assembly
636
636
  uses a private (underscore-prefixed) name, collides with multiple
637
637
  distinct middleware classes, or matches no entry in the assembled
638
638
  stack.
639
+
640
+ Examples:
641
+ Given a chat `model` and a read-only `search` tool, configure middleware
642
+ to retry transient model failures and timeouts or connection errors from
643
+ `search`. Convert `ValueError` from tool execution into feedback the
644
+ model can act on; let other exceptions propagate.
645
+
646
+ ```python
647
+ from langchain.agents.middleware import (
648
+ ModelRetryMiddleware,
649
+ ToolCallRequest,
650
+ ToolErrorMiddleware,
651
+ ToolRetryMiddleware,
652
+ )
653
+
654
+ from deepagents import create_deep_agent
655
+
656
+
657
+ def on_tool_error(exc: Exception, request: ToolCallRequest) -> str | None:
658
+ if isinstance(exc, ValueError):
659
+ return f"Check the input to `{request.tool_call['name']}` and try again."
660
+ return None
661
+
662
+
663
+ agent = create_deep_agent(
664
+ model=model,
665
+ tools=[search],
666
+ middleware=[
667
+ ModelRetryMiddleware(max_retries=3),
668
+ ToolErrorMiddleware(on_tool_error),
669
+ ToolRetryMiddleware(
670
+ max_retries=2,
671
+ tools=["search"],
672
+ retry_on=(TimeoutError, ConnectionError),
673
+ on_failure="error",
674
+ ),
675
+ ],
676
+ )
677
+ ```
678
+
679
+ Put `ToolErrorMiddleware` before `ToolRetryMiddleware` and set
680
+ `on_failure="error"` so the error handler sees any exception the retry
681
+ middleware lets through. See the
682
+ [fault-tolerance guide](https://docs.langchain.com/oss/python/deepagents/fault-tolerance)
683
+ for more configuration options.
639
684
  """
640
685
  # `DeepAgentState` is a `TypedDict`; TypedDicts disallow `issubclass`, so the
641
686
  # subclass constraint on `state_schema` is enforced by typing alone and not
@@ -1,8 +1,9 @@
1
1
  """Content-addressed offload of inline media in human messages and tool results.
2
2
 
3
3
  Binary blocks are written to `{artifacts_root}/blobs/<sha256>` and replaced in
4
- state with a `deepagents_blob` reference. Model requests are rehydrated from the
5
- backend. Initial input checkpoints can still carry inline payloads.
4
+ state with a reference in the block's `extras`, under `deepagents_blob`. Model
5
+ requests are rehydrated from the backend. Initial input checkpoints can still
6
+ carry inline payloads.
6
7
 
7
8
  To keep blobs somewhere other than the agent's default backend, route the
8
9
  `blobs/` prefix to another backend with `CompositeBackend`.
@@ -32,7 +33,13 @@ if TYPE_CHECKING:
32
33
  logger = logging.getLogger(__name__)
33
34
 
34
35
  _BLOB_REF_KEY: Final = "deepagents_blob"
35
- """Content block key holding the SHA-256 digest of an offloaded payload."""
36
+ """Key in a content block's `extras` holding the SHA-256 digest of an offloaded payload.
37
+
38
+ Stubs written before references moved to `extras` hold it at the top level of
39
+ the block; both are read.
40
+ """
41
+
42
+ _EXTRAS_KEY: Final = "extras"
36
43
 
37
44
  _MISSING_BLOB_TEXT: Final = (
38
45
  "[Binary content from earlier in this conversation is no longer available. Re-read or regenerate it if you still need it.]"
@@ -85,15 +92,42 @@ def _inline_payload(block: Any) -> tuple[str, str | None] | None: # noqa: ANN40
85
92
  return None
86
93
 
87
94
 
95
+ def _with_ref(block: dict[str, Any], digest: str) -> dict[str, Any]:
96
+ extras = block.get(_EXTRAS_KEY)
97
+ extras = extras if isinstance(extras, dict) else {}
98
+ return block | {_EXTRAS_KEY: {**extras, _BLOB_REF_KEY: digest}}
99
+
100
+
101
+ def _ref_holder(block: Any) -> dict[str, Any] | None: # noqa: ANN401
102
+ """Return the dict holding a block's blob reference: its `extras`, or the block itself for a legacy stub."""
103
+ if not isinstance(block, dict):
104
+ return None
105
+ extras = block.get(_EXTRAS_KEY)
106
+ if isinstance(extras, dict) and _BLOB_REF_KEY in extras:
107
+ return extras
108
+ return block if _BLOB_REF_KEY in block else None
109
+
110
+
111
+ def _without_ref(block: dict[str, Any]) -> dict[str, Any]:
112
+ """Return `block` without its blob reference, dropping `extras` when nothing else is left in it."""
113
+ rest = {key: value for key, value in block.items() if key not in {_BLOB_REF_KEY, _EXTRAS_KEY}}
114
+ extras = block.get(_EXTRAS_KEY)
115
+ if isinstance(extras, dict):
116
+ extras = {key: value for key, value in extras.items() if key != _BLOB_REF_KEY}
117
+ if extras:
118
+ rest[_EXTRAS_KEY] = extras
119
+ return rest
120
+
121
+
88
122
  def _stub_block(block: dict[str, Any], digest: str, data_url_mime: str | None) -> dict[str, Any]:
89
123
  """Return `block` with its inline payload replaced by a reference to `digest`."""
90
124
  if data_url_mime is None:
91
- return {key: value for key, value in block.items() if key != "base64"} | {_BLOB_REF_KEY: digest}
125
+ return _with_ref({key: value for key, value in block.items() if key != "base64"}, digest)
92
126
  if block.get("type") == "image_url":
93
- return {"type": "image", "mime_type": data_url_mime, _BLOB_REF_KEY: digest}
127
+ return _with_ref({"type": "image", "mime_type": data_url_mime}, digest)
94
128
  stub = {key: value for key, value in block.items() if key != "url"}
95
129
  stub.setdefault("mime_type", data_url_mime)
96
- return stub | {_BLOB_REF_KEY: digest}
130
+ return _with_ref(stub, digest)
97
131
 
98
132
 
99
133
  def _pending_blobs(messages: Sequence[Any]) -> dict[str, tuple[str, bytes]]:
@@ -227,7 +261,8 @@ def _referenced_digests(messages: Sequence[BaseMessage]) -> list[str]:
227
261
  if not isinstance(message.content, list):
228
262
  continue
229
263
  for block in message.content:
230
- ref = block.get(_BLOB_REF_KEY) if isinstance(block, dict) else None
264
+ holder = _ref_holder(block)
265
+ ref = holder.get(_BLOB_REF_KEY) if holder is not None else None
231
266
  if isinstance(ref, str) and _DIGEST_RE.fullmatch(ref):
232
267
  digests[ref] = None
233
268
  return list(digests)
@@ -249,18 +284,19 @@ def _accept_downloads(missing: list[str], responses: Sequence[FileDownloadRespon
249
284
 
250
285
 
251
286
  def _message_has_refs(message: BaseMessage) -> bool:
252
- return isinstance(message.content, list) and any(isinstance(block, dict) and _BLOB_REF_KEY in block for block in message.content)
287
+ return isinstance(message.content, list) and any(_ref_holder(block) is not None for block in message.content)
253
288
 
254
289
 
255
290
  def _restore_payloads(messages: Sequence[AnyMessage], payloads: dict[str, str]) -> list[AnyMessage]:
256
291
  def hydrate(block: Any) -> Any: # noqa: ANN401
257
- if not isinstance(block, dict) or _BLOB_REF_KEY not in block:
292
+ holder = _ref_holder(block)
293
+ if holder is None:
258
294
  return block
259
- ref = block[_BLOB_REF_KEY]
295
+ ref = holder[_BLOB_REF_KEY]
260
296
  payload = payloads.get(ref) if isinstance(ref, str) else None
261
297
  if payload is None:
262
298
  return {"type": "text", "text": _MISSING_BLOB_TEXT}
263
- return {key: value for key, value in block.items() if key != _BLOB_REF_KEY} | {"base64": payload}
299
+ return _without_ref(block) | {"base64": payload}
264
300
 
265
301
  result = []
266
302
  for message in messages:
@@ -669,6 +669,44 @@ def _final_content(values: Mapping[str, Any]) -> list[ContentBlock]:
669
669
  return last_message.content_blocks
670
670
 
671
671
 
672
+ _LAST_MESSAGE = "last_message"
673
+ """The `extract` alias for a thread's last message."""
674
+
675
+ _OBSERVED_THREAD = {"select": ["thread_id", "status", "interrupts"], "extract": {_LAST_MESSAGE: "values.messages[-1]"}}
676
+ """Read only what a task check needs, so the thread's state doesn't leave the server."""
677
+
678
+ _THREAD_STATUS = {"select": ["thread_id", "status"]}
679
+ """Read only a thread's status."""
680
+
681
+
682
+ def _slim_thread(found: Sequence[Thread], query: Mapping[str, Any]) -> Thread | None:
683
+ """The thread a `threads.search` by ID found; with `extract`, its last message is its only value.
684
+
685
+ `None` sends the caller back to `threads.get`: the search found nothing (so `get`
686
+ raises the real error), or an Agent Server older than `extract` ignored it.
687
+ """
688
+ thread = next(iter(found), None)
689
+ extracted = thread.get("extracted") if thread else None
690
+ if thread is None or ("extract" in query and not isinstance(extracted, Mapping)):
691
+ return None
692
+ if "extract" in query:
693
+ last = cast("Mapping[str, Any]", extracted).get(_LAST_MESSAGE)
694
+ thread = cast("Thread", {**thread, "values": {"messages": [] if last is None else [last]}})
695
+ return thread
696
+
697
+
698
+ def _read_thread(client: SyncLangGraphClient, thread_id: str, query: Mapping[str, Any]) -> Thread:
699
+ """Read a thread's `query` fields with a search by ID, which skips its full state; `threads.get` as the fallback."""
700
+ found = client.threads.search(ids=[thread_id], limit=1, **query)
701
+ return _slim_thread(found, query) or client.threads.get(thread_id=thread_id)
702
+
703
+
704
+ async def _aread_thread(client: LangGraphClient, thread_id: str, query: Mapping[str, Any]) -> Thread:
705
+ """Async version of `_read_thread`."""
706
+ found = await client.threads.search(ids=[thread_id], limit=1, **query)
707
+ return _slim_thread(found, query) or await client.threads.get(thread_id=thread_id)
708
+
709
+
672
710
  _DELIVERABLE_THREAD_STATUSES = frozenset({"idle", "error"})
673
711
  """Parent thread statuses a notification run can start on: neither running nor waiting for a human."""
674
712
 
@@ -681,7 +719,7 @@ async def _awake_parent(parent_thread_id: str, assistant_id: str, event: _TaskUp
681
719
  """
682
720
  client = get_client()
683
721
  try:
684
- if (await client.threads.get(thread_id=parent_thread_id)).get("status") not in _DELIVERABLE_THREAD_STATUSES:
722
+ if (await _aread_thread(client, parent_thread_id, _THREAD_STATUS)).get("status") not in _DELIVERABLE_THREAD_STATUSES:
685
723
  return
686
724
  await client.runs.create(
687
725
  thread_id=parent_thread_id,
@@ -941,7 +979,7 @@ def _observe(client: SyncLangGraphClient, task: AsyncTask) -> tuple[Run, Thread
941
979
  run = next(iter(client.runs.list(thread_id=task["thread_id"], limit=1)), run)
942
980
  if run["status"] != "success":
943
981
  return run, None
944
- thread = client.threads.get(thread_id=task["thread_id"])
982
+ thread = _read_thread(client, task["thread_id"], _OBSERVED_THREAD)
945
983
  if _needs_latest_run(run, thread):
946
984
  run = next(iter(client.runs.list(thread_id=task["thread_id"], limit=1)), run)
947
985
  return run, thread
@@ -954,7 +992,7 @@ async def _aobserve(client: LangGraphClient, task: AsyncTask) -> tuple[Run, Thre
954
992
  run = next(iter(await client.runs.list(thread_id=task["thread_id"], limit=1)), run)
955
993
  if run["status"] != "success":
956
994
  return run, None
957
- thread = await client.threads.get(thread_id=task["thread_id"])
995
+ thread = await _aread_thread(client, task["thread_id"], _OBSERVED_THREAD)
958
996
  if _needs_latest_run(run, thread):
959
997
  run = next(iter(await client.runs.list(thread_id=task["thread_id"], limit=1)), run)
960
998
  return run, thread
@@ -277,15 +277,22 @@ def _replace_rejected_file_content(messages: list[AnyMessage]) -> list[AnyMessag
277
277
  """Replace only multimodal reads since the latest model response."""
278
278
  last_response = next((index for index in range(len(messages) - 1, -1, -1) if isinstance(messages[index], AIMessage)), -1)
279
279
  return [
280
- message.model_copy(update={"content": "Unsupported content. The file may be invalid, too large, or of an unsupported mime-type."})
280
+ _without_media(message)
281
281
  if index > last_response
282
- and (_is_read_file_media_result(message) or (isinstance(message, ToolMessage) and message.name == "read_file"))
282
+ and (_is_read_file_media_result(message) or isinstance(message, ToolMessage))
283
283
  and any(block["type"] in _MULTIMODAL_BLOCK_TYPES for block in message.content_blocks)
284
284
  else message
285
285
  for index, message in enumerate(messages)
286
286
  ]
287
287
 
288
288
 
289
+ def _without_media(message: AnyMessage) -> AnyMessage:
290
+ """Replace media with a notice, keeping a tool result's other blocks."""
291
+ notice = "Unsupported content. The file may be invalid, too large, or of an unsupported mime-type."
292
+ kept = [block for block in message.content_blocks if block["type"] not in _MULTIMODAL_BLOCK_TYPES] if isinstance(message, ToolMessage) else []
293
+ return message.model_copy(update={"content": [*kept, {"type": "text", "text": notice}] if kept else notice})
294
+
295
+
289
296
  def _handle_video_read(
290
297
  content: str,
291
298
  validated_path: str,
@@ -136,7 +136,7 @@ from langchain.agents.middleware.types import (
136
136
  )
137
137
  from langgraph.types import Command, Overwrite
138
138
 
139
- from deepagents.backends.protocol import FILE_NOT_FOUND, FileDownloadResponse, LsResult
139
+ from deepagents.backends.protocol import FILE_NOT_FOUND, FileDownloadResponse, FileInfo, LsResult
140
140
  from deepagents.backends.utils import to_posix_path
141
141
  from deepagents.middleware._skill_tools import (
142
142
  _INCLUDE_TOOLS_KEY,
@@ -681,6 +681,13 @@ def _format_skills_source_error(source_path: str, error: str) -> str:
681
681
  return f"Cannot load skills from '{source_path}': {error}"
682
682
 
683
683
 
684
+ def _skill_dirs(items: Sequence[FileInfo], source_path: str) -> list[str]:
685
+ for item in items:
686
+ if not item.get("is_dir") and PurePosixPath(to_posix_path(item["path"])).name == "SKILL.md":
687
+ return [source_path]
688
+ return [item["path"] for item in items if item.get("is_dir")]
689
+
690
+
684
691
  def _list_skills_with_errors(backend: BackendProtocol, source_path: str) -> tuple[list[SkillMetadata], str | None]:
685
692
  """List all skills from a backend source.
686
693
 
@@ -713,13 +720,7 @@ def _list_skills_with_errors(backend: BackendProtocol, source_path: str) -> tupl
713
720
 
714
721
  items = ls_result.entries if isinstance(ls_result, LsResult) else ls_result
715
722
 
716
- # Find all skill directories (directories containing SKILL.md)
717
- skill_dirs = []
718
- for item in items or []:
719
- if not item.get("is_dir"):
720
- continue
721
- skill_dirs.append(item["path"])
722
-
723
+ skill_dirs = _skill_dirs(items or [], source_path)
723
724
  if not skill_dirs:
724
725
  return [], source_error
725
726
 
@@ -779,13 +780,7 @@ async def _alist_skills_with_errors(backend: BackendProtocol, source_path: str)
779
780
 
780
781
  items = ls_result.entries if isinstance(ls_result, LsResult) else ls_result
781
782
 
782
- # Find all skill directories (directories containing SKILL.md)
783
- skill_dirs = []
784
- for item in items or []:
785
- if not item.get("is_dir"):
786
- continue
787
- skill_dirs.append(item["path"])
788
-
783
+ skill_dirs = _skill_dirs(items or [], source_path)
789
784
  if not skill_dirs:
790
785
  return [], source_error
791
786
 
@@ -137,6 +137,9 @@ if TYPE_CHECKING:
137
137
 
138
138
  logger = logging.getLogger(__name__)
139
139
 
140
+ _OUTPUT_RESERVE_CAP_DIVISOR = 4
141
+ """Cap on the output reservation, as a fraction of the input limit, when output fills the whole budget."""
142
+
140
143
 
141
144
  class CompactConversationSchema(BaseModel):
142
145
  """Input schema for the `compact_conversation` tool."""
@@ -1537,7 +1540,13 @@ A condensed summary follows:
1537
1540
  raise ContextOverflowError(msg) from error
1538
1541
 
1539
1542
  def _input_budget(self, request: ModelRequest) -> int | None:
1540
- """Reserve configured output and 5% headroom from the advertised input limit."""
1543
+ """Reserve configured output and 5% headroom from the advertised input limit.
1544
+
1545
+ When the configured output is at least the whole budget, such as a
1546
+ provider default that sets `max_tokens` to a model's full window, the
1547
+ reservation is capped at a quarter of the limit instead of leaving no
1548
+ room for input at all.
1549
+ """
1541
1550
  profile = request.model.profile
1542
1551
  limit = profile.get("max_input_tokens") if isinstance(profile, dict) else None
1543
1552
  if not isinstance(limit, int) or isinstance(limit, bool):
@@ -1547,7 +1556,9 @@ A condensed summary follows:
1547
1556
  value = request.model_settings.get(key, getattr(request.model, key, None))
1548
1557
  if isinstance(value, int) and not isinstance(value, bool):
1549
1558
  output = max(output, value)
1550
- return max(0, int(limit * 0.95) - output)
1559
+ headroom = int(limit * 0.95)
1560
+ reserved = output if output < headroom else min(output, limit // _OUTPUT_RESERVE_CAP_DIVISOR)
1561
+ return max(0, headroom - reserved)
1551
1562
 
1552
1563
  def _over_budget(self, request: ModelRequest, total_tokens: int | None = None) -> bool:
1553
1564
  budget = self._input_budget(request)
@@ -30,8 +30,10 @@ from deepagents.profiles.harness import (
30
30
  _anthropic_haiku_4_5,
31
31
  _anthropic_opus_4_7,
32
32
  _anthropic_sonnet_4_6,
33
+ _fireworks_kimi_k3p1_pro,
33
34
  _nvidia_nemotron_3_ultra,
34
35
  _openai_codex,
36
+ _openai_gpt_6_1_sol,
35
37
  )
36
38
  from deepagents.profiles.harness.harness_profiles import _HARNESS_PROFILES
37
39
  from deepagents.profiles.provider import _nvidia, _openai, _openrouter
@@ -154,6 +156,8 @@ def _ensure_builtin_profiles_loaded() -> None:
154
156
  _anthropic_haiku_4_5.register()
155
157
  _nvidia_nemotron_3_ultra.register()
156
158
  _openai_codex.register()
159
+ _openai_gpt_6_1_sol.register()
160
+ _fireworks_kimi_k3p1_pro.register()
157
161
  plugins = _discover_profile_plugins()
158
162
  _invoke_profile_plugins(_PROVIDER_PROFILE_GROUP, plugins[_PROVIDER_PROFILE_GROUP])
159
163
  _invoke_profile_plugins(_HARNESS_PROFILE_GROUP, plugins[_HARNESS_PROFILE_GROUP])
@@ -0,0 +1,27 @@
1
+ """Built-in Kimi K3.1 Pro (Fireworks) harness profile.
2
+
3
+ Applies the same selective delegation guidance as the GPT-6.1 Sol profile:
4
+ the `task` tool and general-purpose subagent descriptions keep routine work
5
+ with the parent and reserve subagents for substantial, independent work.
6
+ """
7
+
8
+ from deepagents.profiles.harness._openai_gpt_6_1_sol import (
9
+ _GENERAL_PURPOSE_DESCRIPTION,
10
+ _TASK_DESCRIPTION,
11
+ )
12
+ from deepagents.profiles.harness.harness_profiles import (
13
+ GeneralPurposeSubagentProfile,
14
+ HarnessProfile,
15
+ _register_harness_profile_impl,
16
+ )
17
+
18
+
19
+ def register() -> None:
20
+ """Register the built-in Kimi K3.1 Pro harness profile."""
21
+ _register_harness_profile_impl(
22
+ "fireworks:accounts/fireworks/models/kimi-k3p1-pro",
23
+ HarnessProfile(
24
+ tool_description_overrides={"task": _TASK_DESCRIPTION},
25
+ general_purpose_subagent=GeneralPurposeSubagentProfile(description=_GENERAL_PURPOSE_DESCRIPTION),
26
+ ),
27
+ )
@@ -0,0 +1,52 @@
1
+ """Built-in GPT-6.1 Sol harness profile.
2
+
3
+ Replaces the `task` tool and general-purpose subagent descriptions for
4
+ `openai:gpt-6.1-sol` with selective delegation guidance: keep routine work
5
+ with the parent and reserve subagents for substantial, independent work.
6
+ """
7
+
8
+ # ruff: noqa: E501
9
+ # Model-facing prompt lines are kept unwrapped.
10
+
11
+ from deepagents.profiles.harness.harness_profiles import (
12
+ GeneralPurposeSubagentProfile,
13
+ HarnessProfile,
14
+ _register_harness_profile_impl,
15
+ )
16
+
17
+ _TASK_DESCRIPTION = """Launch an ephemeral subagent to handle a well-scoped task.
18
+
19
+ Available agent types and the tools they have access to:
20
+ {available_agents}
21
+
22
+ Specify subagent_type to select the agent. Usage notes:
23
+ - Select an agent according to its description and the user's explicit requirements.
24
+ - Launch multiple agents concurrently when their tasks are independent and their write scopes do not conflict, using a single message with multiple tool calls.
25
+ - Each invocation is stateless by default: the agent sees only the prompt you give it and returns a single final report. Put sufficient context in the prompt — unless an agent type below says it inherits your conversation instead. State a bounded deliverable, relevant constraints, and the expected result.
26
+ - The agent's report is not shown to the user; relay a summary yourself.
27
+ - Tell the agent whether to create content, analyze, or only research, since it can't necessarily see the user's intent unless it inherits your conversation, as noted per agent type below.
28
+ - If an agent's description says to use it proactively, do so without waiting to be asked."""
29
+ """`task` tool description template; `{available_agents}` lists the subagents."""
30
+
31
+ _GENERAL_PURPOSE_DESCRIPTION = (
32
+ "General-purpose agent for substantial, independent work with its own deliverable, "
33
+ "such as a separate part of the solution that can proceed in parallel with yours. "
34
+ "Do not delegate reviews, audits, re-derivations, or verification of work you are doing or have done; "
35
+ "check it yourself with direct tools. "
36
+ "Do not hand off a phase (research, implementation, testing) of a task you own. "
37
+ "Prefer direct tools for searches, reading code, small edits, and tightly coupled next steps. "
38
+ "Complexity or uncertainty is not sufficient reason to delegate. "
39
+ "This agent has the same capabilities as the main agent."
40
+ )
41
+ """General-purpose subagent description shown in the `task` tool listing."""
42
+
43
+
44
+ def register() -> None:
45
+ """Register the built-in GPT-6.1 Sol harness profile."""
46
+ _register_harness_profile_impl(
47
+ "openai:gpt-6.1-sol",
48
+ HarnessProfile(
49
+ tool_description_overrides={"task": _TASK_DESCRIPTION},
50
+ general_purpose_subagent=GeneralPurposeSubagentProfile(description=_GENERAL_PURPOSE_DESCRIPTION),
51
+ ),
52
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepagents
3
- Version: 0.7.44
3
+ Version: 0.7.45
4
4
  Summary: Production-ready, extensible agent harness with a built-in filesystem and context management, sub-agent delegation, skills, and long-term memory.
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://docs.langchain.com/oss/python/deepagents/overview
@@ -25,11 +25,11 @@ Requires-Python: <4.0,>=3.11
25
25
  Description-Content-Type: text/markdown
26
26
  License-File: LICENSE
27
27
  Requires-Dist: langchain<2.0.0,>=1.5.2
28
- Requires-Dist: langchain-core<2.0.0,>=1.8.5
29
- Requires-Dist: langchain-anthropic<2.0.0,>=1.7.13
28
+ Requires-Dist: langchain-core<2.0.0,>=1.9.0
29
+ Requires-Dist: langchain-anthropic<2.0.0,>=1.8.0
30
30
  Requires-Dist: langchain-google-genai<5.0.0,>=4.4.3
31
- Requires-Dist: langgraph<2.0.0,>=1.2.24
32
- Requires-Dist: langsmith>=0.16.3
31
+ Requires-Dist: langgraph<2.0.0,>=1.2.25
32
+ Requires-Dist: langsmith>=0.16.7
33
33
  Requires-Dist: packaging>=23.2
34
34
  Requires-Dist: wcmatch>=11.0
35
35
  Provides-Extra: aws
@@ -58,8 +58,10 @@ deepagents/profiles/harness/__init__.py
58
58
  deepagents/profiles/harness/_anthropic_haiku_4_5.py
59
59
  deepagents/profiles/harness/_anthropic_opus_4_7.py
60
60
  deepagents/profiles/harness/_anthropic_sonnet_4_6.py
61
+ deepagents/profiles/harness/_fireworks_kimi_k3p1_pro.py
61
62
  deepagents/profiles/harness/_nvidia_nemotron_3_ultra.py
62
63
  deepagents/profiles/harness/_openai_codex.py
64
+ deepagents/profiles/harness/_openai_gpt_6_1_sol.py
63
65
  deepagents/profiles/harness/harness_profiles.py
64
66
  deepagents/profiles/provider/__init__.py
65
67
  deepagents/profiles/provider/_nvidia.py
@@ -1,9 +1,9 @@
1
1
  langchain<2.0.0,>=1.5.2
2
- langchain-core<2.0.0,>=1.8.5
3
- langchain-anthropic<2.0.0,>=1.7.13
2
+ langchain-core<2.0.0,>=1.9.0
3
+ langchain-anthropic<2.0.0,>=1.8.0
4
4
  langchain-google-genai<5.0.0,>=4.4.3
5
- langgraph<2.0.0,>=1.2.24
6
- langsmith>=0.16.3
5
+ langgraph<2.0.0,>=1.2.25
6
+ langsmith>=0.16.7
7
7
  packaging>=23.2
8
8
  wcmatch>=11.0
9
9
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "deepagents"
3
- version = "0.7.44"
3
+ version = "0.7.45"
4
4
 
5
5
  description = "Production-ready, extensible agent harness with a built-in filesystem and context management, sub-agent delegation, skills, and long-term memory."
6
6
  readme = "README.md"
@@ -21,11 +21,11 @@ classifiers = [
21
21
  ]
22
22
  dependencies = [
23
23
  "langchain>=1.5.2,<2.0.0",
24
- "langchain-core>=1.8.5,<2.0.0",
25
- "langchain-anthropic>=1.7.13,<2.0.0",
24
+ "langchain-core>=1.9.0,<2.0.0",
25
+ "langchain-anthropic>=1.8.0,<2.0.0",
26
26
  "langchain-google-genai>=4.4.3,<5.0.0",
27
- "langgraph>=1.2.24,<2.0.0",
28
- "langsmith>=0.16.3",
27
+ "langgraph>=1.2.25,<2.0.0",
28
+ "langsmith>=0.16.7",
29
29
  "packaging>=23.2",
30
30
  "wcmatch>=11.0",
31
31
  ]
@@ -59,7 +59,7 @@ test = [
59
59
  "ty>=0.0.62,<1.0.0",
60
60
  "pytest-asyncio>=1.4.0",
61
61
  "langchain-tests>=1.2.0",
62
- "langchain-openai>=1.8.5,<2.0.0",
62
+ "langchain-openai>=1.8.6,<2.0.0",
63
63
  # The `aws` extra, so payload tests can drive real langchain-aws chat models.
64
64
  "langchain-aws>=1.10.0,<2.0.0",
65
65
  "twine",
File without changes
File without changes
File without changes