managed-deepagents 0.10.2.dev4__py3-none-win_amd64.whl → 0.10.2.dev5__py3-none-win_amd64.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.
Binary file
@@ -73,19 +73,24 @@ def _content_as_text(content: object) -> str:
73
73
  #: A reply that means "nothing to tell the channel" (Content Studio's convention).
74
74
  QUIET_REPLY = "[quiet]"
75
75
  #: Message field (``additional_kwargs`` key) deepagents uses for a task notification.
76
+ #: Deprecated: read ``lc_source`` and ``lc_data``.
76
77
  NOTIFICATION_KEY = "deepagents_notification"
77
- #: Message field MDA uses the same way, for a notification of its own such as a
78
- #: browser handoff ending.
79
- MDA_NOTIFICATION_KEY = "mda_notification"
78
+ #: Notification metadata sources of task news: async subagent and browser handoff updates.
79
+ NOTIFICATION_SOURCES = frozenset({"async_subagent", "browser_handoff"})
80
80
 
81
81
 
82
82
  def is_task_notification(message: object) -> bool:
83
- """Whether a message is a deepagents or MDA notification rather than the user's."""
83
+ """Whether a message is a harness-added notification rather than the user's.
84
+
85
+ Recognizes notification metadata with a source in ``NOTIFICATION_SOURCES``
86
+ and the deprecated ``deepagents_notification`` key.
87
+ """
84
88
  extra = _field(message, "additional_kwargs")
