managed-deepagents 0.8.7.dev2__py3-none-win_amd64.whl → 0.8.7.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.
Files changed (64) hide show
  1. managed_deepagents/__init__.py +49 -1
  2. managed_deepagents/_agent_auth.py +1 -3
  3. managed_deepagents/_binaries/mda.exe +0 -0
  4. managed_deepagents/_channels/binding.py +9 -4
  5. managed_deepagents/_channels/http/__init__.py +15 -3
  6. managed_deepagents/_channels/http/types.py +3 -3
  7. managed_deepagents/_channels/messaging_registry.py +11 -0
  8. managed_deepagents/_channels/reactions.py +99 -0
  9. managed_deepagents/_channels/response_format.py +43 -6
  10. managed_deepagents/_channels/runtime.py +6 -4
  11. managed_deepagents/_channels/schedule_delivery.py +49 -58
  12. managed_deepagents/_channels/slack/files.py +69 -24
  13. managed_deepagents/_channels/slack/middleware.py +15 -11
  14. managed_deepagents/_channels/slack/transport.py +2 -1
  15. managed_deepagents/_channels/trigger/channel.py +28 -0
  16. managed_deepagents/_channels/trigger/http.py +121 -49
  17. managed_deepagents/_channels/trigger/transport.py +7 -2
  18. managed_deepagents/_channels/trigger/types.py +34 -4
  19. managed_deepagents/_channels/types.py +10 -3
  20. managed_deepagents/_connectors/mcp/__init__.py +244 -140
  21. managed_deepagents/_connectors/mcp/load.py +323 -384
  22. managed_deepagents/_connectors/tool_selection.py +6 -3
  23. managed_deepagents/_credential_gate.py +27 -27
  24. managed_deepagents/_eval_filesystem.py +200 -9
  25. managed_deepagents/_identity_auth.py +36 -18
  26. managed_deepagents/_identity_links.py +6 -26
  27. managed_deepagents/_identity_runtime.py +32 -42
  28. managed_deepagents/_ingress.py +1 -3
  29. managed_deepagents/_managed_composition.py +253 -0
  30. managed_deepagents/_managed_middleware.py +24 -67
  31. managed_deepagents/_managed_tools.py +109 -117
  32. managed_deepagents/_memory/__init__.py +2 -0
  33. managed_deepagents/_memory/async_util.py +15 -5
  34. managed_deepagents/_memory/deps.py +3 -3
  35. managed_deepagents/_memory/layers.py +1 -3
  36. managed_deepagents/_memory/mounts.py +21 -10
  37. managed_deepagents/_memory/paths.py +8 -0
  38. managed_deepagents/_memory/policy.py +5 -1
  39. managed_deepagents/_memory/selected_skills.py +509 -0
  40. managed_deepagents/_memory/types.py +14 -25
  41. managed_deepagents/_memory/user_memory.py +4 -27
  42. managed_deepagents/_run_input.py +96 -2
  43. managed_deepagents/_runtime_schedules.py +598 -0
  44. managed_deepagents/_schedule_auth.py +240 -0
  45. managed_deepagents/_schedule_channel.py +29 -0
  46. managed_deepagents/_schedule_time.py +102 -0
  47. managed_deepagents/_static_entry.py +17 -0
  48. managed_deepagents/_telemetry/run.py +2 -2
  49. managed_deepagents/agent_entry.py +19 -0
  50. managed_deepagents/define_deep_agent.py +40 -18
  51. managed_deepagents/define_memory.py +6 -6
  52. managed_deepagents/identity/__init__.py +12 -27
  53. managed_deepagents/namespaces.py +3 -2
  54. managed_deepagents/run_context.py +12 -3
  55. managed_deepagents/runtime.py +594 -232
  56. managed_deepagents/sandbox.py +2 -1
  57. managed_deepagents/schedules.py +14 -5
  58. {managed_deepagents-0.8.7.dev2.dist-info → managed_deepagents-0.8.7.dev3.dist-info}/METADATA +136 -46
  59. managed_deepagents-0.8.7.dev3.dist-info/RECORD +109 -0
  60. managed_deepagents-0.8.7.dev2.dist-info/RECORD +0 -100
  61. {managed_deepagents-0.8.7.dev2.dist-info → managed_deepagents-0.8.7.dev3.dist-info}/WHEEL +0 -0
  62. {managed_deepagents-0.8.7.dev2.dist-info → managed_deepagents-0.8.7.dev3.dist-info}/entry_points.txt +0 -0
  63. {managed_deepagents-0.8.7.dev2.dist-info → managed_deepagents-0.8.7.dev3.dist-info}/licenses/LICENSE +0 -0
  64. {managed_deepagents-0.8.7.dev2.dist-info → managed_deepagents-0.8.7.dev3.dist-info}/top_level.txt +0 -0
