managed-deepagents 0.6.2.dev49__py3-none-win_amd64.whl → 0.6.2.dev50__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.
@@ -16,6 +16,7 @@ from managed_deepagents._agent_auth_http import (
16
16
  CredentialStoreError,
17
17
  agent_auth_credential_query,
18
18
  agent_auth_headers,
19
+ missing_workspace_connection_error,
19
20
  request_agent_auth_json,
20
21
  )
21
22
 
@@ -269,7 +270,7 @@ class AgentAuth:
269
270
  """Start an OAuth session for a slug the caller has not granted."""
270
271
  connection = self.find_workspace_connection(slug)
271
272
  if connection is None:
272
- raise CredentialStoreError(f"workspace connection {slug!r} is not configured")
273
+ raise missing_workspace_connection_error(slug)
273
274
  if connection.kind != "oauth2":
274
275
  raise CredentialStoreError(f"connection {slug!r} is not an OAuth connection")
275
276
  status, body = self._request(
@@ -7,6 +7,7 @@ API with the same headers, redirect policy, and page walker.
7
7
  from __future__ import annotations
8
8
 
9
9
  import json
10
+ import re
10
11
  import urllib.error
11
12
  import urllib.parse
12
13
  import urllib.request
@@ -66,6 +67,27 @@ class CredentialStoreError(RuntimeError):
66
67
  super().__init__(with_status if hint is None else f"{with_status}: {hint}")
67
68
 
68
69
 
70
+ # Each runtime quotes the slug its own way: repr() here, JSON.stringify in npm.
71
+ _MISSING_WORKSPACE_CONNECTION = re.compile(
72
+ r"""workspace connection ['"]([A-Za-z0-9][A-Za-z0-9._-]*)['"] is not configured"""
73
+ )
74
+
75
+
76
+ def missing_workspace_connection_error(slug: str) -> CredentialStoreError:
77
+ """Return the error for a declared slug that has no workspace connection row."""
78
+ return CredentialStoreError(f"workspace connection {slug!r} is not configured")
79
+
80
+
81
+ def missing_workspace_connection_slug(text: str) -> str | None:
82
+ """Read the slug back out of a missing-connection message.
83
+
84
+ A run that fails in the gate reaches a channel as a plain string, so this is
85
+ the only way back to the slug. It must move with the message it parses.
86
+ """
87
+ match = _MISSING_WORKSPACE_CONNECTION.search(text)
88
+ return None if match is None else match.group(1)
89
+
90
+
69
91
  __all__ = [
70
92
  "AGENT_AUTH_PROBLEM_HINT_MAX_CHARS",
71
93
  "AGENT_AUTH_TIMEOUT_SECONDS",
@@ -73,6 +95,8 @@ __all__ = [
73
95
  "agent_auth_credential_query",
74
96
  "agent_auth_headers",
75
97
  "agent_auth_problem_hint",
98
+ "missing_workspace_connection_error",
99
+ "missing_workspace_connection_slug",
76
100
  "request_agent_auth_json",
77
101
  ]
78
102
 
Binary file
@@ -9,6 +9,7 @@ from collections.abc import Awaitable, Callable, Mapping
9
9
  from importlib import import_module
10
10
  from typing import Protocol, TypeVar
11
11
 
12
+ from managed_deepagents._agent_auth_http import missing_workspace_connection_slug
12
13
  from managed_deepagents._channels.assistant_text import extract_assistant_text
13
14
  from managed_deepagents._channels.trigger.client import (
14
15
  LANGSMITH_MDA_TRIGGER_SERVER_URL_ENV,
@@ -242,6 +243,7 @@ async def _observe_accepted_run(
242
243
  async def lifecycle(
243
244
  event_type: TriggerChannelRuntimeEventType,
244
245
  interrupts: list[TriggerChannelInterrupt] | None = None,
246
+ message: str | None = None,
245
247
  ) -> None:
246
248
  logger.info(
247
249
  "Channel outgoing event (type=%s, delivery_id=%s, channel_id=%s, run_id=%s)",
@@ -253,7 +255,7 @@ async def _observe_accepted_run(
253
255
  await _best_effort(
254
256
  client.post_runtime_event(
255
257
  event["channel_id"],
256
- _runtime_event(event_type, event, started, interrupts),
258
+ _runtime_event(event_type, event, started, interrupts, message),
257
259
  )
258
260
  )
259
261
 
@@ -266,8 +268,8 @@ async def _observe_accepted_run(
266
268
  source_thread_key=source_thread_key,
267
269
  user_id=user_id,
268
270
  )
269
- except Exception: # noqa: BLE001 - observation details stay internal
270
- await lifecycle("run.failed")
271
+ except Exception as error: # noqa: BLE001 - only known-safe details leave runtime
272
+ await lifecycle("run.failed", message=_missing_connection_failure_message(error))
271
273
  return
272
274
 
273
275
  if _is_interrupted_run(observed):
@@ -391,6 +393,7 @@ def _runtime_event(
391
393
  event: TriggerChannelEvent,
392
394
  started: StartedIngressRun,
393
395
  interrupts: list[TriggerChannelInterrupt] | None = None,
396
+ message: str | None = None,
394
397
  ) -> TriggerChannelRuntimeEventRequest:
395
398
  request: TriggerChannelRuntimeEventRequest = {
396
399
  "id": str(uuid.uuid4()),
@@ -401,11 +404,24 @@ def _runtime_event(
401
404
  "run_thread_id": started["thread_id"],
402
405
  "run_id": started["run_id"],
403
406
  }
407
+ if message:
408
+ request["message"] = {"text": message}
404
409
  if interrupts:
405
410
  request["interrupts"] = interrupts
406
411
  return request
407
412
 
408
413
 
414
+ def _missing_connection_failure_message(error: Exception) -> str | None:
415
+ slug = missing_workspace_connection_slug(str(error))
416
+ if slug is None:
417
+ return None
418
+ return (
419
+ f"This agent can't respond because the `{slug}` connection isn't configured. "
420
+ "An agent developer can configure it with "
421
+ f"`mda connections create {slug} --project <project>`, then try again."
422
+ )
423
+
424
+
409
425
  def _thread_id(source_thread_key: str) -> str:
410
426
  return str(uuid.uuid5(uuid.NAMESPACE_URL, source_thread_key))
411
427
 
@@ -119,6 +119,8 @@ class TriggerChannelRuntimeEventRequestRequired(TypedDict):
119
119
 
120
120
 
121
121
  class TriggerChannelRuntimeEventRequest(TriggerChannelRuntimeEventRequestRequired, total=False):
122
+ # Safe, user-facing status text. Raw runtime exceptions must never be sent.
123
+ message: TriggerChannelActionMessage
122
124
  # Present on `run.interrupted`. The Trigger Server cannot read the
123
125
  # deployment's threads, so pending interrupts travel on the event itself.
124
126
  interrupts: list[TriggerChannelInterrupt]
@@ -20,8 +20,8 @@ from managed_deepagents._agent_auth import (
20
20
  AgentAuth,
21
21
  AgentAuthContext,
22
22
  CredentialAuthorizationRequiredError,
23
- CredentialStoreError,
24
23
  PendingAuthorization,
24
+ missing_workspace_connection_error,
25
25
  )
26
26
  from managed_deepagents._connections import (
27
27
  ConnectionReference,
@@ -187,7 +187,7 @@ def _read_user_connection_grants(
187
187
  slug = reference.slug
188
188
  row = agent_auth.find_workspace_connection(slug)
189
189
  if row is None:
190
- raise CredentialStoreError(f"workspace connection {slug!r} is not configured")
190
+ raise missing_workspace_connection_error(slug)
191
191
  kind: Literal["oauth2", "secret"] = "secret" if row.kind == "secret" else "oauth2"
192
192
  token = (
193
193
  agent_auth.read_user_secret_for_connection(row)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: managed-deepagents
3
- Version: 0.6.2.dev49
3
+ Version: 0.6.2.dev50
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
@@ -1,13 +1,13 @@
1
1
  managed_deepagents/__init__.py,sha256=RezkpgYxCcywj6_W7Nk3PN9TMBfYyFgIatxGrIeY8V4,1862
2
2
  managed_deepagents/__main__.py,sha256=GcjmqN0Ea5v8OHKMxYToasm3eCX_doSLOlpEzAi1tAw,67
3
- managed_deepagents/_agent_auth.py,sha256=bOxTT1ZX9BZZyvgIaxd9SZycbEaQl-HuCrPieCAv6G0,17258
4
- managed_deepagents/_agent_auth_http.py,sha256=aCYn7Rrtw3cnK3r4ir4JWxwzFkb7cF7nBgPpNdydxDw,5108
3
+ managed_deepagents/_agent_auth.py,sha256=DCGZNfMUpUEwLQT7tIODywmtzO3XjF4a1dixuDR_Fzs,17266
4
+ managed_deepagents/_agent_auth_http.py,sha256=d-Fg62m-_5qBXj-d9xgfA3KGiPRfs7T2g6Q2nrhCetc,6065
5
5
  managed_deepagents/_channel.py,sha256=-Og7QOM1yvV-yeTDOfv2CxXpR2HLY4xdX1bLrIsPi5k,5272
6
6
  managed_deepagents/_cli.py,sha256=jVaw2i1ysdRoWziMdPFmRXtKry_baYGRspyzyIeGWoU,1688
7
7
  managed_deepagents/_connections.py,sha256=VwVBwM4T0rp1MgYu9D8QjGj1ireYeEuP3VIAFN5urFY,16246
8
8
  managed_deepagents/_connector.py,sha256=Syp0SRs1oFCUUltIUmZbSNi1Ys_PxObVdiAi-I9GBzs,8040
9
9
  managed_deepagents/_cors.py,sha256=V96RPrqewdRWG5RpEMEBnPuRq9_zF8nf4vf99k5dkuI,7597
10
- managed_deepagents/_credential_gate.py,sha256=SNxXunqmHgjBsZpiZu8yp49YkRIO0amkl0-7GHLGnIg,12280
10
+ managed_deepagents/_credential_gate.py,sha256=thc9dqWphPKbNqWYEZ1P63mpMDyUPDTw4uPA_qqnW28,12262
11
11
  managed_deepagents/_eval_filesystem.py,sha256=1nuD0yn3gh19JrWNocWyPFyeJW42E7Gse3XRWCUSTAA,1399
12
12
  managed_deepagents/_extension.py,sha256=x2H1S8inkvTZQ_dr7kq0M8o8rre1FjzCDvMzItw4iyk,5318
13
13
  managed_deepagents/_identity_auth.py,sha256=l0t0Xx-J1-z_Zw4K5D-B2yV6lNdeJgOw7UvxODxUxZQ,32798
@@ -28,7 +28,7 @@ managed_deepagents/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
28
28
  managed_deepagents/runtime.py,sha256=B4iKTJZD0zXx_MZ09pqQFOkVo07tqJDT3qvOBr-0iOk,65782
29
29
  managed_deepagents/sandbox.py,sha256=xlpcWa6CoVX6GKip2nK-0Lw-HBCoFGFYm0r4x9eYwcY,2530
30
30
  managed_deepagents/schedules.py,sha256=MtTQN4tlm1NizFDCjZZv_huGfbQx-dj9WP1dIBybCug,5237
31
- managed_deepagents/_binaries/mda.exe,sha256=si-RbXt5o5HhOiAutrI8z5I4zerLvIo8iF1pKuJ1D8s,3904512
31
+ managed_deepagents/_binaries/mda.exe,sha256=MKHDoU4yrPlrylogVcQ8MmsJKXs7r6MzRI3OPV6z5fg,3904512
32
32
  managed_deepagents/_channels/__init__.py,sha256=Z6eXmzaLxG09DSyJoY_CX34axcsBo9gSJ0G7pRm2D6M,1216
33
33
  managed_deepagents/_channels/assistant_text.py,sha256=f-Z3J3PlQFXZHztgBxlRoqB2LigU1Hj1YpwoXBMTR18,2171
34
34
  managed_deepagents/_channels/binding.py,sha256=6vAKbWpg-eyLErJ0SsozH4mZc50hA1NhquM63mVmWDQ,3423
@@ -50,9 +50,9 @@ managed_deepagents/_channels/slack/transport.py,sha256=_xQmzK2hBpPOoY3zKFhzc3vvl
50
50
  managed_deepagents/_channels/trigger/__init__.py,sha256=bWj66XoPbDdrztPUCKBuSJBBS2pBocn4EA8FDE3WeBA,48
51
51
  managed_deepagents/_channels/trigger/channel.py,sha256=rKSvOABOZX58ZIvZ3hKcYxvTx9npQ0YXPQWk9JEy6XE,5108
52
52
  managed_deepagents/_channels/trigger/client.py,sha256=cM97gzYWUTFC9o3uoveFe9-HxZc6_VqiqC8u4fKqjXc,8572
53
- managed_deepagents/_channels/trigger/http.py,sha256=O8yMleioXj3s5QXj7jK-HpUpiSFppjfRjHJ2tdfX0Is,16205
53
+ managed_deepagents/_channels/trigger/http.py,sha256=75ROtdT7PacKAFa-KFFRPATkHDgC7Pu48AUcipTYXY0,16903
54
54
  managed_deepagents/_channels/trigger/identity_context.py,sha256=oo6sgtNDLGGkZCzrkrifMHkkAqxj7ui2HgUUdjNA1iU,7701
55
- managed_deepagents/_channels/trigger/types.py,sha256=42JMOFXP9MfqwQ66SFlAiwC7q_AnNIJXBts3sAujxac,6625
55
+ managed_deepagents/_channels/trigger/types.py,sha256=9nlArhLf-KgYidxwzrtBVjcpPlV6ytriPX3lJvPR3fE,6746
56
56
  managed_deepagents/_connectors/__init__.py,sha256=c_SdH3T7T6bgX7-I5jxAqDzHojmqVUCX0AXRI7g5Ovs,575
57
57
  managed_deepagents/_connectors/tool_selection.py,sha256=xMvohEvg_rguQvziUXzxKn4V140mmearZHel97F8tVs,2978
58
58
  managed_deepagents/_connectors/mcp/__init__.py,sha256=3AL429g5djYEYuiuSqsxj2VESpTkyU2NeBIJsHlWVk4,11162
@@ -69,9 +69,9 @@ managed_deepagents/identity/__init__.py,sha256=Slm-oEqKxbaZEQsMqHfD3LbG5M4vH2lKU
69
69
  managed_deepagents/identity/claims.py,sha256=prby7r_8Lww3MmoBm8PX6PsSGE3GwSHkr8mVIz_08nU,1180
70
70
  managed_deepagents/identity/options.py,sha256=x_yMbXEFR7zXyehEjDHG2qjAlukXjrRBcQLcM6IndLM,2550
71
71
  managed_deepagents/identity/supabase.py,sha256=8uobl3WCrQL_ieSXG8KTLf1th7Qjim9liZT50HeaJE0,6026
72
- managed_deepagents-0.6.2.dev49.dist-info/licenses/LICENSE,sha256=WnPZQQ608ojZUkXl7BW6VbKloIAibZiGm1K6cjeZOL8,1066
73
- managed_deepagents-0.6.2.dev49.dist-info/METADATA,sha256=7QuGJwj6TqzMO7JMsCPCm51hE7Bmk-H0hvKWNGH4ZHU,13718
74
- managed_deepagents-0.6.2.dev49.dist-info/WHEEL,sha256=3I5VVWZdsFlU417aCS2bMRuerS8wsfvBq99MyatBV3A,97
75
- managed_deepagents-0.6.2.dev49.dist-info/entry_points.txt,sha256=ziZqkKuaDO3qHCjKmBhrx9cm3ok8bZ9xcEDpUTj4unM,53
76
- managed_deepagents-0.6.2.dev49.dist-info/top_level.txt,sha256=fdBo4O0Hlol_w022tTLB5ftZpamb4yJoQ3MUvjgTGfA,19
77
- managed_deepagents-0.6.2.dev49.dist-info/RECORD,,
72
+ managed_deepagents-0.6.2.dev50.dist-info/licenses/LICENSE,sha256=WnPZQQ608ojZUkXl7BW6VbKloIAibZiGm1K6cjeZOL8,1066
73
+ managed_deepagents-0.6.2.dev50.dist-info/METADATA,sha256=jGDCHaAI4JMsFMrZ_fhKDqt6PVYObwGB3vD_HoY_fxU,13718
74
+ managed_deepagents-0.6.2.dev50.dist-info/WHEEL,sha256=3I5VVWZdsFlU417aCS2bMRuerS8wsfvBq99MyatBV3A,97
75
+ managed_deepagents-0.6.2.dev50.dist-info/entry_points.txt,sha256=ziZqkKuaDO3qHCjKmBhrx9cm3ok8bZ9xcEDpUTj4unM,53
76
+ managed_deepagents-0.6.2.dev50.dist-info/top_level.txt,sha256=fdBo4O0Hlol_w022tTLB5ftZpamb4yJoQ3MUvjgTGfA,19
77
+ managed_deepagents-0.6.2.dev50.dist-info/RECORD,,