managed-deepagents 0.10.2.dev2__py3-none-win_arm64.whl → 0.10.2.dev4__py3-none-win_arm64.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.
- managed_deepagents/_async_subagents.py +1 -1
- managed_deepagents/_binaries/mda.exe +0 -0
- managed_deepagents/_connector.py +11 -4
- managed_deepagents/_managed_composition.py +23 -0
- managed_deepagents/define_deep_agent.py +24 -3
- managed_deepagents/runtime.py +92 -50
- {managed_deepagents-0.10.2.dev2.dist-info → managed_deepagents-0.10.2.dev4.dist-info}/METADATA +1 -1
- {managed_deepagents-0.10.2.dev2.dist-info → managed_deepagents-0.10.2.dev4.dist-info}/RECORD +12 -12
- {managed_deepagents-0.10.2.dev2.dist-info → managed_deepagents-0.10.2.dev4.dist-info}/WHEEL +0 -0
- {managed_deepagents-0.10.2.dev2.dist-info → managed_deepagents-0.10.2.dev4.dist-info}/entry_points.txt +0 -0
- {managed_deepagents-0.10.2.dev2.dist-info → managed_deepagents-0.10.2.dev4.dist-info}/licenses/LICENSE +0 -0
- {managed_deepagents-0.10.2.dev2.dist-info → managed_deepagents-0.10.2.dev4.dist-info}/top_level.txt +0 -0
|
@@ -13,7 +13,7 @@ GENERAL_PURPOSE = "general-purpose"
|
|
|
13
13
|
_AGENT_SKILLS = "/skills/"
|
|
14
14
|
|
|
15
15
|
# Spec keys that override the lead's value; unset ones inherit it, like a sync subagent.
|
|
16
|
-
_INHERITED_KEYS = ("model", "tools", "permissions", "interrupt_on")
|
|
16
|
+
_INHERITED_KEYS = ("model", "tools", "permissions", "interrupt_on", "mcp")
|
|
17
17
|
# Spec keys the lead never passes down, like a sync subagent.
|
|
18
18
|
_OWN_KEYS = ("middleware", "response_format")
|
|
19
19
|
|
|
Binary file
|
managed_deepagents/_connector.py
CHANGED
|
@@ -24,6 +24,7 @@ __all__ = [
|
|
|
24
24
|
"has_sandbox_connectors",
|
|
25
25
|
"is_connector",
|
|
26
26
|
"load_connector_tools",
|
|
27
|
+
"load_tools_by_connector",
|
|
27
28
|
"requirements_from_connectors",
|
|
28
29
|
"run_connector_sandbox_hooks",
|
|
29
30
|
]
|
|
@@ -191,12 +192,18 @@ def load_connector_tools(
|
|
|
191
192
|
Connectors without a ``tools`` hook (e.g. HTTP-only connectors) contribute
|
|
192
193
|
nothing. Order is preserved.
|
|
193
194
|
"""
|
|
194
|
-
tools
|
|
195
|
+
return [tool for _, tools in load_tools_by_connector(connectors, ctx) for tool in tools]
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def load_tools_by_connector(
|
|
199
|
+
connectors: Sequence[Connector], ctx: ToolContext | None = None
|
|
200
|
+
) -> list[tuple[Connector, ConnectorToolList]]:
|
|
201
|
+
loaded: list[tuple[Connector, ConnectorToolList]] = []
|
|
195
202
|
for connector in connectors:
|
|
196
203
|
hook = getattr(connector, "tools", None)
|
|
197
|
-
if callable(hook)
|
|
198
|
-
|
|
199
|
-
return
|
|
204
|
+
tools = list(hook(ctx if ctx is not None else {})) if callable(hook) else []
|
|
205
|
+
loaded.append((connector, tools))
|
|
206
|
+
return loaded
|
|
200
207
|
|
|
201
208
|
|
|
202
209
|
def has_sandbox_connectors(connectors: Sequence[object] | None) -> bool:
|
|
@@ -89,6 +89,26 @@ def snapshot_mcp_selection(value: object) -> tuple[McpServersDefinition, ...]:
|
|
|
89
89
|
return tuple(definitions)
|
|
90
90
|
|
|
91
91
|
|
|
92
|
+
def snapshot_subagent_mcp_selections(subagents: Sequence[object]) -> Sequence[object]:
|
|
93
|
+
"""Validate and copy each declarative subagent's `mcp` selection."""
|
|
94
|
+
if not any(isinstance(spec, Mapping) and "mcp" in spec for spec in subagents):
|
|
95
|
+
return subagents
|
|
96
|
+
copied: list[object] = []
|
|
97
|
+
for spec in subagents:
|
|
98
|
+
if isinstance(spec, Mapping) and "mcp" in spec:
|
|
99
|
+
if {"runnable", "graph_id", "url"} & spec.keys():
|
|
100
|
+
raise TypeError('subagent "mcp" requires a declarative subagent')
|
|
101
|
+
if spec.get("async") is not True and spec.get("mode") == "fork":
|
|
102
|
+
raise TypeError(
|
|
103
|
+
'subagent "mcp" is not supported on a sync "mode": "fork" subagent, '
|
|
104
|
+
"which inherits this agent's MCP credential middleware"
|
|
105
|
+
)
|
|
106
|
+
mcp = spec["mcp"]
|
|
107
|
+
spec = {**spec, "mcp": None if mcp is None else snapshot_mcp_selection(mcp)} # noqa: PLW2901
|
|
108
|
+
copied.append(spec)
|
|
109
|
+
return copied
|
|
110
|
+
|
|
111
|
+
|
|
92
112
|
def snapshot_memory_selection(value: object) -> MemoryDefinition:
|
|
93
113
|
"""Validate and copy a memory definition selected for a run."""
|
|
94
114
|
if not isinstance(value, MemoryDefinition):
|
|
@@ -250,6 +270,9 @@ def snapshot_managed_composition(config: Mapping[str, object]) -> dict[str, obje
|
|
|
250
270
|
raise TypeError("instructions must be a string or None")
|
|
251
271
|
if "mcp" in copied:
|
|
252
272
|
copied["mcp"] = None if copied["mcp"] is None else snapshot_mcp_selection(copied["mcp"])
|
|
273
|
+
subagents = copied.get("subagents")
|
|
274
|
+
if isinstance(subagents, Sequence) and not isinstance(subagents, (str, bytes, bytearray)):
|
|
275
|
+
copied["subagents"] = snapshot_subagent_mcp_selections(subagents)
|
|
253
276
|
if "memory" in copied:
|
|
254
277
|
copied["memory"] = (
|
|
255
278
|
None if copied["memory"] is None else snapshot_memory_selection(copied["memory"])
|
|
@@ -9,7 +9,7 @@ from __future__ import annotations
|
|
|
9
9
|
|
|
10
10
|
from collections.abc import Callable, Mapping, Sequence
|
|
11
11
|
from dataclasses import dataclass
|
|
12
|
-
from typing import TYPE_CHECKING, Any, ClassVar, Literal, Never, NotRequired, TypedDict
|
|
12
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Literal, Never, NotRequired, TypedDict, cast
|
|
13
13
|
|
|
14
14
|
from managed_deepagents._managed_composition import (
|
|
15
15
|
OMITTED,
|
|
@@ -18,6 +18,7 @@ from managed_deepagents._managed_composition import (
|
|
|
18
18
|
Omitted,
|
|
19
19
|
SkillSelection,
|
|
20
20
|
copy_managed_selections,
|
|
21
|
+
snapshot_subagent_mcp_selections,
|
|
21
22
|
)
|
|
22
23
|
|
|
23
24
|
if TYPE_CHECKING:
|
|
@@ -43,7 +44,18 @@ if TYPE_CHECKING:
|
|
|
43
44
|
# `async` is a keyword, so the flag needs the functional TypedDict form.
|
|
44
45
|
_AsyncFlag = TypedDict("_AsyncFlag", {"async": bool})
|
|
45
46
|
|
|
46
|
-
class
|
|
47
|
+
class ManagedSubAgent(SubAgent):
|
|
48
|
+
"""A declarative subagent that can narrow this agent's MCP servers."""
|
|
49
|
+
|
|
50
|
+
mcp: NotRequired[McpSelection | None]
|
|
51
|
+
"""MCP servers whose tools this subagent gets, instead of this agent's.
|
|
52
|
+
|
|
53
|
+
Unset inherits this agent's MCP servers; `[]` or `None` gives it none.
|
|
54
|
+
A sync subagent may select only servers this agent loads; its own
|
|
55
|
+
`tools`, or this agent's non-MCP tools, are kept.
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
class ManagedAsyncSubAgent(ManagedSubAgent, _AsyncFlag):
|
|
47
59
|
"""A declarative subagent that MDA builds as its own graph."""
|
|
48
60
|
|
|
49
61
|
update_strategy: NotRequired[Literal["interrupt", "enqueue"]]
|
|
@@ -67,7 +79,9 @@ if TYPE_CHECKING:
|
|
|
67
79
|
|
|
68
80
|
#: Declarative, compiled, or async subagent specs from deepagents, plus
|
|
69
81
|
#: declarative specs marked `"async": True`.
|
|
70
|
-
DeepAgentSubAgent =
|
|
82
|
+
DeepAgentSubAgent = (
|
|
83
|
+
SubAgent | ManagedSubAgent | ManagedAsyncSubAgent | CompiledSubAgent | AsyncSubAgent
|
|
84
|
+
)
|
|
71
85
|
DeepAgentMiddleware = AgentMiddleware
|
|
72
86
|
DeepAgentInterruptOn = bool | InterruptOnConfig
|
|
73
87
|
DeepAgentResponseFormat = ResponseFormat[Any] | type[Any] | dict[str, Any]
|
|
@@ -156,6 +170,11 @@ def define_deep_agent(
|
|
|
156
170
|
of this agent's conversation, not only the task. Served agents also get a
|
|
157
171
|
background copy of the general-purpose subagent.
|
|
158
172
|
|
|
173
|
+
A declarative subagent's ``mcp`` narrows which MCP servers' tools it gets:
|
|
174
|
+
unset inherits this agent's, a list keeps only those servers, and ``[]`` or
|
|
175
|
+
``None`` keeps none. A sync subagent may select only servers this agent
|
|
176
|
+
loads, and a sync ``"mode": "fork"`` subagent cannot set it.
|
|
177
|
+
|
|
159
178
|
``metadata`` is MDA-owned authoring config (not a ``create_deep_agent``
|
|
160
179
|
kwarg): the runtime applies it via ``.with_config({"metadata": ...})`` so
|
|
161
180
|
keys such as prompt provenance land on the **root** LangSmith run.
|
|
@@ -181,6 +200,8 @@ def define_deep_agent(
|
|
|
181
200
|
if metadata is not None and not isinstance(metadata, Mapping):
|
|
182
201
|
raise TypeError("metadata must be a mapping")
|
|
183
202
|
_validate_async_subagents(subagents or ())
|
|
203
|
+
if subagents is not None:
|
|
204
|
+
subagents = cast("Sequence[DeepAgentSubAgent]", snapshot_subagent_mcp_selections(subagents))
|
|
184
205
|
|
|
185
206
|
config: dict[str, object] = {
|
|
186
207
|
"name": name,
|
managed_deepagents/runtime.py
CHANGED
|
@@ -16,7 +16,6 @@ import math
|
|
|
16
16
|
import os
|
|
17
17
|
import posixpath
|
|
18
18
|
import re
|
|
19
|
-
import secrets
|
|
20
19
|
import socket
|
|
21
20
|
import threading
|
|
22
21
|
import time
|
|
@@ -33,7 +32,6 @@ from collections.abc import (
|
|
|
33
32
|
from contextlib import asynccontextmanager, contextmanager, suppress
|
|
34
33
|
from contextvars import ContextVar
|
|
35
34
|
from dataclasses import dataclass
|
|
36
|
-
from functools import partial
|
|
37
35
|
from http import HTTPStatus
|
|
38
36
|
from pathlib import Path
|
|
39
37
|
from typing import TYPE_CHECKING, Any, Literal, TypedDict, TypeVar, cast
|
|
@@ -86,10 +84,12 @@ from managed_deepagents._channels.binding import resolve_channel_provider
|
|
|
86
84
|
from managed_deepagents._channels.messaging_registry import register_channel_messaging
|
|
87
85
|
from managed_deepagents._connector import (
|
|
88
86
|
Connector,
|
|
87
|
+
ConnectorToolList,
|
|
89
88
|
SandboxMode,
|
|
90
89
|
collect_connectors,
|
|
91
90
|
has_sandbox_connectors,
|
|
92
91
|
load_connector_tools,
|
|
92
|
+
load_tools_by_connector,
|
|
93
93
|
requirements_from_connectors,
|
|
94
94
|
run_connector_sandbox_hooks,
|
|
95
95
|
)
|
|
@@ -319,13 +319,9 @@ _SANDBOX_DIGEST_LENGTH = 12
|
|
|
319
319
|
|
|
320
320
|
#: Host sandbox-name limit.
|
|
321
321
|
_MAX_SANDBOX_NAME_LENGTH = 63
|
|
322
|
-
_SANDBOX_FALLBACK_SUFFIX_LENGTH = 9
|
|
323
322
|
_MAX_PRIMARY_DEPLOYMENT_COMPONENT_LENGTH = (
|
|
324
323
|
_MAX_SANDBOX_NAME_LENGTH - len(_SANDBOX_NAME_SEPARATOR) - _SANDBOX_DIGEST_LENGTH
|
|
325
324
|
)
|
|
326
|
-
_MAX_FALLBACK_DEPLOYMENT_COMPONENT_LENGTH = (
|
|
327
|
-
_MAX_PRIMARY_DEPLOYMENT_COMPONENT_LENGTH - _SANDBOX_FALLBACK_SUFFIX_LENGTH
|
|
328
|
-
)
|
|
329
325
|
_SANDBOX_DEPLOYMENT_DIGEST_LENGTH = 8
|
|
330
326
|
|
|
331
327
|
#: Sandbox statuses that can be adopted as-is.
|
|
@@ -334,6 +330,9 @@ _ADOPTABLE_SANDBOX_STATUS = frozenset({"ready", "running"})
|
|
|
334
330
|
#: Sandbox status for one that is stopped but restartable.
|
|
335
331
|
_STOPPED_SANDBOX_STATUS = "stopped"
|
|
336
332
|
|
|
333
|
+
#: Sandbox status for one still booting: adopted, then waited for until ready.
|
|
334
|
+
_PROVISIONING_SANDBOX_STATUS = "provisioning"
|
|
335
|
+
|
|
337
336
|
#: Create failures that mean the sandbox name is already taken.
|
|
338
337
|
_SANDBOX_NAME_CONFLICT_RE = re.compile(
|
|
339
338
|
r"409|conflict|already exists|already in use|duplicate", re.IGNORECASE
|
|
@@ -1146,15 +1145,27 @@ def _compile_managed_agent(
|
|
|
1146
1145
|
# Connectors: run each connector's ``tools`` hook and append the results to
|
|
1147
1146
|
# the authored tools. Connector tools keep identity injection, but do not
|
|
1148
1147
|
# receive the authored runtime backend API.
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1148
|
+
tools_by_connector = (
|
|
1149
|
+
timing.measure("connectors", lambda: load_tools_by_connector(connectors))
|
|
1150
|
+
if connectors and not skip_factory_inspection_tools
|
|
1151
|
+
else []
|
|
1152
|
+
)
|
|
1153
|
+
authored_tools = list(cast("Iterable[DeepAgentTool]", merged.get("tools") or ()))
|
|
1154
|
+
tools_by_connector = [
|
|
1155
|
+
(connector, wrap_tools_with_managed_runtime(tools) if identity is not None else tools)
|
|
1156
|
+
for connector, tools in tools_by_connector
|
|
1157
|
+
]
|
|
1158
|
+
if tools_by_connector:
|
|
1159
|
+
merged["tools"] = authored_tools + [
|
|
1160
|
+
tool for _, tools in tools_by_connector for tool in tools
|
|
1161
|
+
]
|
|
1162
|
+
if merged.get("subagents") is not None:
|
|
1163
|
+
merged["subagents"] = _scope_subagent_mcp_tools(
|
|
1164
|
+
cast("Sequence[object]", merged["subagents"]),
|
|
1165
|
+
connectors or [],
|
|
1166
|
+
authored_tools,
|
|
1167
|
+
tools_by_connector,
|
|
1153
1168
|
)
|
|
1154
|
-
connector_tools = timing.measure("connectors", lambda: load_connector_tools(connectors))
|
|
1155
|
-
if identity is not None:
|
|
1156
|
-
connector_tools = wrap_tools_with_managed_runtime(connector_tools)
|
|
1157
|
-
merged["tools"] = authored_tools + connector_tools
|
|
1158
1169
|
|
|
1159
1170
|
# Managed prompt behavior surrounds authored middleware in the same order as TS.
|
|
1160
1171
|
_append_channel_response_format_middleware(merged)
|
|
@@ -1221,6 +1232,38 @@ def _compile_managed_agent(
|
|
|
1221
1232
|
)
|
|
1222
1233
|
|
|
1223
1234
|
|
|
1235
|
+
def _scope_subagent_mcp_tools(
|
|
1236
|
+
subagents: Sequence[object],
|
|
1237
|
+
connectors: Sequence[Connector],
|
|
1238
|
+
authored_tools: list[DeepAgentTool],
|
|
1239
|
+
tools_by_connector: list[tuple[Connector, ConnectorToolList]],
|
|
1240
|
+
) -> Sequence[object]:
|
|
1241
|
+
"""Give each sync subagent with `mcp` only the tools of the MCP servers it selects."""
|
|
1242
|
+
if not any(isinstance(spec, Mapping) and "mcp" in spec for spec in subagents):
|
|
1243
|
+
return subagents
|
|
1244
|
+
loaded = {id(c) for c in connectors if c.kind == "mcp_servers"}
|
|
1245
|
+
non_mcp = [tool for c, tools in tools_by_connector if c.kind != "mcp_servers" for tool in tools]
|
|
1246
|
+
scoped: list[object] = []
|
|
1247
|
+
for spec in subagents:
|
|
1248
|
+
if not isinstance(spec, Mapping) or "mcp" not in spec:
|
|
1249
|
+
scoped.append(spec)
|
|
1250
|
+
continue
|
|
1251
|
+
selected = {id(definition) for definition in spec["mcp"] or ()}
|
|
1252
|
+
if not selected <= loaded:
|
|
1253
|
+
msg = f"subagent {spec.get('name')!r} selects an MCP server this agent does not load"
|
|
1254
|
+
raise ValueError(msg)
|
|
1255
|
+
own = (
|
|
1256
|
+
list(cast("Iterable[DeepAgentTool]", spec["tools"]))
|
|
1257
|
+
if "tools" in spec
|
|
1258
|
+
else authored_tools + non_mcp
|
|
1259
|
+
)
|
|
1260
|
+
mcp_tools = [tool for c, tools in tools_by_connector if id(c) in selected for tool in tools]
|
|
1261
|
+
scoped.append(
|
|
1262
|
+
{key: value for key, value in spec.items() if key != "mcp"} | {"tools": own + mcp_tools}
|
|
1263
|
+
)
|
|
1264
|
+
return scoped
|
|
1265
|
+
|
|
1266
|
+
|
|
1224
1267
|
def _count(value: object) -> int:
|
|
1225
1268
|
return len(value) if isinstance(value, Sized) else 0
|
|
1226
1269
|
|
|
@@ -2659,15 +2702,6 @@ def _managed_sandbox_lookup_names(
|
|
|
2659
2702
|
return list(dict.fromkeys(names))
|
|
2660
2703
|
|
|
2661
2704
|
|
|
2662
|
-
def _managed_sandbox_fallback_name(deployment: str, scope_key: str) -> str:
|
|
2663
|
-
base = _managed_sandbox_name_with_deployment_limit(
|
|
2664
|
-
deployment,
|
|
2665
|
-
scope_key,
|
|
2666
|
-
_MAX_FALLBACK_DEPLOYMENT_COMPONENT_LENGTH,
|
|
2667
|
-
)
|
|
2668
|
-
return f"{base}-{secrets.token_hex(4)}"
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
2705
|
def _managed_sandbox_name_with_deployment_limit(
|
|
2672
2706
|
deployment: str,
|
|
2673
2707
|
scope_key: str,
|
|
@@ -2687,33 +2721,41 @@ def _sandbox_deployment_component(deployment: str, max_length: int) -> str:
|
|
|
2687
2721
|
|
|
2688
2722
|
|
|
2689
2723
|
def _fetch_sandbox(client: LangSmithSandboxClient, name: str) -> Sandbox | None:
|
|
2690
|
-
"""Look up a sandbox by name
|
|
2724
|
+
"""Look up a sandbox by name; ``None`` only when LangSmith confirms it is not there.
|
|
2725
|
+
|
|
2726
|
+
Any other failure (a timeout, a 5xx) fails the open: the sandbox may still
|
|
2727
|
+
exist, and creating beside it would give the thread a second, empty one.
|
|
2728
|
+
"""
|
|
2691
2729
|
get_sandbox = getattr(client, "get_sandbox", None)
|
|
2692
2730
|
if not callable(get_sandbox):
|
|
2693
2731
|
return None
|
|
2694
2732
|
try:
|
|
2695
2733
|
return _await_if_needed(get_sandbox(name))
|
|
2696
|
-
except Exception
|
|
2697
|
-
|
|
2734
|
+
except Exception as error:
|
|
2735
|
+
if _is_sandbox_not_found_error(error):
|
|
2736
|
+
return None
|
|
2737
|
+
raise RuntimeError(f"Could not look up sandbox {name!r}; retry the run: {error}") from error
|
|
2698
2738
|
|
|
2699
2739
|
|
|
2700
|
-
def _restart_sandbox(client: LangSmithSandboxClient, name: str, stopped: Sandbox) -> Sandbox
|
|
2701
|
-
"""Start a stopped sandbox so it can be adopted;
|
|
2740
|
+
def _restart_sandbox(client: LangSmithSandboxClient, name: str, stopped: Sandbox) -> Sandbox:
|
|
2741
|
+
"""Start a stopped sandbox so it can be adopted; raises when that fails."""
|
|
2702
2742
|
start_sandbox = getattr(client, "start_sandbox", None)
|
|
2703
2743
|
if not callable(start_sandbox):
|
|
2704
|
-
|
|
2744
|
+
raise RuntimeError(f"Sandbox {name!r} is stopped and this client cannot start it")
|
|
2705
2745
|
try:
|
|
2706
2746
|
# Some SDK versions return nothing on success; it is the same sandbox.
|
|
2707
2747
|
return _await_if_needed(start_sandbox(name)) or stopped
|
|
2708
|
-
except Exception
|
|
2709
|
-
|
|
2748
|
+
except Exception as error:
|
|
2749
|
+
raise RuntimeError(
|
|
2750
|
+
f"Could not start stopped sandbox {name!r}; retry the run: {error}"
|
|
2751
|
+
) from error
|
|
2710
2752
|
|
|
2711
2753
|
|
|
2712
2754
|
def _adopt_sandbox(client: LangSmithSandboxClient, name: str) -> Sandbox | None:
|
|
2713
2755
|
"""Return the existing sandbox for ``name`` when usable, else ``None``.
|
|
2714
2756
|
|
|
2715
|
-
|
|
2716
|
-
|
|
2757
|
+
``None`` means nothing usable holds the name. A lookup or restart failure
|
|
2758
|
+
raises instead, so the open never creates a second sandbox for the thread.
|
|
2717
2759
|
"""
|
|
2718
2760
|
existing = _fetch_sandbox(client, name)
|
|
2719
2761
|
if existing is None:
|
|
@@ -2724,6 +2766,9 @@ def _adopt_sandbox(client: LangSmithSandboxClient, name: str) -> Sandbox | None:
|
|
|
2724
2766
|
# No status reported: assume the SDK handed back a usable sandbox.
|
|
2725
2767
|
if normalized is None or normalized in _ADOPTABLE_SANDBOX_STATUS:
|
|
2726
2768
|
return existing
|
|
2769
|
+
if normalized == _PROVISIONING_SANDBOX_STATUS:
|
|
2770
|
+
# Another container's create is still booting it. Raises if it fails to boot.
|
|
2771
|
+
return _await_if_needed(client.wait_for_sandbox(name))
|
|
2727
2772
|
if normalized == _STOPPED_SANDBOX_STATUS:
|
|
2728
2773
|
return _restart_sandbox(client, name, existing)
|
|
2729
2774
|
return None
|
|
@@ -2738,7 +2783,6 @@ def _resolve_sandbox_instance(
|
|
|
2738
2783
|
client: LangSmithSandboxClient,
|
|
2739
2784
|
create_kwargs: dict[str, object],
|
|
2740
2785
|
name: str | None,
|
|
2741
|
-
fallback_name: Callable[[], str] | None = None,
|
|
2742
2786
|
adopt_aliases: Iterable[str] = (),
|
|
2743
2787
|
) -> tuple[Sandbox, bool]:
|
|
2744
2788
|
"""Adopt this deployment's existing sandbox for ``name``, or create it.
|
|
@@ -2750,6 +2794,10 @@ def _resolve_sandbox_instance(
|
|
|
2750
2794
|
``adopt_aliases`` are 0.9.0 and 0.5.x names for this thread: reconnect a box that
|
|
2751
2795
|
already exists, never create under the old formula.
|
|
2752
2796
|
|
|
2797
|
+
Only a confirmed not-found lookup permits a create, and the create never falls
|
|
2798
|
+
back to another name: a second sandbox would hold none of the thread's work,
|
|
2799
|
+
and replicas could each cache a different one.
|
|
2800
|
+
|
|
2753
2801
|
Returns the sandbox and whether it was adopted rather than created.
|
|
2754
2802
|
"""
|
|
2755
2803
|
# Options are a validated bag of provider kwargs, not individually typed.
|
|
@@ -2772,18 +2820,15 @@ def _resolve_sandbox_instance(
|
|
|
2772
2820
|
except Exception as error:
|
|
2773
2821
|
if not _is_sandbox_name_conflict(error):
|
|
2774
2822
|
raise
|
|
2775
|
-
# Either a concurrent container won the create race
|
|
2776
|
-
# sandbox (failed, mid-delete)
|
|
2777
|
-
#
|
|
2778
|
-
if
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
created = _await_if_needed(create_sandbox(name=unique, **create_kwargs))
|
|
2785
|
-
_unblock_sandbox_name(name)
|
|
2786
|
-
return created, False
|
|
2823
|
+
# Either a concurrent container won the create race (its sandbox may
|
|
2824
|
+
# still be provisioning), or an unusable sandbox (failed, mid-delete)
|
|
2825
|
+
# still holds the name. Never adopt a name we just invalidated.
|
|
2826
|
+
winner = None if _sandbox_name_blocked(name) else _adopt_sandbox(client, name)
|
|
2827
|
+
if winner is None:
|
|
2828
|
+
raise RuntimeError(
|
|
2829
|
+
f"Sandbox name {name!r} is held by a sandbox that cannot be used; retry the run"
|
|
2830
|
+
) from error
|
|
2831
|
+
return winner, True
|
|
2787
2832
|
|
|
2788
2833
|
|
|
2789
2834
|
def _create_replacement_sandbox(
|
|
@@ -2825,9 +2870,6 @@ def _create_langsmith_sandbox(
|
|
|
2825
2870
|
else []
|
|
2826
2871
|
)
|
|
2827
2872
|
sandbox_name = recovery_name or (lookup_names[0] if lookup_names else None)
|
|
2828
|
-
fallback_name: Callable[[], str] | None = None
|
|
2829
|
-
if deployment:
|
|
2830
|
-
fallback_name = partial(_managed_sandbox_fallback_name, deployment, scope_key)
|
|
2831
2873
|
if existing_sandbox is not None:
|
|
2832
2874
|
langsmith_sandbox, adopted = existing_sandbox, True
|
|
2833
2875
|
elif recovery_name:
|
|
@@ -2836,7 +2878,7 @@ def _create_langsmith_sandbox(
|
|
|
2836
2878
|
)
|
|
2837
2879
|
else:
|
|
2838
2880
|
langsmith_sandbox, adopted = _resolve_sandbox_instance(
|
|
2839
|
-
client, create_kwargs, sandbox_name,
|
|
2881
|
+
client, create_kwargs, sandbox_name, lookup_names[1:]
|
|
2840
2882
|
)
|
|
2841
2883
|
host_name = _sandbox_handle_name(langsmith_sandbox) or sandbox_name
|
|
2842
2884
|
logger.info(
|
{managed_deepagents-0.10.2.dev2.dist-info → managed_deepagents-0.10.2.dev4.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: managed-deepagents
|
|
3
|
-
Version: 0.10.2.
|
|
3
|
+
Version: 0.10.2.dev4
|
|
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
|
{managed_deepagents-0.10.2.dev2.dist-info → managed_deepagents-0.10.2.dev4.dist-info}/RECORD
RENAMED
|
@@ -2,14 +2,14 @@ managed_deepagents/__init__.py,sha256=dFi9H9x6uIjewzw9leHOtwPFpYYgDlFxeEgMnRn-bT
|
|
|
2
2
|
managed_deepagents/__main__.py,sha256=GcjmqN0Ea5v8OHKMxYToasm3eCX_doSLOlpEzAi1tAw,67
|
|
3
3
|
managed_deepagents/_agent_auth.py,sha256=RrPCIXxCZWCJmsmH-qCugCwlBrIIOKD76siJQOp3ZcI,21573
|
|
4
4
|
managed_deepagents/_agent_auth_http.py,sha256=xJzhauBcgFchDKjKHY-GuVIhNEP9e0WIPqUqEXzOx8A,7306
|
|
5
|
-
managed_deepagents/_async_subagents.py,sha256=
|
|
5
|
+
managed_deepagents/_async_subagents.py,sha256=S8jS67-Mhp14hOUoKUA6pwbPJ-5-3VGpQX-p-YzC0BE,5968
|
|
6
6
|
managed_deepagents/_browser_recording.py,sha256=jkcxJfXVyaKUpjp6B9fR3qguMWHPevpQFhjsMkEF-pw,35810
|
|
7
7
|
managed_deepagents/_channel.py,sha256=EabaswVclNB129GyIQiTSCbbKM4_2H3J_mC2XyKpn-o,5853
|
|
8
8
|
managed_deepagents/_channel_icon.py,sha256=ECHCv1DWKpFKKTHzppSMVFq7gcdoK4udko04J-iWMVg,3691
|
|
9
9
|
managed_deepagents/_cli.py,sha256=jVaw2i1ysdRoWziMdPFmRXtKry_baYGRspyzyIeGWoU,1688
|
|
10
10
|
managed_deepagents/_connection_authorization.py,sha256=KiJuiv5bCcTrGm5clLe-eOKRi6EsnTOpc9PZG374Zr4,5490
|
|
11
11
|
managed_deepagents/_connections.py,sha256=BW4vTkPxJDasss-WoRJawcM-kU7OeYSzchHL4ovek70,25829
|
|
12
|
-
managed_deepagents/_connector.py,sha256=
|
|
12
|
+
managed_deepagents/_connector.py,sha256=s9FTVzs130NOhHYokBgQa6VWy47srUKp2lC56XoY9as,8620
|
|
13
13
|
managed_deepagents/_cors.py,sha256=WAlD_PgLFVAN1BAQaYU44DKctAJk4xQnFZ0I-9EwMng,7814
|
|
14
14
|
managed_deepagents/_credential_gate.py,sha256=uKPh1KM1qzc85jEaw-dduc-drmPSBU8UyjkrgZ8foMw,18702
|
|
15
15
|
managed_deepagents/_eval_filesystem.py,sha256=_oRR0CUzpO7XND2JkkNUZH63m5kwxmGcR7cfqfFO378,8768
|
|
@@ -25,7 +25,7 @@ managed_deepagents/_ingress_runs.py,sha256=CWIWMiTfwVvSew6k-8KN8BmInF0pxBjNSBY_Z
|
|
|
25
25
|
managed_deepagents/_langsmith_env.py,sha256=Ji7EnQ7fNtBwM8X2W223W8SvD0AIUp4eRoxCbPrtS-g,1885
|
|
26
26
|
managed_deepagents/_log.py,sha256=BLHZZzyxtt_2WoNgBJliygtpv51z0PKy5OtjeengRs4,4382
|
|
27
27
|
managed_deepagents/_loopback.py,sha256=Y0OOBhgLGGIXOklBu9hR00iioWFdK5Fn603FM-Vvirg,2900
|
|
28
|
-
managed_deepagents/_managed_composition.py,sha256=
|
|
28
|
+
managed_deepagents/_managed_composition.py,sha256=9GVH9Vl5YKx7lMx6Tz-ajastzl1NKyPqIcKCQqaNNGw,11435
|
|
29
29
|
managed_deepagents/_managed_middleware.py,sha256=xaylPReyfRGgvPZXhdw-j0qt8d9qR1YHKa8HD_-y6uA,10048
|
|
30
30
|
managed_deepagents/_managed_thread.py,sha256=P1ogidb2WnGlWpzUyOF6gzhiJOipDEhQ8idlFRiE8hQ,6504
|
|
31
31
|
managed_deepagents/_managed_tools.py,sha256=-Bept1PyQjVMcRKmS1wjyJdiCYFA2VJAUVdhX7cTBKo,12263
|
|
@@ -42,15 +42,15 @@ managed_deepagents/_validated_token.py,sha256=On96IOQTDz1KE_ZZmuTqY8IPw-cJ3J2tXk
|
|
|
42
42
|
managed_deepagents/agent_entry.py,sha256=C6UPWGzp57DlmcY6lJBVbI-8U_Rc5FjGzPBmSoD-O-c,553
|
|
43
43
|
managed_deepagents/browser.py,sha256=Ajt4QAcmiDdZi72taZQBSJmezK0PAH9f6UIlcBdk9Dk,59808
|
|
44
44
|
managed_deepagents/define_browser.py,sha256=FQKYVVRTDqSNGqG4Pzp1H6qngAsL1h0gOhu8bYxJ140,2000
|
|
45
|
-
managed_deepagents/define_deep_agent.py,sha256=
|
|
45
|
+
managed_deepagents/define_deep_agent.py,sha256=2qAet4dOn9lUYUSGE1QhoU86LCLZV_MMemLTKayMzfc,12253
|
|
46
46
|
managed_deepagents/define_memory.py,sha256=0DzI9jxr83YJ6mEhqXRbIYzgWpl259-PdAMoAQRQ3pU,6465
|
|
47
47
|
managed_deepagents/namespaces.py,sha256=qt41OhCK2mNEDuFwyQ0lkeT5bL0guzv9aRyK3Z-GbVg,4531
|
|
48
48
|
managed_deepagents/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
49
49
|
managed_deepagents/run_context.py,sha256=IayZdcpPrKVss70Hro8qI-EWtL94HZt4JKefzec9qds,3562
|
|
50
|
-
managed_deepagents/runtime.py,sha256=
|
|
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=
|
|
53
|
+
managed_deepagents/_binaries/mda.exe,sha256=HJCPllS9aWkC8hiq1pSdhe66uNo2Bf6P3SuncShuF4Y,4625408
|
|
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
56
|
managed_deepagents/_channels/assistant_text.py,sha256=-QMVt-XhFQu8Myy_Sr7H2rtGDpi_2F7nXG7xYew8_zA,8182
|
|
@@ -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.
|
|
155
|
-
managed_deepagents-0.10.2.
|
|
156
|
-
managed_deepagents-0.10.2.
|
|
157
|
-
managed_deepagents-0.10.2.
|
|
158
|
-
managed_deepagents-0.10.2.
|
|
159
|
-
managed_deepagents-0.10.2.
|
|
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=nsMwci5bxx8bECKQa2RSiiCei1K-_wt_6jOuAODuG5o,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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{managed_deepagents-0.10.2.dev2.dist-info → managed_deepagents-0.10.2.dev4.dist-info}/top_level.txt
RENAMED
|
File without changes
|