managed-deepagents 0.10.2.dev12__py3-none-win_amd64.whl → 0.10.2.dev13__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.
- managed_deepagents/__init__.py +4 -3
- managed_deepagents/_binaries/mda.exe +0 -0
- managed_deepagents/_managed_tools.py +25 -7
- managed_deepagents/runtime.py +140 -29
- managed_deepagents/sandbox.py +1 -27
- {managed_deepagents-0.10.2.dev12.dist-info → managed_deepagents-0.10.2.dev13.dist-info}/METADATA +4 -3
- {managed_deepagents-0.10.2.dev12.dist-info → managed_deepagents-0.10.2.dev13.dist-info}/RECORD +11 -11
- {managed_deepagents-0.10.2.dev12.dist-info → managed_deepagents-0.10.2.dev13.dist-info}/WHEEL +0 -0
- {managed_deepagents-0.10.2.dev12.dist-info → managed_deepagents-0.10.2.dev13.dist-info}/entry_points.txt +0 -0
- {managed_deepagents-0.10.2.dev12.dist-info → managed_deepagents-0.10.2.dev13.dist-info}/licenses/LICENSE +0 -0
- {managed_deepagents-0.10.2.dev12.dist-info → managed_deepagents-0.10.2.dev13.dist-info}/top_level.txt +0 -0
managed_deepagents/__init__.py
CHANGED
|
@@ -163,6 +163,7 @@ if TYPE_CHECKING:
|
|
|
163
163
|
from managed_deepagents._managed_tools import (
|
|
164
164
|
ManagedDeepAgentRuntime,
|
|
165
165
|
ManagedRuntime,
|
|
166
|
+
ManagedSandboxBackend,
|
|
166
167
|
ManagedServerRuntime,
|
|
167
168
|
ManagedToolRuntime,
|
|
168
169
|
)
|
|
@@ -208,7 +209,7 @@ if TYPE_CHECKING:
|
|
|
208
209
|
PromptResponse,
|
|
209
210
|
SlackPromptResponse,
|
|
210
211
|
)
|
|
211
|
-
from managed_deepagents.sandbox import SandboxDefinition, basic, bearer
|
|
212
|
+
from managed_deepagents.sandbox import SandboxDefinition, basic, bearer
|
|
212
213
|
from managed_deepagents.schedules import define_schedule
|
|
213
214
|
|
|
214
215
|
# Each export loads on first use (PEP 562), so a service that only needs the
|
|
@@ -308,6 +309,7 @@ _EXPORTS: dict[str, str] = {
|
|
|
308
309
|
"ManagedDeepAgentRuntime": "managed_deepagents._managed_tools",
|
|
309
310
|
"ManagedRunContext": "managed_deepagents.run_context",
|
|
310
311
|
"ManagedRuntime": "managed_deepagents._managed_tools",
|
|
312
|
+
"ManagedSandboxBackend": "managed_deepagents._managed_tools",
|
|
311
313
|
"ManagedServerInfo": "managed_deepagents.identity",
|
|
312
314
|
"ManagedServerRuntime": "managed_deepagents._managed_tools",
|
|
313
315
|
"ManagedThread": "managed_deepagents._managed_thread",
|
|
@@ -371,7 +373,6 @@ _EXPORTS: dict[str, str] = {
|
|
|
371
373
|
"define_memory": "managed_deepagents.define_memory",
|
|
372
374
|
"define_sandbox": "managed_deepagents.namespaces",
|
|
373
375
|
"define_schedule": "managed_deepagents.schedules",
|
|
374
|
-
"open_sandbox": "managed_deepagents.sandbox",
|
|
375
376
|
"schedules": "managed_deepagents._runtime_schedules",
|
|
376
377
|
}
|
|
377
378
|
|
|
@@ -513,6 +514,7 @@ __all__ = [
|
|
|
513
514
|
"ManagedDeepAgentRuntime",
|
|
514
515
|
"ManagedRunContext",
|
|
515
516
|
"ManagedRuntime",
|
|
517
|
+
"ManagedSandboxBackend",
|
|
516
518
|
"ManagedServerInfo",
|
|
517
519
|
"ManagedServerRuntime",
|
|
518
520
|
"ManagedThread",
|
|
@@ -576,6 +578,5 @@ __all__ = [
|
|
|
576
578
|
"define_memory",
|
|
577
579
|
"define_sandbox",
|
|
578
580
|
"define_schedule",
|
|
579
|
-
"open_sandbox",
|
|
580
581
|
"schedules",
|
|
581
582
|
]
|
|
Binary file
|
|
@@ -6,6 +6,7 @@ into a ManagedToolRuntime before it calls authored code.
|
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
|
+
import abc
|
|
9
10
|
import functools
|
|
10
11
|
from collections.abc import Awaitable, Callable, Mapping, Sequence
|
|
11
12
|
from dataclasses import dataclass, field, fields
|
|
@@ -20,7 +21,7 @@ from typing import (
|
|
|
20
21
|
overload,
|
|
21
22
|
)
|
|
22
23
|
|
|
23
|
-
from deepagents.backends.protocol import
|
|
24
|
+
from deepagents.backends.protocol import SandboxBackendProtocol
|
|
24
25
|
from langchain.tools import ToolRuntime
|
|
25
26
|
from langchain_core.runnables import RunnableConfig
|
|
26
27
|
from langchain_core.tools import InjectedToolArg
|
|
@@ -45,7 +46,24 @@ from managed_deepagents.identity import ManagedServerInfo # noqa: TC001 - datac
|
|
|
45
46
|
if TYPE_CHECKING:
|
|
46
47
|
from managed_deepagents.define_deep_agent import DeepAgentTool
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
|
|
50
|
+
class ManagedSandboxBackend(SandboxBackendProtocol):
|
|
51
|
+
"""The run's managed sandbox, as ``runtime.backend``."""
|
|
52
|
+
|
|
53
|
+
@abc.abstractmethod
|
|
54
|
+
async def aopen(self, *, wait: bool = True) -> str:
|
|
55
|
+
"""Adopt or create this thread's sandbox now and return its name.
|
|
56
|
+
|
|
57
|
+
Without this call, the sandbox opens on its first use.
|
|
58
|
+
|
|
59
|
+
With ``wait=False``, return as soon as the sandbox is created or adopted,
|
|
60
|
+
while it may still be booting. Its first use waits for it to be ready, then
|
|
61
|
+
runs the connectors' sandbox hooks. A stopped sandbox still restarts before
|
|
62
|
+
this returns, because LangSmith's start always waits for it to be ready.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
RuntimeBackendFactory = Callable[[object], ManagedSandboxBackend | None]
|
|
49
67
|
|
|
50
68
|
|
|
51
69
|
_ContextT = DefaultTypeVar("_ContextT", default=Any)
|
|
@@ -61,7 +79,7 @@ class ManagedRuntimeExtras(TypedDict, total=False):
|
|
|
61
79
|
channel: RuntimeChannel | None
|
|
62
80
|
configurable: Mapping[str, object]
|
|
63
81
|
config: RunnableConfig
|
|
64
|
-
backend:
|
|
82
|
+
backend: ManagedSandboxBackend | None
|
|
65
83
|
schedules: RuntimeSchedules
|
|
66
84
|
|
|
67
85
|
|
|
@@ -74,7 +92,7 @@ class ManagedRuntime(Runtime[ContextT], Generic[ContextT]): # ty: ignore[invali
|
|
|
74
92
|
thread: ManagedThread = field(default_factory=no_thread)
|
|
75
93
|
#: Deprecated: use ``runtime.thread.origin.channel``. Removed in 0.11.
|
|
76
94
|
channel: RuntimeChannel | None = None
|
|
77
|
-
backend:
|
|
95
|
+
backend: ManagedSandboxBackend | None = None
|
|
78
96
|
schedules: RuntimeSchedules = field(default_factory=RuntimeSchedules)
|
|
79
97
|
|
|
80
98
|
|
|
@@ -86,7 +104,7 @@ class ManagedToolRuntime(ToolRuntime[_ContextT, _StateT], Generic[_ContextT, _St
|
|
|
86
104
|
thread: ManagedThread = field(default_factory=no_thread)
|
|
87
105
|
#: Deprecated: use ``runtime.thread.origin.channel``. Removed in 0.11.
|
|
88
106
|
channel: RuntimeChannel | None = None
|
|
89
|
-
backend:
|
|
107
|
+
backend: ManagedSandboxBackend | None = None
|
|
90
108
|
schedules: RuntimeSchedules = field(default_factory=RuntimeSchedules)
|
|
91
109
|
|
|
92
110
|
@classmethod
|
|
@@ -112,7 +130,7 @@ class _ManagedExecutionRuntime(_ExecutionRuntime[_AppContextT | None], Generic[_
|
|
|
112
130
|
thread: ManagedThread = field(default_factory=no_thread)
|
|
113
131
|
#: Deprecated: use ``runtime.thread.origin.channel``. Removed in 0.11.
|
|
114
132
|
channel: RuntimeChannel | None = None
|
|
115
|
-
backend:
|
|
133
|
+
backend: ManagedSandboxBackend | None = None
|
|
116
134
|
|
|
117
135
|
|
|
118
136
|
@dataclass(frozen=True, slots=True, kw_only=True)
|
|
@@ -121,7 +139,7 @@ class _ManagedReadRuntime(_ReadRuntime[_AppContextT | None], Generic[_AppContext
|
|
|
121
139
|
thread: None = None
|
|
122
140
|
#: Deprecated: use ``runtime.thread.origin.channel``. Removed in 0.11.
|
|
123
141
|
channel: RuntimeChannel | None = None
|
|
124
|
-
backend:
|
|
142
|
+
backend: ManagedSandboxBackend | None = None
|
|
125
143
|
|
|
126
144
|
|
|
127
145
|
ManagedServerRuntime = _ManagedExecutionRuntime[_AppContextT] | _ManagedReadRuntime[_AppContextT]
|
managed_deepagents/runtime.py
CHANGED
|
@@ -115,6 +115,7 @@ from managed_deepagents._managed_composition import (
|
|
|
115
115
|
)
|
|
116
116
|
from managed_deepagents._managed_middleware import wrap_middleware_with_managed_runtime
|
|
117
117
|
from managed_deepagents._managed_tools import (
|
|
118
|
+
ManagedSandboxBackend,
|
|
118
119
|
ManagedServerRuntime,
|
|
119
120
|
_ManagedExecutionRuntime,
|
|
120
121
|
_ManagedReadRuntime,
|
|
@@ -330,7 +331,7 @@ _ADOPTABLE_SANDBOX_STATUS = frozenset({"ready", "running"})
|
|
|
330
331
|
#: Sandbox status for one that is stopped but restartable.
|
|
331
332
|
_STOPPED_SANDBOX_STATUS = "stopped"
|
|
332
333
|
|
|
333
|
-
#: Sandbox status for one still booting: adopted,
|
|
334
|
+
#: Sandbox status for one still booting: adopted, and waited for on first use.
|
|
334
335
|
_PROVISIONING_SANDBOX_STATUS = "provisioning"
|
|
335
336
|
|
|
336
337
|
#: Create failures that mean the sandbox name is already taken.
|
|
@@ -360,11 +361,33 @@ class _ManagedSandboxEntry:
|
|
|
360
361
|
self.selection_fingerprint = selection_fingerprint
|
|
361
362
|
|
|
362
363
|
|
|
364
|
+
class _SandboxClaim:
|
|
365
|
+
"""A sandbox adopted or created, but maybe still booting and not yet used."""
|
|
366
|
+
|
|
367
|
+
__slots__ = ("adopted", "client", "host_name", "sandbox")
|
|
368
|
+
|
|
369
|
+
def __init__(
|
|
370
|
+
self,
|
|
371
|
+
client: LangSmithSandboxClient,
|
|
372
|
+
sandbox: Sandbox,
|
|
373
|
+
*,
|
|
374
|
+
adopted: bool,
|
|
375
|
+
host_name: str | None,
|
|
376
|
+
) -> None:
|
|
377
|
+
self.client = client
|
|
378
|
+
self.sandbox = sandbox
|
|
379
|
+
self.adopted = adopted
|
|
380
|
+
self.host_name = host_name
|
|
381
|
+
|
|
382
|
+
|
|
363
383
|
#: Created sandboxes, keyed by thread and any dynamic selection's mounts,
|
|
364
384
|
#: reused for the lifetime of this runtime process. Storing the entry dedupes
|
|
365
385
|
#: concurrent runs. Provisioning (``setup.sh``) happens at deploy bake, not on
|
|
366
386
|
#: thread create.
|
|
367
387
|
_managed_sandboxes: dict[str, _ManagedSandboxEntry] = {}
|
|
388
|
+
#: Sandboxes ``runtime.backend.aopen(wait=False)`` claimed, by the same key, until their
|
|
389
|
+
#: first use waits for them to boot and moves them to ``_managed_sandboxes``.
|
|
390
|
+
_claimed_sandboxes: dict[str, _SandboxClaim] = {}
|
|
368
391
|
#: Host box names that must not be re-adopted after invalidate until a fresh
|
|
369
392
|
#: create claims them (or a unique suffix replaces them). Covers delete lag.
|
|
370
393
|
_invalidated_sandbox_names: set[str] = set()
|
|
@@ -1880,7 +1903,7 @@ class _LazySandboxSource:
|
|
|
1880
1903
|
self.proxy_config_sync = proxy_config_sync
|
|
1881
1904
|
|
|
1882
1905
|
|
|
1883
|
-
class _LazyManagedSandboxBackend(
|
|
1906
|
+
class _LazyManagedSandboxBackend(ManagedSandboxBackend):
|
|
1884
1907
|
"""Lazy sandbox backend with frozen per-instance ``configurable``.
|
|
1885
1908
|
|
|
1886
1909
|
Construct unbound (``None``) for static mounts, or call ``bind_runtime`` so
|
|
@@ -2052,9 +2075,16 @@ class _LazyManagedSandboxBackend(SandboxBackendProtocol):
|
|
|
2052
2075
|
except TypeError:
|
|
2053
2076
|
return await self._acall(lambda backend: backend.aexecute(command), execute=True)
|
|
2054
2077
|
|
|
2055
|
-
async def aopen(self) -> str:
|
|
2078
|
+
async def aopen(self, *, wait: bool = True) -> str:
|
|
2056
2079
|
"""Adopt or create this thread's sandbox now, as its first use would; return its name."""
|
|
2057
|
-
|
|
2080
|
+
if wait or self._resolved_backend is not None:
|
|
2081
|
+
return (await self._abackend()).id
|
|
2082
|
+
source = self._source
|
|
2083
|
+
name = await asyncio.to_thread(
|
|
2084
|
+
_claim_managed_sandbox, source.sandbox, self._config(), source.selection
|
|
2085
|
+
)
|
|
2086
|
+
# A sandbox handle without a name only tells its name once it is ready.
|
|
2087
|
+
return name if name is not None else (await self._abackend()).id
|
|
2058
2088
|
|
|
2059
2089
|
def _config(self) -> ManagedRunConfig | None:
|
|
2060
2090
|
return _effective_sandbox_run_config(
|
|
@@ -2286,6 +2316,9 @@ def _resolve_managed_sandbox(
|
|
|
2286
2316
|
# lead's sandbox only refreshes credentials; one whose lead hasn't
|
|
2287
2317
|
# created it yet creates it under the lead's scope for the lead to adopt.
|
|
2288
2318
|
helper = _parent_sandbox_scope(config, selection) is not None
|
|
2319
|
+
with _managed_sandbox_lock:
|
|
2320
|
+
# A claimed sandbox that fails to boot is claimed afresh by the next use.
|
|
2321
|
+
claim = _claimed_sandboxes.pop(key, None)
|
|
2289
2322
|
backend, host_name, sandbox_id = _create_langsmith_sandbox(
|
|
2290
2323
|
sandbox,
|
|
2291
2324
|
config=config,
|
|
@@ -2295,6 +2328,7 @@ def _resolve_managed_sandbox(
|
|
|
2295
2328
|
adopted_mode="credentials" if helper else "reuse",
|
|
2296
2329
|
scope_key=key,
|
|
2297
2330
|
selection=selection,
|
|
2331
|
+
claim=claim,
|
|
2298
2332
|
)
|
|
2299
2333
|
entry = _ManagedSandboxEntry(
|
|
2300
2334
|
backend,
|
|
@@ -2308,6 +2342,32 @@ def _resolve_managed_sandbox(
|
|
|
2308
2342
|
return entry.backend
|
|
2309
2343
|
|
|
2310
2344
|
|
|
2345
|
+
def _claim_managed_sandbox(
|
|
2346
|
+
sandbox: SandboxDefinition,
|
|
2347
|
+
config: ManagedRunConfig | None,
|
|
2348
|
+
selection: _SandboxSelection | None = None,
|
|
2349
|
+
) -> str | None:
|
|
2350
|
+
"""Adopt the per-thread sandbox, or create it without waiting for it to boot; its name.
|
|
2351
|
+
|
|
2352
|
+
``_resolve_managed_sandbox`` waits for the sandbox, and runs the connectors'
|
|
2353
|
+
hooks, on its first use.
|
|
2354
|
+
"""
|
|
2355
|
+
key = _thread_scope_key(config, selection)
|
|
2356
|
+
with _sandbox_key_lock(key):
|
|
2357
|
+
with _managed_sandbox_lock:
|
|
2358
|
+
entry = _managed_sandboxes.get(key)
|
|
2359
|
+
claim = _claimed_sandboxes.get(key)
|
|
2360
|
+
if entry is not None:
|
|
2361
|
+
return entry.host_name or entry.backend.id
|
|
2362
|
+
if claim is None:
|
|
2363
|
+
claim = _claim_langsmith_sandbox(
|
|
2364
|
+
sandbox, config=config, scope_key=key, selection=selection, wait=False
|
|
2365
|
+
)
|
|
2366
|
+
with _managed_sandbox_lock:
|
|
2367
|
+
_claimed_sandboxes[key] = claim
|
|
2368
|
+
return claim.host_name
|
|
2369
|
+
|
|
2370
|
+
|
|
2311
2371
|
def _is_sandbox_not_found_error(error: Exception) -> bool:
|
|
2312
2372
|
from langsmith.sandbox import ResourceNotFoundError, SandboxConnectionError # noqa: PLC0415
|
|
2313
2373
|
|
|
@@ -2767,12 +2827,14 @@ def _adopt_sandbox(client: LangSmithSandboxClient, name: str) -> Sandbox | None:
|
|
|
2767
2827
|
|
|
2768
2828
|
status = _string_option(getattr(existing, "status", None))
|
|
2769
2829
|
normalized = status.lower() if status else None
|
|
2770
|
-
# No status reported: assume the SDK handed back a usable sandbox.
|
|
2771
|
-
|
|
2830
|
+
# No status reported: assume the SDK handed back a usable sandbox. One still
|
|
2831
|
+
# provisioning is another create's; ``_ready_sandbox`` waits for it to boot.
|
|
2832
|
+
if (
|
|
2833
|
+
normalized is None
|
|
2834
|
+
or normalized in _ADOPTABLE_SANDBOX_STATUS
|
|
2835
|
+
or normalized == _PROVISIONING_SANDBOX_STATUS
|
|
2836
|
+
):
|
|
2772
2837
|
return existing
|
|
2773
|
-
if normalized == _PROVISIONING_SANDBOX_STATUS:
|
|
2774
|
-
# Another container's create is still booting it. Raises if it fails to boot.
|
|
2775
|
-
return _await_if_needed(client.wait_for_sandbox(name))
|
|
2776
2838
|
if normalized == _STOPPED_SANDBOX_STATUS:
|
|
2777
2839
|
return _restart_sandbox(client, name, existing)
|
|
2778
2840
|
return None
|
|
@@ -2851,6 +2913,16 @@ def _create_replacement_sandbox(
|
|
|
2851
2913
|
return _await_if_needed(client.get_sandbox(name)), True
|
|
2852
2914
|
|
|
2853
2915
|
|
|
2916
|
+
def _ready_sandbox(claim: _SandboxClaim) -> Sandbox:
|
|
2917
|
+
"""The claimed sandbox once it has booted; raises if it fails to boot."""
|
|
2918
|
+
sandbox = claim.sandbox
|
|
2919
|
+
status = _string_option(getattr(sandbox, "status", None))
|
|
2920
|
+
name = _sandbox_handle_name(sandbox) or claim.host_name
|
|
2921
|
+
if status is None or status.lower() != _PROVISIONING_SANDBOX_STATUS or name is None:
|
|
2922
|
+
return sandbox
|
|
2923
|
+
return _await_if_needed(claim.client.wait_for_sandbox(name))
|
|
2924
|
+
|
|
2925
|
+
|
|
2854
2926
|
def _create_langsmith_sandbox(
|
|
2855
2927
|
sandbox: SandboxDefinition,
|
|
2856
2928
|
*,
|
|
@@ -2863,28 +2935,24 @@ def _create_langsmith_sandbox(
|
|
|
2863
2935
|
selection: _SandboxSelection | None = None,
|
|
2864
2936
|
recovery_name: str | None = None,
|
|
2865
2937
|
existing_sandbox: Sandbox | None = None,
|
|
2938
|
+
claim: _SandboxClaim | None = None,
|
|
2866
2939
|
) -> tuple[SandboxBackendProtocol, str | None, str | None]:
|
|
2867
|
-
"""Build a LangSmith sandbox, optionally from the baked recipe, and wrap it.
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
elif recovery_name:
|
|
2880
|
-
langsmith_sandbox, adopted = _create_replacement_sandbox(
|
|
2881
|
-
client, create_kwargs, recovery_name
|
|
2882
|
-
)
|
|
2883
|
-
else:
|
|
2884
|
-
langsmith_sandbox, adopted = _resolve_sandbox_instance(
|
|
2885
|
-
client, create_kwargs, sandbox_name, lookup_names[1:]
|
|
2940
|
+
"""Build a LangSmith sandbox, optionally from the baked recipe, and wrap it.
|
|
2941
|
+
|
|
2942
|
+
A ``claim`` already adopted or created the sandbox; it is waited for here.
|
|
2943
|
+
"""
|
|
2944
|
+
if claim is None:
|
|
2945
|
+
claim = _claim_langsmith_sandbox(
|
|
2946
|
+
sandbox,
|
|
2947
|
+
config=config,
|
|
2948
|
+
scope_key=scope_key,
|
|
2949
|
+
selection=selection,
|
|
2950
|
+
recovery_name=recovery_name,
|
|
2951
|
+
existing_sandbox=existing_sandbox,
|
|
2886
2952
|
)
|
|
2887
|
-
|
|
2953
|
+
langsmith_sandbox = _ready_sandbox(claim)
|
|
2954
|
+
adopted = claim.adopted
|
|
2955
|
+
host_name = _sandbox_handle_name(langsmith_sandbox) or claim.host_name
|
|
2888
2956
|
logger.info(
|
|
2889
2957
|
"sandbox resolve: %s name=%r id=%r scope=%r",
|
|
2890
2958
|
"adopted" if adopted else "created",
|
|
@@ -2913,6 +2981,49 @@ def _create_langsmith_sandbox(
|
|
|
2913
2981
|
return resolved, host_name, _sandbox_handle_id(langsmith_sandbox)
|
|
2914
2982
|
|
|
2915
2983
|
|
|
2984
|
+
def _claim_langsmith_sandbox(
|
|
2985
|
+
sandbox: SandboxDefinition,
|
|
2986
|
+
*,
|
|
2987
|
+
config: ManagedRunConfig | None,
|
|
2988
|
+
scope_key: str,
|
|
2989
|
+
selection: _SandboxSelection | None,
|
|
2990
|
+
recovery_name: str | None = None,
|
|
2991
|
+
existing_sandbox: Sandbox | None = None,
|
|
2992
|
+
wait: bool = True,
|
|
2993
|
+
) -> _SandboxClaim:
|
|
2994
|
+
"""Adopt this scope's LangSmith sandbox or create it; without ``wait``, before it boots.
|
|
2995
|
+
|
|
2996
|
+
A stopped sandbox still restarts here and waits: the SDK's start always waits.
|
|
2997
|
+
"""
|
|
2998
|
+
create_kwargs = _sandbox_create_kwargs(sandbox, selection)
|
|
2999
|
+
if not wait:
|
|
3000
|
+
create_kwargs["wait_for_ready"] = False
|
|
3001
|
+
client = _sandbox_client_for(sandbox)
|
|
3002
|
+
deployment = _managed_deployment_name()
|
|
3003
|
+
lookup_names = (
|
|
3004
|
+
_managed_sandbox_lookup_names(deployment, scope_key, sandbox, config, selection)
|
|
3005
|
+
if deployment
|
|
3006
|
+
else []
|
|
3007
|
+
)
|
|
3008
|
+
sandbox_name = recovery_name or (lookup_names[0] if lookup_names else None)
|
|
3009
|
+
if existing_sandbox is not None:
|
|
3010
|
+
langsmith_sandbox, adopted = existing_sandbox, True
|
|
3011
|
+
elif recovery_name:
|
|
3012
|
+
langsmith_sandbox, adopted = _create_replacement_sandbox(
|
|
3013
|
+
client, create_kwargs, recovery_name
|
|
3014
|
+
)
|
|
3015
|
+
else:
|
|
3016
|
+
langsmith_sandbox, adopted = _resolve_sandbox_instance(
|
|
3017
|
+
client, create_kwargs, sandbox_name, lookup_names[1:]
|
|
3018
|
+
)
|
|
3019
|
+
return _SandboxClaim(
|
|
3020
|
+
client,
|
|
3021
|
+
langsmith_sandbox,
|
|
3022
|
+
adopted=adopted,
|
|
3023
|
+
host_name=_sandbox_handle_name(langsmith_sandbox) or sandbox_name,
|
|
3024
|
+
)
|
|
3025
|
+
|
|
3026
|
+
|
|
2916
3027
|
def _string_option(value: object) -> str | None:
|
|
2917
3028
|
if isinstance(value, str) and value.strip():
|
|
2918
3029
|
return value.strip()
|
managed_deepagents/sandbox.py
CHANGED
|
@@ -7,13 +7,10 @@ resolution, per-thread reuse, deploy-time snapshot bake, and lifecycle.
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
from dataclasses import dataclass
|
|
10
|
-
from typing import
|
|
10
|
+
from typing import ClassVar, Literal, TypedDict
|
|
11
11
|
|
|
12
12
|
from managed_deepagents._connections import ConnectionReference, is_connection_reference
|
|
13
13
|
|
|
14
|
-
if TYPE_CHECKING:
|
|
15
|
-
from managed_deepagents.runtime import _LazyManagedSandboxBackend
|
|
16
|
-
|
|
17
14
|
|
|
18
15
|
@dataclass(frozen=True, repr=False)
|
|
19
16
|
class ConnectionHeader:
|
|
@@ -135,28 +132,6 @@ def normalize_sandbox_options(options: dict[str, object]) -> dict[str, object]:
|
|
|
135
132
|
return normalized
|
|
136
133
|
|
|
137
134
|
|
|
138
|
-
async def open_sandbox(backend: object) -> str:
|
|
139
|
-
"""Adopt or create the run's managed sandbox now and return its name.
|
|
140
|
-
|
|
141
|
-
``backend`` is ``runtime.backend``. Without this call, the sandbox opens on
|
|
142
|
-
its first use.
|
|
143
|
-
"""
|
|
144
|
-
return await _managed_sandbox(backend).aopen()
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def _managed_sandbox(backend: object) -> _LazyManagedSandboxBackend:
|
|
148
|
-
"""The run's managed sandbox behind ``runtime.backend``, which tools may see composited."""
|
|
149
|
-
from deepagents.backends import CompositeBackend # noqa: PLC0415
|
|
150
|
-
|
|
151
|
-
from managed_deepagents.runtime import _LazyManagedSandboxBackend # noqa: PLC0415
|
|
152
|
-
|
|
153
|
-
while isinstance(backend, CompositeBackend):
|
|
154
|
-
backend = backend.default
|
|
155
|
-
if not isinstance(backend, _LazyManagedSandboxBackend):
|
|
156
|
-
raise TypeError("This run has no managed sandbox")
|
|
157
|
-
return backend
|
|
158
|
-
|
|
159
|
-
|
|
160
135
|
__all__ = [
|
|
161
136
|
"ConnectionHeader",
|
|
162
137
|
"ProxyAccessControl",
|
|
@@ -167,5 +142,4 @@ __all__ = [
|
|
|
167
142
|
"basic",
|
|
168
143
|
"bearer",
|
|
169
144
|
"normalize_sandbox_options",
|
|
170
|
-
"open_sandbox",
|
|
171
145
|
]
|
{managed_deepagents-0.10.2.dev12.dist-info → managed_deepagents-0.10.2.dev13.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.dev13
|
|
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
|
|
@@ -1746,8 +1746,9 @@ Python also has async methods such as `aread`, `awrite`, and `adelete`.
|
|
|
1746
1746
|
All paths refer to the current sandbox. Context Hub routes for skills and
|
|
1747
1747
|
memory are not part of this backend.
|
|
1748
1748
|
|
|
1749
|
-
The sandbox opens on its first use. `
|
|
1750
|
-
now and returns its name.
|
|
1749
|
+
The sandbox opens on its first use. `await runtime.backend.aopen()` opens it
|
|
1750
|
+
now and returns its name. With `wait=False` it returns the name before the
|
|
1751
|
+
sandbox boots; the first use waits for it.
|
|
1751
1752
|
|
|
1752
1753
|
Private published images can declare registry credentials by environment
|
|
1753
1754
|
variable name; MDA creates or updates the deployment-owned Host registry:
|
{managed_deepagents-0.10.2.dev12.dist-info → managed_deepagents-0.10.2.dev13.dist-info}/RECORD
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
managed_deepagents/__init__.py,sha256=
|
|
1
|
+
managed_deepagents/__init__.py,sha256=ja2gA4Ff7zHrU2sRQfN-EvN5jiVerxV0Id9fuZ4WjGk,22692
|
|
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
|
|
@@ -28,7 +28,7 @@ managed_deepagents/_loopback.py,sha256=Y0OOBhgLGGIXOklBu9hR00iioWFdK5Fn603FM-Vvi
|
|
|
28
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
|
-
managed_deepagents/_managed_tools.py,sha256
|
|
31
|
+
managed_deepagents/_managed_tools.py,sha256=77ShVQoelQW9M5Ir1r2AiX7ItrrHTX6LzRBVa21m4i0,12997
|
|
32
32
|
managed_deepagents/_memory_instructions.py,sha256=XZoasRUgAgN7PgL1VpwmhajajznIZ2zlhss7JrMJZv4,6876
|
|
33
33
|
managed_deepagents/_run_input.py,sha256=Nn_4E2hk9bNFh7q54mPmWvTLSyUOgHYt4VFF6C3GWA8,16656
|
|
34
34
|
managed_deepagents/_runtime_schedules.py,sha256=EDYtFxpbj4jZjV5-1mgWZn598g86NsgvsC_pEa2rGKk,30377
|
|
@@ -47,10 +47,10 @@ managed_deepagents/define_memory.py,sha256=0DzI9jxr83YJ6mEhqXRbIYzgWpl259-PdAMoA
|
|
|
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=
|
|
51
|
-
managed_deepagents/sandbox.py,sha256=
|
|
50
|
+
managed_deepagents/runtime.py,sha256=lZkVQ1b7NSNbQbCa1kT6fFz_qQgw9TYUUioJF5-6Gok,118136
|
|
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=OHP3geo_qGTzkrzzdV4nnjZa-JRx73Hl0OpmuA0uHz4,5123584
|
|
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=nf00-KJXNev-e_TkAK_8SBI3J9TiOis1GkGV_zT5048,8472
|
|
@@ -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.dev13.dist-info/licenses/LICENSE,sha256=WnPZQQ608ojZUkXl7BW6VbKloIAibZiGm1K6cjeZOL8,1066
|
|
155
|
+
managed_deepagents-0.10.2.dev13.dist-info/METADATA,sha256=LVxuJpkchJxlDGUVwKBKBcmIpy1RbWq7n-atjFsn-dc,93663
|
|
156
|
+
managed_deepagents-0.10.2.dev13.dist-info/WHEEL,sha256=bhMFZwp6VMtrbl2Ck6PlXryKaCggO1NzYn_HcFbBF1I,97
|
|
157
|
+
managed_deepagents-0.10.2.dev13.dist-info/entry_points.txt,sha256=ziZqkKuaDO3qHCjKmBhrx9cm3ok8bZ9xcEDpUTj4unM,53
|
|
158
|
+
managed_deepagents-0.10.2.dev13.dist-info/top_level.txt,sha256=fdBo4O0Hlol_w022tTLB5ftZpamb4yJoQ3MUvjgTGfA,19
|
|
159
|
+
managed_deepagents-0.10.2.dev13.dist-info/RECORD,,
|
{managed_deepagents-0.10.2.dev12.dist-info → managed_deepagents-0.10.2.dev13.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|