managed-deepagents 0.10.2.dev1__py3-none-win_amd64.whl → 0.10.2.dev3__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/_binaries/mda.exe +0 -0
- managed_deepagents/runtime.py +38 -42
- {managed_deepagents-0.10.2.dev1.dist-info → managed_deepagents-0.10.2.dev3.dist-info}/METADATA +1 -1
- {managed_deepagents-0.10.2.dev1.dist-info → managed_deepagents-0.10.2.dev3.dist-info}/RECORD +8 -8
- {managed_deepagents-0.10.2.dev1.dist-info → managed_deepagents-0.10.2.dev3.dist-info}/WHEEL +0 -0
- {managed_deepagents-0.10.2.dev1.dist-info → managed_deepagents-0.10.2.dev3.dist-info}/entry_points.txt +0 -0
- {managed_deepagents-0.10.2.dev1.dist-info → managed_deepagents-0.10.2.dev3.dist-info}/licenses/LICENSE +0 -0
- {managed_deepagents-0.10.2.dev1.dist-info → managed_deepagents-0.10.2.dev3.dist-info}/top_level.txt +0 -0
|
Binary file
|
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
|
|
@@ -319,13 +317,9 @@ _SANDBOX_DIGEST_LENGTH = 12
|
|
|
319
317
|
|
|
320
318
|
#: Host sandbox-name limit.
|
|
321
319
|
_MAX_SANDBOX_NAME_LENGTH = 63
|
|
322
|
-
_SANDBOX_FALLBACK_SUFFIX_LENGTH = 9
|
|
323
320
|
_MAX_PRIMARY_DEPLOYMENT_COMPONENT_LENGTH = (
|
|
324
321
|
_MAX_SANDBOX_NAME_LENGTH - len(_SANDBOX_NAME_SEPARATOR) - _SANDBOX_DIGEST_LENGTH
|
|
325
322
|
)
|
|
326
|
-
_MAX_FALLBACK_DEPLOYMENT_COMPONENT_LENGTH = (
|
|
327
|
-
_MAX_PRIMARY_DEPLOYMENT_COMPONENT_LENGTH - _SANDBOX_FALLBACK_SUFFIX_LENGTH
|
|
328
|
-
)
|
|
329
323
|
_SANDBOX_DEPLOYMENT_DIGEST_LENGTH = 8
|
|
330
324
|
|
|
331
325
|
#: Sandbox statuses that can be adopted as-is.
|
|
@@ -334,6 +328,9 @@ _ADOPTABLE_SANDBOX_STATUS = frozenset({"ready", "running"})
|
|
|
334
328
|
#: Sandbox status for one that is stopped but restartable.
|
|
335
329
|
_STOPPED_SANDBOX_STATUS = "stopped"
|
|
336
330
|
|
|
331
|
+
#: Sandbox status for one still booting: adopted, then waited for until ready.
|
|
332
|
+
_PROVISIONING_SANDBOX_STATUS = "provisioning"
|
|
333
|
+
|
|
337
334
|
#: Create failures that mean the sandbox name is already taken.
|
|
338
335
|
_SANDBOX_NAME_CONFLICT_RE = re.compile(
|
|
339
336
|
r"409|conflict|already exists|already in use|duplicate", re.IGNORECASE
|
|
@@ -2659,15 +2656,6 @@ def _managed_sandbox_lookup_names(
|
|
|
2659
2656
|
return list(dict.fromkeys(names))
|
|
2660
2657
|
|
|
2661
2658
|
|
|
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
2659
|
def _managed_sandbox_name_with_deployment_limit(
|
|
2672
2660
|
deployment: str,
|
|
2673
2661
|
scope_key: str,
|
|
@@ -2687,33 +2675,41 @@ def _sandbox_deployment_component(deployment: str, max_length: int) -> str:
|
|
|
2687
2675
|
|
|
2688
2676
|
|
|
2689
2677
|
def _fetch_sandbox(client: LangSmithSandboxClient, name: str) -> Sandbox | None:
|
|
2690
|
-
"""Look up a sandbox by name
|
|
2678
|
+
"""Look up a sandbox by name; ``None`` only when LangSmith confirms it is not there.
|
|
2679
|
+
|
|
2680
|
+
Any other failure (a timeout, a 5xx) fails the open: the sandbox may still
|
|
2681
|
+
exist, and creating beside it would give the thread a second, empty one.
|
|
2682
|
+
"""
|
|
2691
2683
|
get_sandbox = getattr(client, "get_sandbox", None)
|
|
2692
2684
|
if not callable(get_sandbox):
|
|
2693
2685
|
return None
|
|
2694
2686
|
try:
|
|
2695
2687
|
return _await_if_needed(get_sandbox(name))
|
|
2696
|
-
except Exception
|
|
2697
|
-
|
|
2688
|
+
except Exception as error:
|
|
2689
|
+
if _is_sandbox_not_found_error(error):
|
|
2690
|
+
return None
|
|
2691
|
+
raise RuntimeError(f"Could not look up sandbox {name!r}; retry the run: {error}") from error
|
|
2698
2692
|
|
|
2699
2693
|
|
|
2700
|
-
def _restart_sandbox(client: LangSmithSandboxClient, name: str, stopped: Sandbox) -> Sandbox
|
|
2701
|
-
"""Start a stopped sandbox so it can be adopted;
|
|
2694
|
+
def _restart_sandbox(client: LangSmithSandboxClient, name: str, stopped: Sandbox) -> Sandbox:
|
|
2695
|
+
"""Start a stopped sandbox so it can be adopted; raises when that fails."""
|
|
2702
2696
|
start_sandbox = getattr(client, "start_sandbox", None)
|
|
2703
2697
|
if not callable(start_sandbox):
|
|
2704
|
-
|
|
2698
|
+
raise RuntimeError(f"Sandbox {name!r} is stopped and this client cannot start it")
|
|
2705
2699
|
try:
|
|
2706
2700
|
# Some SDK versions return nothing on success; it is the same sandbox.
|
|
2707
2701
|
return _await_if_needed(start_sandbox(name)) or stopped
|
|
2708
|
-
except Exception
|
|
2709
|
-
|
|
2702
|
+
except Exception as error:
|
|
2703
|
+
raise RuntimeError(
|
|
2704
|
+
f"Could not start stopped sandbox {name!r}; retry the run: {error}"
|
|
2705
|
+
) from error
|
|
2710
2706
|
|
|
2711
2707
|
|
|
2712
2708
|
def _adopt_sandbox(client: LangSmithSandboxClient, name: str) -> Sandbox | None:
|
|
2713
2709
|
"""Return the existing sandbox for ``name`` when usable, else ``None``.
|
|
2714
2710
|
|
|
2715
|
-
|
|
2716
|
-
|
|
2711
|
+
``None`` means nothing usable holds the name. A lookup or restart failure
|
|
2712
|
+
raises instead, so the open never creates a second sandbox for the thread.
|
|
2717
2713
|
"""
|
|
2718
2714
|
existing = _fetch_sandbox(client, name)
|
|
2719
2715
|
if existing is None:
|
|
@@ -2724,6 +2720,9 @@ def _adopt_sandbox(client: LangSmithSandboxClient, name: str) -> Sandbox | None:
|
|
|
2724
2720
|
# No status reported: assume the SDK handed back a usable sandbox.
|
|
2725
2721
|
if normalized is None or normalized in _ADOPTABLE_SANDBOX_STATUS:
|
|
2726
2722
|
return existing
|
|
2723
|
+
if normalized == _PROVISIONING_SANDBOX_STATUS:
|
|
2724
|
+
# Another container's create is still booting it. Raises if it fails to boot.
|
|
2725
|
+
return _await_if_needed(client.wait_for_sandbox(name))
|
|
2727
2726
|
if normalized == _STOPPED_SANDBOX_STATUS:
|
|
2728
2727
|
return _restart_sandbox(client, name, existing)
|
|
2729
2728
|
return None
|
|
@@ -2738,7 +2737,6 @@ def _resolve_sandbox_instance(
|
|
|
2738
2737
|
client: LangSmithSandboxClient,
|
|
2739
2738
|
create_kwargs: dict[str, object],
|
|
2740
2739
|
name: str | None,
|
|
2741
|
-
fallback_name: Callable[[], str] | None = None,
|
|
2742
2740
|
adopt_aliases: Iterable[str] = (),
|
|
2743
2741
|
) -> tuple[Sandbox, bool]:
|
|
2744
2742
|
"""Adopt this deployment's existing sandbox for ``name``, or create it.
|
|
@@ -2750,6 +2748,10 @@ def _resolve_sandbox_instance(
|
|
|
2750
2748
|
``adopt_aliases`` are 0.9.0 and 0.5.x names for this thread: reconnect a box that
|
|
2751
2749
|
already exists, never create under the old formula.
|
|
2752
2750
|
|
|
2751
|
+
Only a confirmed not-found lookup permits a create, and the create never falls
|
|
2752
|
+
back to another name: a second sandbox would hold none of the thread's work,
|
|
2753
|
+
and replicas could each cache a different one.
|
|
2754
|
+
|
|
2753
2755
|
Returns the sandbox and whether it was adopted rather than created.
|
|
2754
2756
|
"""
|
|
2755
2757
|
# Options are a validated bag of provider kwargs, not individually typed.
|
|
@@ -2772,18 +2774,15 @@ def _resolve_sandbox_instance(
|
|
|
2772
2774
|
except Exception as error:
|
|
2773
2775
|
if not _is_sandbox_name_conflict(error):
|
|
2774
2776
|
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
|
|
2777
|
+
# Either a concurrent container won the create race (its sandbox may
|
|
2778
|
+
# still be provisioning), or an unusable sandbox (failed, mid-delete)
|
|
2779
|
+
# still holds the name. Never adopt a name we just invalidated.
|
|
2780
|
+
winner = None if _sandbox_name_blocked(name) else _adopt_sandbox(client, name)
|
|
2781
|
+
if winner is None:
|
|
2782
|
+
raise RuntimeError(
|
|
2783
|
+
f"Sandbox name {name!r} is held by a sandbox that cannot be used; retry the run"
|
|
2784
|
+
) from error
|
|
2785
|
+
return winner, True
|
|
2787
2786
|
|
|
2788
2787
|
|
|
2789
2788
|
def _create_replacement_sandbox(
|
|
@@ -2825,9 +2824,6 @@ def _create_langsmith_sandbox(
|
|
|
2825
2824
|
else []
|
|
2826
2825
|
)
|
|
2827
2826
|
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
2827
|
if existing_sandbox is not None:
|
|
2832
2828
|
langsmith_sandbox, adopted = existing_sandbox, True
|
|
2833
2829
|
elif recovery_name:
|
|
@@ -2836,7 +2832,7 @@ def _create_langsmith_sandbox(
|
|
|
2836
2832
|
)
|
|
2837
2833
|
else:
|
|
2838
2834
|
langsmith_sandbox, adopted = _resolve_sandbox_instance(
|
|
2839
|
-
client, create_kwargs, sandbox_name,
|
|
2835
|
+
client, create_kwargs, sandbox_name, lookup_names[1:]
|
|
2840
2836
|
)
|
|
2841
2837
|
host_name = _sandbox_handle_name(langsmith_sandbox) or sandbox_name
|
|
2842
2838
|
logger.info(
|
{managed_deepagents-0.10.2.dev1.dist-info → managed_deepagents-0.10.2.dev3.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.dev3
|
|
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.dev1.dist-info → managed_deepagents-0.10.2.dev3.dist-info}/RECORD
RENAMED
|
@@ -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=
|
|
50
|
+
managed_deepagents/runtime.py,sha256=XUdlB_vfLnPUSe_-FcZyxoAAdvEBI5GReSMIHeDrhY0,112197
|
|
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=iohIz9DAsoQY1O0j-YsuRkEqdZNTeXnTR4C9Rua_Yx4,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
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.dev3.dist-info/licenses/LICENSE,sha256=WnPZQQ608ojZUkXl7BW6VbKloIAibZiGm1K6cjeZOL8,1066
|
|
155
|
+
managed_deepagents-0.10.2.dev3.dist-info/METADATA,sha256=GVQHEYA9j7v-xX-LRTpJv19XBLa4VCjj454VnyJsJBQ,92915
|
|
156
|
+
managed_deepagents-0.10.2.dev3.dist-info/WHEEL,sha256=bhMFZwp6VMtrbl2Ck6PlXryKaCggO1NzYn_HcFbBF1I,97
|
|
157
|
+
managed_deepagents-0.10.2.dev3.dist-info/entry_points.txt,sha256=ziZqkKuaDO3qHCjKmBhrx9cm3ok8bZ9xcEDpUTj4unM,53
|
|
158
|
+
managed_deepagents-0.10.2.dev3.dist-info/top_level.txt,sha256=fdBo4O0Hlol_w022tTLB5ftZpamb4yJoQ3MUvjgTGfA,19
|
|
159
|
+
managed_deepagents-0.10.2.dev3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{managed_deepagents-0.10.2.dev1.dist-info → managed_deepagents-0.10.2.dev3.dist-info}/top_level.txt
RENAMED
|
File without changes
|