85
- return any(
86
- (isinstance(message, Mapping) and key in message)
87
- or (isinstance(extra, Mapping) and key in extra)
88
- for key in (NOTIFICATION_KEY, MDA_NOTIFICATION_KEY)
89
+ source = extra.get("lc_source") if isinstance(extra, Mapping) else None
90
+ if isinstance(source, str) and source in NOTIFICATION_SOURCES:
91
+ return True
92
+ return (isinstance(message, Mapping) and NOTIFICATION_KEY in message) or (
93
+ isinstance(extra, Mapping) and NOTIFICATION_KEY in extra
89
94
  )
90
95
 
91
96
 
@@ -182,7 +187,6 @@ def _field(message: object, name: str) -> object:
182
187
 
183
188
 
184
189
  __all__ = [
185
- "MDA_NOTIFICATION_KEY",
186
190
  "NOTIFICATION_KEY",
187
191
  "QUIET_REPLY",
188
192
  "extract_assistant_text",
@@ -50,7 +50,14 @@ from deepagents.middleware.async_subagents import (
50
50
  from langchain.agents.middleware import AgentMiddleware
51
51
  from langchain.agents.middleware.types import AgentState, OmitFromInput, PrivateStateAttr
52
52
  from langchain.tools import BaseTool, tool
53
- from langchain_core.messages import BaseMessage, SystemMessage, ToolMessage
53
+ from langchain_core.messages import (
54
+ BaseMessage,
55
+ HumanMessage,
56
+ SystemMessage,
57
+ ToolMessage,
58
+ add_notification_metadata,
59
+ get_notification_metadata,
60
+ )
54
61
  from langchain_core.messages.content import create_text_block
55
62
  from langgraph.config import get_config
56
63
  from langgraph.graph import START, StateGraph
@@ -72,7 +79,6 @@ from stagehand_middleware.facade import (
72
79
  )
73
80
  from stagehand_middleware.facade.tools import sanitize_error_message
74
81
 
75
- from managed_deepagents._channels.assistant_text import MDA_NOTIFICATION_KEY
76
82
  from managed_deepagents._managed_tools import ManagedToolRuntime # noqa: TC001 - tool annotations
77
83
  from managed_deepagents.define_browser import BROWSER_TOOL_PREFIX
78
84
  from managed_deepagents.identity import ManagedServerInfo
@@ -144,6 +150,7 @@ _WAKE_TEXT: dict[BrowserHandoffStatus, str] = {
144
150
  ),
145
151
  "ended": "The browser handoff ended. Take a snapshot to see whether the user finished.",
146
152
  }
153
+ _NOT_FROM_USER = "This is not a message from the user."
147
154
  _RELEASE_AFTER_S = 60.0 # a run that raises or interrupts never reaches aafter_agent
148
155
  #: Without a sandbox a saved file lives in thread state, which every later checkpoint carries.
149
156
  _MAX_SAVED_BYTES = 5_000_000
@@ -724,20 +731,30 @@ async def _handoff_status(pending: PendingBrowserHandoff) -> BrowserHandoffStatu
724
731
  return "ended" if time.time() >= pending["until"] else None
725
732
 
726
733
 
734
+ _HANDOFF_SOURCE = "browser_handoff"
735
+ """``lc_source`` of a handoff notification; its ``lc_data`` is ``{"status": ...}``."""
736
+
737
+
727
738
  def _wake_message(status: BrowserHandoffStatus) -> dict[str, Any]:
728
- """A notification in deepagents' task notification's shape: a user-role message
729
- framed as a system notification. Its ``mda_notification`` tells clients how the
730
- handoff ended, so they can tell it from the user's message."""
739
+ """A notification of how the handoff ended, with source ``"browser_handoff"``."""
740
+ message = add_notification_metadata(
741
+ HumanMessage(
742
+ f'<browser_handoff status="{status}">\n'
743
+ f"{_WAKE_TEXT[status]} {_NOT_FROM_USER}\n</browser_handoff>"
744
+ ),
745
+ source=_HANDOFF_SOURCE,
746
+ data={"status": status},
747
+ )
731
748
  return {
732
749
  "role": "user",
733
- "content": f"[SYSTEM NOTIFICATION - NOT USER INPUT]\n{_WAKE_TEXT[status]}",
734
- MDA_NOTIFICATION_KEY: {"type": "browser_handoff", "status": status},
750
+ "content": message.content,
751
+ "additional_kwargs": message.additional_kwargs,
735
752
  }
736
753
 
737
754
 
738
755
  def _is_handoff_notification(message: BaseMessage) -> bool:
739
- notification = message.additional_kwargs.get(MDA_NOTIFICATION_KEY)
740
- return isinstance(notification, dict) and notification.get("type") == "browser_handoff"
756
+ metadata = get_notification_metadata(message)
757
+ return metadata is not None and metadata["source"] == _HANDOFF_SOURCE
741
758
 
742
759
 
743
760
  async def _end_take(key: str, window: str) -> list[dict[str, str]] | str | None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: managed-deepagents
3
- Version: 0.10.2.dev4
3
+ Version: 0.10.2.dev5
4
4
  Summary: Managed Deep Agents — the define_deep_agent authoring interface plus the CLI that compiles and deploys a code-first Deep Agent repository to a managed LangGraph runtime.
5
5
  Author: LangChain
6
6
  License: MIT
@@ -18,7 +18,7 @@ Requires-Dist: httpx<1,>=0.28.1
18
18
  Requires-Dist: typing-extensions<5,>=4.12.2
19
19
  Requires-Dist: deepagents<1,>=0.7.30
20
20
  Requires-Dist: langchain<2,>=1.4.6
21
- Requires-Dist: langchain-core<2,>=1.6.2
21
+ Requires-Dist: langchain-core<2,>=1.7.2
22
22
  Requires-Dist: langgraph<2,>=1.2.15
23
23
  Requires-Dist: langgraph-prebuilt<2,>=1.1.1
24
24
  Requires-Dist: langgraph-sdk<0.5,>=0.4.6
@@ -40,7 +40,7 @@ managed_deepagents/_static_entry.py,sha256=QgvrnBLue6elOHSWdIFosFEfYMp4V9YDwBlZS
40
40
  managed_deepagents/_thread_record.py,sha256=310sxl15FdvsCGJW0mwyBlocsAhrvr7b-CxOOyhQVk4,8638
41
41
  managed_deepagents/_validated_token.py,sha256=On96IOQTDz1KE_ZZmuTqY8IPw-cJ3J2tXkkmrfyvbB4,18762
42
42
  managed_deepagents/agent_entry.py,sha256=C6UPWGzp57DlmcY6lJBVbI-8U_Rc5FjGzPBmSoD-O-c,553
43
- managed_deepagents/browser.py,sha256=Ajt4QAcmiDdZi72taZQBSJmezK0PAH9f6UIlcBdk9Dk,59808
43
+ managed_deepagents/browser.py,sha256=dcUhoD8i2ZzxpcsgO7Eb-DUbrd2nHfDpg5MF1pxwqgw,60023
44
44
  managed_deepagents/define_browser.py,sha256=FQKYVVRTDqSNGqG4Pzp1H6qngAsL1h0gOhu8bYxJ140,2000
45
45
  managed_deepagents/define_deep_agent.py,sha256=2qAet4dOn9lUYUSGE1QhoU86LCLZV_MMemLTKayMzfc,12253
46
46
  managed_deepagents/define_memory.py,sha256=0DzI9jxr83YJ6mEhqXRbIYzgWpl259-PdAMoAQRQ3pU,6465
@@ -50,10 +50,10 @@ managed_deepagents/run_context.py,sha256=IayZdcpPrKVss70Hro8qI-EWtL94HZt4JKefzec
50
50
  managed_deepagents/runtime.py,sha256=FWGLsciTeYqHhr8hpLxetR_xlhqo90RNNSOeAd_FdF0,114053
51
51
  managed_deepagents/sandbox.py,sha256=cS66-vFcARsbHR3fH5jvWd4qF-MAjiGqRe-_Kocsqtg,4693
52
52
  managed_deepagents/schedules.py,sha256=XROsDs-QwCWH0yEwakIN5Rhl5aM06eZX5-JFJ-KG1To,5898
53
- managed_deepagents/_binaries/mda.exe,sha256=IgOFHlkP0X-kgBpBLdfN9P8PKbc3_UCU66GY-S-VF1A,5106688
53
+ managed_deepagents/_binaries/mda.exe,sha256=k6_FcYVXZDDODCiwsESZk9QYPcl1EUy-s1i2sXoXrdw,5106688
54
54
  managed_deepagents/_channels/__init__.py,sha256=mMgqza7EWRjhJM0lXlFd-W6wBYZrFkpLQ4_30Bpij7k,249
55
55
  managed_deepagents/_channels/actor.py,sha256=3d_1-ia6vwVjXkw7PYn5gg6BjnlPwRXW4nW2C5vAO7c,5203
56
- managed_deepagents/_channels/assistant_text.py,sha256=-QMVt-XhFQu8Myy_Sr7H2rtGDpi_2F7nXG7xYew8_zA,8182
56
+ managed_deepagents/_channels/assistant_text.py,sha256=nf00-KJXNev-e_TkAK_8SBI3J9TiOis1GkGV_zT5048,8472
57
57
  managed_deepagents/_channels/binding.py,sha256=hhx872cgBmJcdMq8Tqz5VKO8pcLCnz0eBlAYfj9_-MA,7837
58
58
  managed_deepagents/_channels/context.py,sha256=3upGBFHPVZXjcZAC5pKhFIMmDhEnKN4d8CzAdOEH-5c,2294
59
59
  managed_deepagents/_channels/delivery.py,sha256=fsBDxoPKk2FIMDH-Gx97vvW-wvnw_HwcIkV9QmpVsDQ,23529
@@ -151,9 +151,9 @@ managed_deepagents/identity/__init__.py,sha256=uZUKDHtfBc0n-T2xoJEFMqMplmXwAK7hb
151
151
  managed_deepagents/identity/claims.py,sha256=prby7r_8Lww3MmoBm8PX6PsSGE3GwSHkr8mVIz_08nU,1180
152
152
  managed_deepagents/identity/options.py,sha256=x_yMbXEFR7zXyehEjDHG2qjAlukXjrRBcQLcM6IndLM,2550
153
153
  managed_deepagents/identity/supabase.py,sha256=8uobl3WCrQL_ieSXG8KTLf1th7Qjim9liZT50HeaJE0,6026
154
- managed_deepagents-0.10.2.dev4.dist-info/licenses/LICENSE,sha256=WnPZQQ608ojZUkXl7BW6VbKloIAibZiGm1K6cjeZOL8,1066
155
- managed_deepagents-0.10.2.dev4.dist-info/METADATA,sha256=ceqUGJMyKkW1NLpiJ4pBptkKPiW7gswv1TehUPLTtPA,92915
156
- managed_deepagents-0.10.2.dev4.dist-info/WHEEL,sha256=bhMFZwp6VMtrbl2Ck6PlXryKaCggO1NzYn_HcFbBF1I,97
157
- managed_deepagents-0.10.2.dev4.dist-info/entry_points.txt,sha256=ziZqkKuaDO3qHCjKmBhrx9cm3ok8bZ9xcEDpUTj4unM,53
158
- managed_deepagents-0.10.2.dev4.dist-info/top_level.txt,sha256=fdBo4O0Hlol_w022tTLB5ftZpamb4yJoQ3MUvjgTGfA,19
159
- managed_deepagents-0.10.2.dev4.dist-info/RECORD,,
154
+ managed_deepagents-0.10.2.dev5.dist-info/licenses/LICENSE,sha256=WnPZQQ608ojZUkXl7BW6VbKloIAibZiGm1K6cjeZOL8,1066
155
+ managed_deepagents-0.10.2.dev5.dist-info/METADATA,sha256=KwB5aS9sMsx5urOaMhRiIon2owvK0-QczN3CaaV3xpM,92915
156
+ managed_deepagents-0.10.2.dev5.dist-info/WHEEL,sha256=bhMFZwp6VMtrbl2Ck6PlXryKaCggO1NzYn_HcFbBF1I,97
157
+ managed_deepagents-0.10.2.dev5.dist-info/entry_points.txt,sha256=ziZqkKuaDO3qHCjKmBhrx9cm3ok8bZ9xcEDpUTj4unM,53
158
+ managed_deepagents-0.10.2.dev5.dist-info/top_level.txt,sha256=fdBo4O0Hlol_w022tTLB5ftZpamb4yJoQ3MUvjgTGfA,19
159
+ managed_deepagents-0.10.2.dev5.dist-info/RECORD,,