@@ -43,8 +43,29 @@ from managed_deepagents._connections import (
43
43
  )
44
44
  from managed_deepagents._managed_tools import (
45
45
  ManagedDeepAgentRuntime,
46
+ ManagedRuntime,
47
+ ManagedServerRuntime,
48
+ ManagedToolRuntime,
49
+ )
50
+ from managed_deepagents._runtime_schedules import (
51
+ ScheduleNotFoundError,
52
+ ScheduleOwner,
53
+ SchedulePage,
54
+ SchedulePatch,
55
+ ScheduleRecord,
56
+ schedules,
57
+ )
58
+ from managed_deepagents.agent_entry import (
59
+ AgentEntry,
60
+ AgentFactory,
61
+ )
62
+ from managed_deepagents.define_deep_agent import (
63
+ DeepAgentDefinition,
64
+ GeneratedSkill,
65
+ McpSelection,
66
+ SkillSelection,
67
+ define_deep_agent,
46
68
  )
47
- from managed_deepagents.define_deep_agent import DeepAgentDefinition, define_deep_agent
48
69
  from managed_deepagents.define_memory import (
49
70
  MemoryDefinition,
50
71
  MemoryLayer,
@@ -72,6 +93,8 @@ from managed_deepagents.schedules import define_schedule
72
93
 
73
94
  __all__ = [
74
95
  "INTERRUPT_CORRELATION_KEY",
96
+ "AgentEntry",
97
+ "AgentFactory",
75
98
  "ChannelContentMessage",
76
99
  "ChannelContext",
77
100
  "ChannelEvent",
@@ -82,18 +105,26 @@ __all__ = [
82
105
  "CredentialAuthorizationRequiredError",
83
106
  "CredentialStoreError",
84
107
  "DeepAgentDefinition",
108
+ "GeneratedSkill",
85
109
  "HttpChannel",
86
110
  "HttpChannelInboundMessage",
87
111
  "HttpChannelParseResult",
88
112
  "HttpChannelPostInput",
89
113
  "HttpChannelRequest",
114
+ "HttpMcpServerConfig",
90
115
  "HttpPostedMessage",
91
116
  "InvalidAgentAuthEndpointError",
92
117
  "JsonValue",
93
118
  "ManagedChannelContext",
94
119
  "ManagedDeepAgentRuntime",
95
120
  "ManagedRunContext",
121
+ "ManagedRuntime",
96
122
  "ManagedServerInfo",
123
+ "ManagedServerRuntime",
124
+ "ManagedToolRuntime",
125
+ "McpSelection",
126
+ "McpServersConfig",
127
+ "McpServersDefinition",
97
128
  "MemoryDefinition",
98
129
  "MemoryLayer",
99
130
  "MessageContent",
@@ -101,8 +132,16 @@ __all__ = [
101
132
  "OutboundMessage",
102
133
  "PostedChannelMessage",
103
134
  "PromptResponse",
135
+ "RemoteMcpServerConfig",
104
136
  "SandboxDefinition",
137
+ "ScheduleNotFoundError",
138
+ "ScheduleOwner",
139
+ "SchedulePage",
140
+ "SchedulePatch",
141
+ "ScheduleRecord",
142
+ "SkillSelection",
105
143
  "SlackPromptResponse",
144
+ "SseMcpServerConfig",
106
145
  "auth",
107
146
  "basic",
108
147
  "bearer",
@@ -115,4 +154,13 @@ __all__ = [
115
154
  "define_memory",
116
155
  "define_sandbox",
117
156
  "define_schedule",
157
+ "schedules",
118
158
  ]
159
+
160
+ from managed_deepagents._connectors.mcp import (
161
+ HttpMcpServerConfig,
162
+ McpServersConfig,
163
+ McpServersDefinition,
164
+ RemoteMcpServerConfig,
165
+ SseMcpServerConfig,
166
+ )
@@ -9,9 +9,7 @@ from __future__ import annotations
9
9
  import urllib.parse
10
10
  from collections.abc import Mapping
11
11
  from dataclasses import dataclass
12
- from typing import Protocol, TypedDict
13
-
14
- from typing_extensions import NotRequired
12
+ from typing import NotRequired, Protocol, TypedDict
15
13
 
16
14
  from managed_deepagents._agent_auth_http import (
17
15
  AGENT_AUTH_TIMEOUT_SECONDS,
Binary file
@@ -3,11 +3,11 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from collections.abc import Callable, Mapping
6
- from typing import TYPE_CHECKING, Literal, TypedDict, cast
6
+ from contextvars import ContextVar
7
+ from typing import TYPE_CHECKING, Literal, NotRequired, TypedDict, cast
7
8
 
8
9
  from pydantic import BaseModel, ConfigDict, Field, TypeAdapter, ValidationError
9
10
  from pydantic import JsonValue as PydanticJsonValue
10
- from typing_extensions import NotRequired
11
11
 
12
12
  from managed_deepagents._channels.messaging_registry import (
13
13
  channel_provider_for_name,
@@ -15,7 +15,7 @@ from managed_deepagents._channels.messaging_registry import (
15
15
  )
16
16
  from managed_deepagents._channels.runtime import (
17
17
  ChannelMessagingAdapter,
18
- RuntimeChannelLike,
18
+ RuntimeChannel,
19
19
  channel_info,
20
20
  create_runtime_channel,
21
21
  is_json_value,
@@ -41,6 +41,9 @@ class ChannelBinding(TypedDict):
41
41
  raw_event: NotRequired[JsonValue]
42
42
 
43
43
 
44
+ _current_channel: ContextVar[ChannelBinding | None] = ContextVar("mda_channel", default=None)
45
+
46
+
44
47
  class _TriggerTargetModel(BaseModel):
45
48
  model_config = ConfigDict(extra="ignore", strict=True)
46
49
  channel_id: str = Field(pattern=r"\S")
@@ -56,6 +59,8 @@ def resolve_channel_binding(
56
59
  ) -> ChannelBinding | None:
57
60
  """Validate delivery context against the authenticated source and declared channel."""
58
61
  raw = _field(context, "channel")
62
+ if raw is None:
63
+ raw = _current_channel.get()
59
64
  if not isinstance(configurable, Mapping) or not is_json_value(raw):
60
65
  return None
61
66
  try:
@@ -97,7 +102,7 @@ def resolve_runtime_channel(
97
102
  context: object,
98
103
  configurable: Mapping[str, object] | None,
99
104
  transport_factory: Callable[[str], object | None] | None = None,
100
- ) -> RuntimeChannelLike | None:
105
+ ) -> RuntimeChannel | None:
101
106
  binding = resolve_channel_binding(context, configurable)
102
107
  if binding is None:
103
108
  return None
@@ -67,14 +67,26 @@ class _HttpReplyTransport:
67
67
  def __init__(self, post: HttpPost) -> None:
68
68
  self._post = post
69
69
 
70
- async def post(self, *, message: ChannelMessage, target: JsonValue) -> PostedChannelMessage:
70
+ async def post(
71
+ self, *, message: ChannelMessage, target: JsonValue, new_thread: bool | None = None
72
+ ) -> PostedChannelMessage:
71
73
  if message["type"] == "content":
72
74
  posted = await self._post(
73
- {"type": "content", "content": message["content"], "target": target}
75
+ {
76
+ "type": "content",
77
+ "content": message["content"],
78
+ "target": target,
79
+ **({"new_thread": new_thread} if new_thread is not None else {}),
80
+ }
74
81
  )
75
82
  else:
76
83
  posted = await self._post(
77
- {"type": "native", "native": message["native"], "target": target}
84
+ {
85
+ "type": "native",
86
+ "native": message["native"],
87
+ "target": target,
88
+ **({"new_thread": new_thread} if new_thread is not None else {}),
89
+ }
78
90
  )
79
91
  result: PostedChannelMessage = {"id": posted["id"]}
80
92
  url = posted.get("url")
@@ -2,9 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from collections.abc import Awaitable, Callable
4
4
  from dataclasses import dataclass
5
- from typing import TYPE_CHECKING, Literal, TypedDict
6
-
7
- from typing_extensions import NotRequired
5
+ from typing import TYPE_CHECKING, Literal, NotRequired, TypedDict
8
6
 
9
7
  if TYPE_CHECKING:
10
8
  from starlette.requests import Request
@@ -35,12 +33,14 @@ class _ContentPostInput(TypedDict):
35
33
  type: Literal["content"]
36
34
  content: MessageContent
37
35
  target: JsonValue
36
+ new_thread: NotRequired[bool]
38
37
 
39
38
 
40
39
  class _NativePostInput(TypedDict):
41
40
  type: Literal["native"]
42
41
  native: JsonValue
43
42
  target: JsonValue
43
+ new_thread: NotRequired[bool]
44
44
 
45
45
 
46
46
  HttpChannelPostInput = _ContentPostInput | _NativePostInput
@@ -14,20 +14,27 @@ from typing import TYPE_CHECKING, cast
14
14
  from managed_deepagents._channels.source_providers import register_declared_source_providers
15
15
 
16
16
  if TYPE_CHECKING:
17
+ from managed_deepagents._channels.manifest import JsonObject
17
18
  from managed_deepagents._channels.runtime import ChannelMessagingAdapter
18
19
 
19
20
  MessagingFactory = Callable[[Mapping[str, str]], "ChannelMessagingAdapter | None"]
20
21
 
21
22
  _provider_by_name: dict[str, str] = {}
23
+ _provider_config_by_name: dict[str, JsonObject] = {}
22
24
 
23
25
 
24
26
  def channel_provider_for_name(name: str) -> str | None:
25
27
  return _provider_by_name.get(name)
26
28
 
27
29
 
30
+ def channel_provider_config_for_name(name: str) -> JsonObject | None:
31
+ return _provider_config_by_name.get(name)
32
+
33
+
28
34
  _by_name: dict[str, MessagingFactory] = {}
29
35
 
30
36
  __all__ = [
37
+ "channel_provider_config_for_name",
31
38
  "messaging_transport_for_name",
32
39
  "register_channel_messaging",
33
40
  "register_connector_messaging",
@@ -57,6 +64,7 @@ def _register_messaging_sources(sources: Sequence[object]) -> None:
57
64
  kind = getattr(source, "kind", None)
58
65
  if isinstance(kind, str) and kind.strip():
59
66
  _provider_by_name[name] = kind
67
+ _provider_config_by_name.pop(name, None)
60
68
  requirements = getattr(source, "requirements", None)
61
69
  if callable(requirements):
62
70
  manifest = requirements(name)
@@ -64,6 +72,9 @@ def _register_messaging_sources(sources: Sequence[object]) -> None:
64
72
  provider = manifest.get("provider")
65
73
  if isinstance(provider, str) and provider.strip():
66
74
  _provider_by_name[name] = provider
75
+ config = manifest.get("providerConfig")
76
+ if isinstance(config, Mapping):
77
+ _provider_config_by_name[name] = cast("JsonObject", config)
67
78
 
68
79
 
69
80
  def register_channel_messaging(channels: Sequence[object]) -> None:
@@ -0,0 +1,99 @@
1
+ """Resolve the emoji the agent reacts with when it picks up an inbound message.
2
+
3
+ The reaction is a courtesy and must never fail a run or delay a reply, so a
4
+ chooser that raises, hangs, or answers with something that is not an emoji
5
+ short name yields :data:`DEFAULT_REACTION_EMOJI` instead. Returning ``None``
6
+ skips the reaction.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import asyncio
12
+ import inspect
13
+ import re
14
+ from collections.abc import Awaitable, Callable
15
+ from typing import TypedDict
16
+
17
+ from managed_deepagents._log import logger
18
+
19
+ #: The default reaction, and the fallback whenever a chooser does not answer.
20
+ DEFAULT_REACTION_EMOJI = "eyes"
21
+
22
+ #: Slack emoji short name, without the surrounding colons.
23
+ #:
24
+ #: Well-formedness is all that can be checked here; whether Slack knows the name
25
+ #: is Slack's to say, and it rejects an unknown one by doing nothing.
26
+ _EMOJI_NAME = re.compile(r"^[a-z0-9+-][a-z0-9_+-]{0,59}$")
27
+
28
+ #: How long a chooser may take before the default is used instead.
29
+ _CHOOSER_TIMEOUT_S = 5.0
30
+
31
+
32
+ class ReactionContext(TypedDict):
33
+ """What a chooser is told about the message it is reacting to."""
34
+
35
+ #: The inbound message text. Attacker-controlled; treat it as data.
36
+ text: str
37
+
38
+
39
+ #: Picks the emoji for one inbound message, or ``None`` for none. May be sync or async.
40
+ #:
41
+ #: A sync chooser runs in a thread, where the timeout cannot stop it, so bound
42
+ #: any I/O it does.
43
+ ReactionChooser = Callable[[ReactionContext], str | Awaitable[str | None] | None]
44
+
45
+ #: How a channel reacts: ``True`` with the default, ``False`` not at all, a short
46
+ #: name always that emoji, or a callable per message.
47
+ ReactionChoice = bool | str | ReactionChooser
48
+
49
+
50
+ def is_emoji_name(value: object) -> bool:
51
+ """Whether ``value`` is a usable emoji short name."""
52
+ # `fullmatch`, not `match`: Python's `$` also matches before a trailing
53
+ # newline, so `match` would accept "bug\n" and Slack would decline it.
54
+ return isinstance(value, str) and _EMOJI_NAME.fullmatch(value) is not None
55
+
56
+
57
+ async def _call(choice: ReactionChooser, context: ReactionContext) -> object:
58
+ """Call ``choice``, giving a sync one a thread so it cannot block the loop.
59
+
60
+ A plain ``def`` may still return an awaitable, so await that too.
61
+ """
62
+ if inspect.iscoroutinefunction(choice):
63
+ return await choice(context)
64
+ result = await asyncio.to_thread(choice, context)
65
+ return await result if inspect.isawaitable(result) else result
66
+
67
+
68
+ async def resolve_reaction_emoji(choice: ReactionChoice, context: ReactionContext) -> str | None:
69
+ """Resolve the reaction for one message. Never raises."""
70
+ if isinstance(choice, str):
71
+ return choice if is_emoji_name(choice) else DEFAULT_REACTION_EMOJI
72
+ if not callable(choice):
73
+ return DEFAULT_REACTION_EMOJI
74
+
75
+ try:
76
+ chosen = await asyncio.wait_for(_call(choice, context), timeout=_CHOOSER_TIMEOUT_S)
77
+ if chosen is None:
78
+ return None
79
+ if is_emoji_name(chosen):
80
+ return str(chosen)
81
+ logger.warning(
82
+ "Channel reaction chooser did not answer with an emoji short name; using the default."
83
+ )
84
+ except Exception as error: # noqa: BLE001 - a courtesy must not fail a run
85
+ logger.warning(
86
+ "Channel reaction chooser failed (%s); using the default.",
87
+ type(error).__name__,
88
+ )
89
+ return DEFAULT_REACTION_EMOJI
90
+
91
+
92
+ __all__ = [
93
+ "DEFAULT_REACTION_EMOJI",
94
+ "ReactionChoice",
95
+ "ReactionChooser",
96
+ "ReactionContext",
97
+ "is_emoji_name",
98
+ "resolve_reaction_emoji",
99
+ ]
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from collections.abc import Awaitable, Callable, Mapping
5
+ from collections.abc import Awaitable, Callable
6
6
 
7
7
  from langchain.agents.middleware import (
8
8
  AgentMiddleware,
@@ -13,7 +13,9 @@ from langchain.agents.middleware import (
13
13
  )
14
14
  from langchain_core.messages import ContentBlock, SystemMessage, TextContentBlock
15
15
 
16
- from managed_deepagents._identity_runtime import resolve_runtime_configurable
16
+ from managed_deepagents._channels.binding import resolve_channel_binding
17
+ from managed_deepagents._channels.messaging_registry import channel_provider_config_for_name
18
+ from managed_deepagents._identity_runtime import _field, resolve_runtime_configurable
17
19
 
18
20
  CHANNEL_RESPONSE_FORMAT_MIDDLEWARE_NAME = "mda-channel-response-format"
19
21
  SLACK_MARKDOWN_INSTRUCTIONS = (
@@ -26,24 +28,58 @@ SLACK_MARKDOWN_INSTRUCTIONS = (
26
28
  )
27
29
 
28
30
 
31
+ SLACK_CONVERSATION_INSTRUCTIONS = (
32
+ "Mention another Slack agent as <@USER_ID> on each message that needs its reply. "
33
+ "Use its verified Slack user ID; a name or thread reply alone is insufficient. "
34
+ "The recipient must allow bot triggers."
35
+ )
36
+
37
+
38
+ def _slack_conversation_instructions(allow_bot_triggers: bool) -> str:
39
+ behavior = (
40
+ "Bot triggers are enabled. Reply to bot messages only when they request action. "
41
+ "Finish completed tasks without another bot mention."
42
+ if allow_bot_triggers
43
+ else "Bot triggers are disabled. Bot messages cannot trigger you, even with a mention. "
44
+ "You can message another agent, but its reply cannot start your next turn."
45
+ )
46
+ return (
47
+ f"<slack_conversation>\n{SLACK_CONVERSATION_INSTRUCTIONS}\n"
48
+ f"{behavior}\n</slack_conversation>"
49
+ )
50
+
51
+
29
52
  def _is_slack_request(request: ModelRequest[None]) -> bool:
30
53
  configurable = resolve_runtime_configurable(request.runtime)
31
54
  user = (configurable or {}).get("langgraph_auth_user")
32
- return isinstance(user, Mapping) and user.get("mda_source_provider") == "slack"
55
+ return _field(user, "mda_source_provider") == "slack"
33
56
 
34
57
 
35
- def _with_slack_markdown_instructions(request: ModelRequest[None]) -> ModelRequest[None]:
58
+ def _with_slack_instructions(
59
+ request: ModelRequest[None], allow_bot_triggers: bool | None
60
+ ) -> ModelRequest[None]:
36
61
  blocks: list[ContentBlock] = list(
37
62
  request.system_message.content_blocks if request.system_message is not None else []
38
63
  )
39
64
  blocks.append(TextContentBlock(type="text", text=SLACK_MARKDOWN_INSTRUCTIONS))
65
+ if allow_bot_triggers is not None:
66
+ blocks.append(
67
+ TextContentBlock(type="text", text=_slack_conversation_instructions(allow_bot_triggers))
68
+ )
40
69
  return request.override(system_message=SystemMessage(content_blocks=blocks))
41
70
 
42
71
 
43
72
  def _format_request(request: ModelRequest[None]) -> ModelRequest[None]:
44
73
  if not _is_slack_request(request):
45
74
  return request
46
- return _with_slack_markdown_instructions(request)
75
+ binding = resolve_channel_binding(
76
+ _field(request.runtime, "context"), resolve_runtime_configurable(request.runtime)
77
+ )
78
+ config = channel_provider_config_for_name(binding["name"]) if binding else None
79
+ allow_bot_triggers = config.get("allowBotTriggers") if config is not None else None
80
+ return _with_slack_instructions(
81
+ request, allow_bot_triggers if isinstance(allow_bot_triggers, bool) else None
82
+ )
47
83
 
48
84
 
49
85
  class _ChannelResponseFormatMiddleware(AgentMiddleware[AgentState[object], None, object]):
@@ -69,12 +105,13 @@ class _ChannelResponseFormatMiddleware(AgentMiddleware[AgentState[object], None,
69
105
  def create_channel_response_format_middleware() -> AgentMiddleware[
70
106
  AgentState[object], None, object
71
107
  ]:
72
- """Add Slack Markdown guidance to model calls from managed Slack ingress."""
108
+ """Add Slack formatting and conversation guidance to model calls from managed Slack ingress."""
73
109
  return _ChannelResponseFormatMiddleware()
74
110
 
75
111
 
76
112
  __all__ = [
77
113
  "CHANNEL_RESPONSE_FORMAT_MIDDLEWARE_NAME",
114
+ "SLACK_CONVERSATION_INSTRUCTIONS",
78
115
  "SLACK_MARKDOWN_INSTRUCTIONS",
79
116
  "create_channel_response_format_middleware",
80
117
  ]
@@ -22,7 +22,7 @@ from managed_deepagents._channels.types import (
22
22
 
23
23
  class ChannelMessagingAdapter(Protocol):
24
24
  def post(
25
- self, *, message: ChannelMessage, target: JsonValue
25
+ self, *, message: ChannelMessage, target: JsonValue, new_thread: bool = False
26
26
  ) -> PostedChannelMessage | Awaitable[PostedChannelMessage]: ...
27
27
 
28
28
 
@@ -59,9 +59,6 @@ class RuntimeChannel(ChannelInfo):
59
59
  post: Callable[[ChannelMessage], Awaitable[PostedChannelMessage]] | None = None
60
60
 
61
61
 
62
- RuntimeChannelLike = RuntimeChannel
63
-
64
-
65
62
  def create_runtime_channel(
66
63
  *,
67
64
  name: str,
@@ -83,6 +80,11 @@ def create_runtime_channel(
83
80
  result = transport.post(
84
81
  message=cast("ChannelMessage", json_copy(cast("JsonValue", message))),
85
82
  target=json_copy(bound_target),
83
+ **(
84
+ {"new_thread": bool(facts.event["new_thread"])}
85
+ if facts.event["type"] == "schedule"
86
+ else {}
87
+ ),
86
88
  )
87
89
  return cast("PostedChannelMessage", await result if inspect.isawaitable(result) else result)
88
90