langchain-agentx-python 0.1__py3-none-any.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 (354) hide show
  1. langchain_agentx/__init__.py +46 -0
  2. langchain_agentx/command/__init__.py +28 -0
  3. langchain_agentx/command/builtin/__init__.py +25 -0
  4. langchain_agentx/command/builtin/clear.py +33 -0
  5. langchain_agentx/command/builtin/compact.py +33 -0
  6. langchain_agentx/command/builtin/memory.py +37 -0
  7. langchain_agentx/command/builtin/reload_plugins.py +42 -0
  8. langchain_agentx/command/context.py +30 -0
  9. langchain_agentx/command/dispatcher.py +183 -0
  10. langchain_agentx/command/registry.py +110 -0
  11. langchain_agentx/command/result.py +25 -0
  12. langchain_agentx/command/types.py +41 -0
  13. langchain_agentx/config/__init__.py +14 -0
  14. langchain_agentx/loop/__init__.py +47 -0
  15. langchain_agentx/loop/config/__init__.py +20 -0
  16. langchain_agentx/loop/config/agent_config.py +66 -0
  17. langchain_agentx/loop/config/agent_loop_config.py +72 -0
  18. langchain_agentx/loop/config/model_context_resolver.py +105 -0
  19. langchain_agentx/loop/config/runtime_settings.py +50 -0
  20. langchain_agentx/loop/config/token_estimator.py +133 -0
  21. langchain_agentx/loop/context/__init__.py +66 -0
  22. langchain_agentx/loop/context/blocking_guard.py +97 -0
  23. langchain_agentx/loop/context/compaction_service.py +60 -0
  24. langchain_agentx/loop/context/message_utils.py +56 -0
  25. langchain_agentx/loop/context/pipeline.py +127 -0
  26. langchain_agentx/loop/context/settings.py +103 -0
  27. langchain_agentx/loop/context/stages/__init__.py +29 -0
  28. langchain_agentx/loop/context/stages/autocompact.py +140 -0
  29. langchain_agentx/loop/context/stages/base.py +32 -0
  30. langchain_agentx/loop/context/stages/collapse.py +76 -0
  31. langchain_agentx/loop/context/stages/microcompact.py +76 -0
  32. langchain_agentx/loop/context/stages/noop.py +33 -0
  33. langchain_agentx/loop/context/stages/snip.py +71 -0
  34. langchain_agentx/loop/context/stages/tool_result_budget.py +69 -0
  35. langchain_agentx/loop/context/types.py +79 -0
  36. langchain_agentx/loop/exit/__init__.py +1 -0
  37. langchain_agentx/loop/exit/exit_logic.py +320 -0
  38. langchain_agentx/loop/exit/reason_codes.py +39 -0
  39. langchain_agentx/loop/graph/__init__.py +5 -0
  40. langchain_agentx/loop/graph/builtin_loop_control.py +197 -0
  41. langchain_agentx/loop/graph/factory.py +1409 -0
  42. langchain_agentx/loop/graph/graph_edges.py +820 -0
  43. langchain_agentx/loop/hook/__init__.py +48 -0
  44. langchain_agentx/loop/hook/async_hook_runner.py +62 -0
  45. langchain_agentx/loop/hook/config.py +280 -0
  46. langchain_agentx/loop/hook/engine.py +321 -0
  47. langchain_agentx/loop/hook/executors/__init__.py +9 -0
  48. langchain_agentx/loop/hook/executors/agent.py +107 -0
  49. langchain_agentx/loop/hook/executors/command.py +230 -0
  50. langchain_agentx/loop/hook/executors/http.py +114 -0
  51. langchain_agentx/loop/hook/executors/prompt.py +92 -0
  52. langchain_agentx/loop/hook/graph_wiring.py +134 -0
  53. langchain_agentx/loop/hook/registry.py +262 -0
  54. langchain_agentx/loop/hook/trust.py +43 -0
  55. langchain_agentx/loop/hook/types.py +110 -0
  56. langchain_agentx/loop/injection/__init__.py +13 -0
  57. langchain_agentx/loop/injection/dedup.py +74 -0
  58. langchain_agentx/loop/loop_abort.py +36 -0
  59. langchain_agentx/loop/model/__init__.py +1 -0
  60. langchain_agentx/loop/model/model_node.py +648 -0
  61. langchain_agentx/loop/model/model_nodes.py +661 -0
  62. langchain_agentx/loop/model/orphan_tool_results.py +38 -0
  63. langchain_agentx/loop/model/retrier.py +307 -0
  64. langchain_agentx/loop/model/retry_bridge.py +58 -0
  65. langchain_agentx/loop/model/retry_events.py +35 -0
  66. langchain_agentx/loop/model/retry_policy.py +56 -0
  67. langchain_agentx/loop/model/schema_and_format.py +153 -0
  68. langchain_agentx/loop/model/tool_and_model_binding.py +227 -0
  69. langchain_agentx/loop/model/tool_call_degradation_corrector.py +443 -0
  70. langchain_agentx/loop/model/tool_transcript_guard.py +225 -0
  71. langchain_agentx/loop/prompt/__init__.py +95 -0
  72. langchain_agentx/loop/prompt/builder.py +61 -0
  73. langchain_agentx/loop/prompt/builtin.py +218 -0
  74. langchain_agentx/loop/prompt/compact.py +408 -0
  75. langchain_agentx/loop/prompt/sections.py +120 -0
  76. langchain_agentx/loop/runtime/__init__.py +19 -0
  77. langchain_agentx/loop/runtime/context.py +34 -0
  78. langchain_agentx/loop/runtime/context_factory.py +107 -0
  79. langchain_agentx/loop/runtime/subagent_execution_paths.py +68 -0
  80. langchain_agentx/loop/subagent/__init__.py +53 -0
  81. langchain_agentx/loop/subagent/async_runner.py +215 -0
  82. langchain_agentx/loop/subagent/context.py +209 -0
  83. langchain_agentx/loop/subagent/fork_worktree_notice.py +25 -0
  84. langchain_agentx/loop/subagent/graph.py +72 -0
  85. langchain_agentx/loop/subagent/orchestrator.py +391 -0
  86. langchain_agentx/loop/subagent/progress.py +30 -0
  87. langchain_agentx/loop/subagent/prompt.py +52 -0
  88. langchain_agentx/loop/subagent/runner.py +504 -0
  89. langchain_agentx/loop/subagent/transcript.py +172 -0
  90. langchain_agentx/memory/__init__.py +2 -0
  91. langchain_agentx/memory/instruction/__init__.py +12 -0
  92. langchain_agentx/memory/instruction/loader.py +325 -0
  93. langchain_agentx/memory/instruction/resolver.py +24 -0
  94. langchain_agentx/memory/instruction/runtime.py +83 -0
  95. langchain_agentx/memory/instruction/sections.py +83 -0
  96. langchain_agentx/memory/instruction/types.py +59 -0
  97. langchain_agentx/memory/memdir/__init__.py +77 -0
  98. langchain_agentx/memory/memdir/age.py +36 -0
  99. langchain_agentx/memory/memdir/agent_memory.py +380 -0
  100. langchain_agentx/memory/memdir/extractor.py +309 -0
  101. langchain_agentx/memory/memdir/loader.py +187 -0
  102. langchain_agentx/memory/memdir/paths.py +63 -0
  103. langchain_agentx/memory/memdir/recall.py +45 -0
  104. langchain_agentx/memory/memdir/runtime.py +43 -0
  105. langchain_agentx/memory/memdir/scan.py +135 -0
  106. langchain_agentx/memory/memdir/types.py +104 -0
  107. langchain_agentx/memory/session/__init__.py +76 -0
  108. langchain_agentx/memory/session/compact_bridge.py +208 -0
  109. langchain_agentx/memory/session/prompts.py +172 -0
  110. langchain_agentx/memory/session/session_memory.py +282 -0
  111. langchain_agentx/observability/__init__.py +67 -0
  112. langchain_agentx/observability/evaluation/__init__.py +17 -0
  113. langchain_agentx/observability/evaluation/checkers/__init__.py +18 -0
  114. langchain_agentx/observability/evaluation/checkers/base.py +34 -0
  115. langchain_agentx/observability/evaluation/checkers/compaction.py +38 -0
  116. langchain_agentx/observability/evaluation/checkers/degradation.py +50 -0
  117. langchain_agentx/observability/evaluation/checkers/exit_quality.py +42 -0
  118. langchain_agentx/observability/evaluation/checkers/session_memory.py +45 -0
  119. langchain_agentx/observability/evaluation/checkers/tool_behavior.py +53 -0
  120. langchain_agentx/observability/evaluation/retention_scheduler.py +67 -0
  121. langchain_agentx/observability/evaluation/service.py +102 -0
  122. langchain_agentx/observability/evaluation/state.py +32 -0
  123. langchain_agentx/observability/evaluation/store.py +258 -0
  124. langchain_agentx/observability/events/__init__.py +15 -0
  125. langchain_agentx/observability/events/langchain_agentx_event_adapter.py +832 -0
  126. langchain_agentx/observability/logging/__init__.py +15 -0
  127. langchain_agentx/observability/logging/debug_burst.py +95 -0
  128. langchain_agentx/observability/logging/logging_config.py +178 -0
  129. langchain_agentx/observability/logging/logging_contract.py +65 -0
  130. langchain_agentx/observability/replay/__init__.py +35 -0
  131. langchain_agentx/observability/replay/cli.py +91 -0
  132. langchain_agentx/observability/replay/service.py +83 -0
  133. langchain_agentx/observability/replay/store.py +278 -0
  134. langchain_agentx/observability/replay/ui.py +47 -0
  135. langchain_agentx/observability/trace/__init__.py +25 -0
  136. langchain_agentx/observability/trace/collector.py +560 -0
  137. langchain_agentx/observability/trace/event_emitter.py +183 -0
  138. langchain_agentx/observability/trace/hook_event_emitter.py +49 -0
  139. langchain_agentx/observability/trace/models.py +144 -0
  140. langchain_agentx/observability/trace/sqlite_store.py +873 -0
  141. langchain_agentx/observability/trace/trace_callback.py +295 -0
  142. langchain_agentx/observability/trace/trace_lifecycle_collector.py +114 -0
  143. langchain_agentx/plugin/__init__.py +26 -0
  144. langchain_agentx/plugin/builtin.py +53 -0
  145. langchain_agentx/plugin/config.py +113 -0
  146. langchain_agentx/plugin/loader.py +386 -0
  147. langchain_agentx/plugin/manifest.py +154 -0
  148. langchain_agentx/plugin/registries.py +211 -0
  149. langchain_agentx/plugin/types.py +142 -0
  150. langchain_agentx/provider/__init__.py +27 -0
  151. langchain_agentx/provider/anthropic.py +121 -0
  152. langchain_agentx/provider/compatible_chat_openai.py +86 -0
  153. langchain_agentx/provider/env.py +45 -0
  154. langchain_agentx/provider/model_profile.py +156 -0
  155. langchain_agentx/provider/openai.py +89 -0
  156. langchain_agentx/session/__init__.py +17 -0
  157. langchain_agentx/session/agent_session.py +320 -0
  158. langchain_agentx/session/conversation_factory.py +87 -0
  159. langchain_agentx/session/conversation_recovery.py +156 -0
  160. langchain_agentx/session/conversation_session.py +198 -0
  161. langchain_agentx/session/factory.py +143 -0
  162. langchain_agentx/session/protocol.py +25 -0
  163. langchain_agentx/task_runtime/__init__.py +113 -0
  164. langchain_agentx/task_runtime/core/__init__.py +51 -0
  165. langchain_agentx/task_runtime/core/ids.py +33 -0
  166. langchain_agentx/task_runtime/core/interfaces.py +115 -0
  167. langchain_agentx/task_runtime/core/notification_priority.py +19 -0
  168. langchain_agentx/task_runtime/core/types.py +136 -0
  169. langchain_agentx/task_runtime/integrations/__init__.py +33 -0
  170. langchain_agentx/task_runtime/integrations/loop_adapter.py +91 -0
  171. langchain_agentx/task_runtime/integrations/loop_integration.py +61 -0
  172. langchain_agentx/task_runtime/integrations/prefetch_providers.py +108 -0
  173. langchain_agentx/task_runtime/integrations/provider_factory.py +103 -0
  174. langchain_agentx/task_runtime/integrations/queued_command_provider.py +184 -0
  175. langchain_agentx/task_runtime/integrations/sqlite_queued_command_provider.py +338 -0
  176. langchain_agentx/task_runtime/integrations/tool_use_summary_provider.py +254 -0
  177. langchain_agentx/task_runtime/orchestrator/__init__.py +5 -0
  178. langchain_agentx/task_runtime/orchestrator/runtime.py +386 -0
  179. langchain_agentx/task_runtime/output/__init__.py +5 -0
  180. langchain_agentx/task_runtime/output/sink.py +64 -0
  181. langchain_agentx/task_runtime/policy/__init__.py +11 -0
  182. langchain_agentx/task_runtime/policy/withhold_visibility.py +32 -0
  183. langchain_agentx/task_runtime/queue/__init__.py +5 -0
  184. langchain_agentx/task_runtime/queue/in_memory.py +55 -0
  185. langchain_agentx/task_runtime/skill_prefetch/__init__.py +4 -0
  186. langchain_agentx/task_runtime/skill_prefetch/attachments.py +46 -0
  187. langchain_agentx/task_runtime/skill_prefetch/models.py +37 -0
  188. langchain_agentx/task_runtime/skill_prefetch/provider.py +344 -0
  189. langchain_agentx/task_runtime/store/__init__.py +6 -0
  190. langchain_agentx/task_runtime/store/in_memory.py +81 -0
  191. langchain_agentx/task_runtime/store/sqlite_store.py +281 -0
  192. langchain_agentx/task_runtime/tasks/__init__.py +76 -0
  193. langchain_agentx/task_runtime/tasks/ai_analysis/__init__.py +15 -0
  194. langchain_agentx/task_runtime/tasks/ai_analysis/base.py +41 -0
  195. langchain_agentx/task_runtime/tasks/ai_analysis/evaluation.py +67 -0
  196. langchain_agentx/task_runtime/tasks/ai_analysis/registry.py +36 -0
  197. langchain_agentx/task_runtime/tasks/ai_analysis/scheduler.py +70 -0
  198. langchain_agentx/task_runtime/tasks/base/__init__.py +6 -0
  199. langchain_agentx/task_runtime/tasks/base/contracts.py +24 -0
  200. langchain_agentx/task_runtime/tasks/custom/__init__.py +7 -0
  201. langchain_agentx/task_runtime/tasks/custom/executor.py +60 -0
  202. langchain_agentx/task_runtime/tasks/custom/notification.py +7 -0
  203. langchain_agentx/task_runtime/tasks/custom/semantics.py +13 -0
  204. langchain_agentx/task_runtime/tasks/custom/spec.py +33 -0
  205. langchain_agentx/task_runtime/tasks/dream_task/__init__.py +15 -0
  206. langchain_agentx/task_runtime/tasks/dream_task/executor.py +61 -0
  207. langchain_agentx/task_runtime/tasks/dream_task/notification.py +19 -0
  208. langchain_agentx/task_runtime/tasks/dream_task/semantics.py +13 -0
  209. langchain_agentx/task_runtime/tasks/dream_task/spec.py +35 -0
  210. langchain_agentx/task_runtime/tasks/dream_task/state.py +17 -0
  211. langchain_agentx/task_runtime/tasks/in_process_teammate/__init__.py +12 -0
  212. langchain_agentx/task_runtime/tasks/in_process_teammate/executor.py +36 -0
  213. langchain_agentx/task_runtime/tasks/in_process_teammate/notification.py +25 -0
  214. langchain_agentx/task_runtime/tasks/in_process_teammate/semantics.py +13 -0
  215. langchain_agentx/task_runtime/tasks/in_process_teammate/spec.py +63 -0
  216. langchain_agentx/task_runtime/tasks/local_agent/__init__.py +14 -0
  217. langchain_agentx/task_runtime/tasks/local_agent/executor.py +33 -0
  218. langchain_agentx/task_runtime/tasks/local_agent/notification.py +21 -0
  219. langchain_agentx/task_runtime/tasks/local_agent/runner.py +43 -0
  220. langchain_agentx/task_runtime/tasks/local_agent/semantics.py +13 -0
  221. langchain_agentx/task_runtime/tasks/local_agent/spec.py +31 -0
  222. langchain_agentx/task_runtime/tasks/local_bash/__init__.py +13 -0
  223. langchain_agentx/task_runtime/tasks/local_bash/executor.py +95 -0
  224. langchain_agentx/task_runtime/tasks/local_bash/notification.py +22 -0
  225. langchain_agentx/task_runtime/tasks/local_bash/semantics.py +13 -0
  226. langchain_agentx/task_runtime/tasks/local_bash/spec.py +55 -0
  227. langchain_agentx/task_runtime/tasks/remote_agent/__init__.py +19 -0
  228. langchain_agentx/task_runtime/tasks/remote_agent/backend.py +76 -0
  229. langchain_agentx/task_runtime/tasks/remote_agent/executor.py +37 -0
  230. langchain_agentx/task_runtime/tasks/remote_agent/notification.py +22 -0
  231. langchain_agentx/task_runtime/tasks/remote_agent/semantics.py +13 -0
  232. langchain_agentx/task_runtime/tasks/remote_agent/spec.py +34 -0
  233. langchain_agentx/task_runtime/tasks/trace_cleanup/__init__.py +19 -0
  234. langchain_agentx/task_runtime/tasks/trace_cleanup/bootstrap.py +95 -0
  235. langchain_agentx/task_runtime/tasks/trace_cleanup/executor.py +66 -0
  236. langchain_agentx/task_runtime/tasks/trace_cleanup/scheduler.py +169 -0
  237. langchain_agentx/tool_runtime/__init__.py +90 -0
  238. langchain_agentx/tool_runtime/adapter.py +365 -0
  239. langchain_agentx/tool_runtime/base.py +319 -0
  240. langchain_agentx/tool_runtime/errors.py +190 -0
  241. langchain_agentx/tool_runtime/identical_call_cache.py +110 -0
  242. langchain_agentx/tool_runtime/loader.py +195 -0
  243. langchain_agentx/tool_runtime/models.py +260 -0
  244. langchain_agentx/tool_runtime/permission_context.py +78 -0
  245. langchain_agentx/tool_runtime/pipeline.py +621 -0
  246. langchain_agentx/tool_runtime/policy.py +447 -0
  247. langchain_agentx/tool_runtime/registry.py +81 -0
  248. langchain_agentx/tool_runtime/resolvers/__init__.py +27 -0
  249. langchain_agentx/tool_runtime/resolvers/agent_session.py +125 -0
  250. langchain_agentx/tool_runtime/resolvers/background.py +32 -0
  251. langchain_agentx/tool_runtime/resolvers/base.py +20 -0
  252. langchain_agentx/tool_runtime/resolvers/conversation.py +22 -0
  253. langchain_agentx/tool_runtime/resolvers/workflow.py +73 -0
  254. langchain_agentx/tool_runtime/session_store.py +132 -0
  255. langchain_agentx/tool_runtime/smoke_test_runtime.py +294 -0
  256. langchain_agentx/tool_runtime/state_bridge.py +164 -0
  257. langchain_agentx/tools/__init__.py +26 -0
  258. langchain_agentx/tools/agent/__init__.py +9 -0
  259. langchain_agentx/tools/agent/backend.py +53 -0
  260. langchain_agentx/tools/agent/built_in/__init__.py +19 -0
  261. langchain_agentx/tools/agent/built_in/agentx_guide.py +65 -0
  262. langchain_agentx/tools/agent/built_in/explore.py +80 -0
  263. langchain_agentx/tools/agent/built_in/general.py +57 -0
  264. langchain_agentx/tools/agent/built_in/plan.py +89 -0
  265. langchain_agentx/tools/agent/built_in/statusline_setup.py +64 -0
  266. langchain_agentx/tools/agent/built_in/verification.py +120 -0
  267. langchain_agentx/tools/agent/builtin_subagent_loader.py +89 -0
  268. langchain_agentx/tools/agent/cwd_resolution.py +119 -0
  269. langchain_agentx/tools/agent/limits.py +26 -0
  270. langchain_agentx/tools/agent/loader.py +270 -0
  271. langchain_agentx/tools/agent/models.py +85 -0
  272. langchain_agentx/tools/agent/prompt.py +120 -0
  273. langchain_agentx/tools/agent/registry/__init__.py +18 -0
  274. langchain_agentx/tools/agent/registry/config.py +29 -0
  275. langchain_agentx/tools/agent/registry/registry.py +47 -0
  276. langchain_agentx/tools/agent/scope.py +137 -0
  277. langchain_agentx/tools/agent/tool.py +256 -0
  278. langchain_agentx/tools/bash/__init__.py +9 -0
  279. langchain_agentx/tools/bash/ast_security.py +571 -0
  280. langchain_agentx/tools/bash/backend.py +1447 -0
  281. langchain_agentx/tools/bash/bash_hardening.py +734 -0
  282. langchain_agentx/tools/bash/bash_runtime_contract.py +41 -0
  283. langchain_agentx/tools/bash/cwd_reporter.py +95 -0
  284. langchain_agentx/tools/bash/limits.py +71 -0
  285. langchain_agentx/tools/bash/mode_validation.py +282 -0
  286. langchain_agentx/tools/bash/models.py +131 -0
  287. langchain_agentx/tools/bash/observability.py +148 -0
  288. langchain_agentx/tools/bash/output_utils.py +200 -0
  289. langchain_agentx/tools/bash/path_security.py +2429 -0
  290. langchain_agentx/tools/bash/prompt.py +68 -0
  291. langchain_agentx/tools/bash/read_only_validation.py +589 -0
  292. langchain_agentx/tools/bash/result_presenter.py +324 -0
  293. langchain_agentx/tools/bash/sandbox_decision.py +133 -0
  294. langchain_agentx/tools/bash/security.py +311 -0
  295. langchain_agentx/tools/bash/sed_edit_parser.py +243 -0
  296. langchain_agentx/tools/bash/sed_validation.py +163 -0
  297. langchain_agentx/tools/bash/semantics.py +111 -0
  298. langchain_agentx/tools/bash/session_manager.py +205 -0
  299. langchain_agentx/tools/bash/session_runtime.py +290 -0
  300. langchain_agentx/tools/bash/shell_locator.py +191 -0
  301. langchain_agentx/tools/bash/task_runtime.py +91 -0
  302. langchain_agentx/tools/bash/tool.py +939 -0
  303. langchain_agentx/tools/bash/windows_shell_quoting.py +45 -0
  304. langchain_agentx/tools/glob/__init__.py +9 -0
  305. langchain_agentx/tools/glob/models.py +57 -0
  306. langchain_agentx/tools/glob/pagination.py +30 -0
  307. langchain_agentx/tools/glob/prompt.py +24 -0
  308. langchain_agentx/tools/glob/rg_list_backend.py +139 -0
  309. langchain_agentx/tools/glob/rg_pattern.py +44 -0
  310. langchain_agentx/tools/glob/tool.py +327 -0
  311. langchain_agentx/tools/grep/__init__.py +7 -0
  312. langchain_agentx/tools/grep/backend.py +375 -0
  313. langchain_agentx/tools/grep/models.py +127 -0
  314. langchain_agentx/tools/grep/prompt.py +30 -0
  315. langchain_agentx/tools/grep/rg_subprocess_controller.py +114 -0
  316. langchain_agentx/tools/grep/tool.py +475 -0
  317. langchain_agentx/tools/read/__init__.py +9 -0
  318. langchain_agentx/tools/read/backend.py +415 -0
  319. langchain_agentx/tools/read/limits.py +67 -0
  320. langchain_agentx/tools/read/models.py +156 -0
  321. langchain_agentx/tools/read/prompt.py +73 -0
  322. langchain_agentx/tools/read/tool.py +494 -0
  323. langchain_agentx/tools/ripgrep_plugin_exclusions.py +137 -0
  324. langchain_agentx/tools/skill/__init__.py +4 -0
  325. langchain_agentx/tools/skill/argument_substitution.py +80 -0
  326. langchain_agentx/tools/skill/loader.py +196 -0
  327. langchain_agentx/tools/skill/models.py +88 -0
  328. langchain_agentx/tools/skill/policy.py +80 -0
  329. langchain_agentx/tools/skill/prompt.py +35 -0
  330. langchain_agentx/tools/skill/tool.py +222 -0
  331. langchain_agentx/utils/__init__.py +0 -0
  332. langchain_agentx/utils/cwd.py +124 -0
  333. langchain_agentx/utils/host_platform.py +112 -0
  334. langchain_agentx/utils/path_hierarchy.py +48 -0
  335. langchain_agentx/utils/path_user_input.py +66 -0
  336. langchain_agentx/utils/rg_executable.py +18 -0
  337. langchain_agentx/utils/subprocess_text.py +101 -0
  338. langchain_agentx/utils/temp_paths.py +77 -0
  339. langchain_agentx/utils/unc_path.py +25 -0
  340. langchain_agentx/utils/win_reserved_paths.py +51 -0
  341. langchain_agentx/workflow/__init__.py +7 -0
  342. langchain_agentx/workflow/base.py +97 -0
  343. langchain_agentx/workflow/batch.py +55 -0
  344. langchain_agentx/workflow/dag.py +54 -0
  345. langchain_agentx/workspace/__init__.py +13 -0
  346. langchain_agentx/workspace/config.py +140 -0
  347. langchain_agentx/workspace/path_key_normalizer.py +30 -0
  348. langchain_agentx/workspace/resolver.py +74 -0
  349. langchain_agentx/workspace/validators.py +41 -0
  350. langchain_agentx_python-0.1.dist-info/LICENSE +201 -0
  351. langchain_agentx_python-0.1.dist-info/METADATA +513 -0
  352. langchain_agentx_python-0.1.dist-info/RECORD +354 -0
  353. langchain_agentx_python-0.1.dist-info/WHEEL +5 -0
  354. langchain_agentx_python-0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,33 @@
1
+ """
2
+ task_runtime/core/ids.py — 任务与通知条目 ID 生成(R2 共享逻辑)
3
+
4
+ 职责:
5
+ 从 orchestrator 中抽出无状态的 ID 生成,避免编排层与领域类型混杂,
6
+ 便于单测与将来替换为 ULID/Snowflake 等策略。
7
+
8
+ 边界:
9
+ 仅本包使用;不保证跨进程全局唯一(与 CC 本地 task id 策略一致)。
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ from uuid import uuid4
15
+
16
+
17
+ def new_task_id() -> str:
18
+ return f"task_{uuid4().hex[:10]}"
19
+
20
+
21
+ def new_notification_command_id() -> str:
22
+ """``TaskNotificationEnvelope.command_id`` 用短 ID。"""
23
+ return f"cmd_{uuid4().hex[:10]}"
24
+
25
+
26
+ def new_run_id() -> str:
27
+ """§10.3 持久化任务 run 标识。"""
28
+ return f"run_{uuid4().hex[:12]}"
29
+
30
+
31
+ def new_reserved_batch_id() -> str:
32
+ """``ReservedNotificationBatch.batch_id``。"""
33
+ return f"batch_{uuid4().hex[:10]}"
@@ -0,0 +1,115 @@
1
+ """
2
+ task_runtime/core/interfaces.py — Task Runtime 抽象接口层(Protocol)
3
+
4
+ 职责:
5
+ 作为任务模块的稳定边界,定义可替换的抽象接口:
6
+ 1. TaskStore:任务记录存取与更新
7
+ 2. TaskCommandQueue:任务通知排队、按 scope/priority 读取、确认移除
8
+ 3. TaskRuntime:任务生命周期编排与通知消费协议
9
+
10
+ 设计意图:
11
+ - 让 loop 改造与 task 模块开发可并行推进
12
+ - 让 in-memory / 持久化 / 分布式实现可以无缝替换
13
+
14
+ 与 Agent Loop 的接线:
15
+ - 图节点消费的「多来源队列」协议见 ``task_runtime.integrations.loop_integration.QueuedCommandProvider``
16
+ - ``TaskRuntime`` 经 ``LoopTaskInjectionAdapter`` 适配为该协议
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ from typing import Iterable, Optional, Protocol
22
+
23
+ from .types import (
24
+ QueuePriority,
25
+ ReservedNotificationBatch,
26
+ TaskExecutionResult,
27
+ TaskRuntimeEvent,
28
+ TaskNotificationEnvelope,
29
+ TaskRecord,
30
+ TaskScope,
31
+ TaskSpec,
32
+ TaskStatus,
33
+ TaskType,
34
+ )
35
+
36
+
37
+ class TaskStore(Protocol):
38
+ def create(self, record: TaskRecord) -> None: ...
39
+ def get(self, task_id: str) -> Optional[TaskRecord]: ...
40
+ def update(self, task_id: str, patch: dict) -> Optional[TaskRecord]: ...
41
+ def list(self) -> Iterable[TaskRecord]: ...
42
+ def delete(self, task_id: str) -> None: ...
43
+ def evict_expired(self, *, now_ts: float, ttl_sec: float) -> int: ...
44
+ def evict_over_capacity(self, *, max_records: int) -> int: ...
45
+
46
+
47
+ class TaskCommandQueue(Protocol):
48
+ def enqueue(self, env: TaskNotificationEnvelope) -> None: ...
49
+ def peek_for_scope(
50
+ self, scope: TaskScope, max_priority: QueuePriority
51
+ ) -> list[TaskNotificationEnvelope]: ...
52
+ def remove(self, command_ids: list[str]) -> None: ...
53
+
54
+
55
+ class TaskRuntime(Protocol):
56
+ def spawn(self, spec: TaskSpec) -> str: ...
57
+ def cancel(self, task_id: str, reason: Optional[str] = None) -> None: ...
58
+ def mark_terminal(
59
+ self,
60
+ task_id: str,
61
+ status: TaskStatus,
62
+ summary: str,
63
+ *,
64
+ output_file: Optional[str] = None,
65
+ tool_use_id: Optional[str] = None,
66
+ usage: Optional[dict[str, int]] = None,
67
+ requires_action: bool = False,
68
+ terminal_reason: Optional[str] = None,
69
+ ) -> bool: ...
70
+ def drain_notifications(
71
+ self, scope: TaskScope, max_priority: QueuePriority
72
+ ) -> list[TaskNotificationEnvelope]: ...
73
+ def ack_notifications(self, command_ids: list[str]) -> None: ...
74
+ def reserve_notifications(
75
+ self,
76
+ scope: TaskScope,
77
+ max_priority: QueuePriority,
78
+ *,
79
+ limit: int = 8,
80
+ ) -> Optional[ReservedNotificationBatch]: ...
81
+ def ack_reserved(self, batch_id: str) -> None: ...
82
+ def nack_reserved(self, batch_id: str, *, requeue: bool = True) -> None: ...
83
+ def has_pending_notifications(
84
+ self, scope: TaskScope, max_priority: QueuePriority
85
+ ) -> bool: ...
86
+ def register_executor(
87
+ self, task_type: TaskType, executor: "TaskExecutor", *, overwrite: bool = False
88
+ ) -> None: ...
89
+ def run_task(self, task_id: str) -> bool: ...
90
+ def publish_progress(self, task_id: str, summary: str) -> bool: ...
91
+ def drain_events(self) -> list[TaskRuntimeEvent]: ...
92
+ # §10.2 前台等待(协议层轮询,不阻塞 LangGraph 主线程)
93
+ def wait_for_terminal(
94
+ self,
95
+ task_id: str,
96
+ *,
97
+ timeout_sec: Optional[float] = None,
98
+ poll_interval_sec: float = 0.02,
99
+ ) -> Optional[TaskStatus]: ...
100
+ # §10.4 持续输出(可选 sink)
101
+ def append_task_output(self, task_id: str, chunk: str) -> bool: ...
102
+ def read_task_output(self, task_id: str, offset: int = 0) -> tuple[str, int]: ...
103
+ # §10.3 租约与心跳
104
+ def heartbeat(
105
+ self,
106
+ task_id: str,
107
+ *,
108
+ worker_id: Optional[str] = None,
109
+ extend_sec: Optional[float] = None,
110
+ ) -> bool: ...
111
+ def reclaim_stale_running_tasks(self, *, now_ts: Optional[float] = None) -> list[str]: ...
112
+
113
+
114
+ class TaskExecutor(Protocol):
115
+ def execute(self, record: TaskRecord) -> TaskExecutionResult: ...
@@ -0,0 +1,19 @@
1
+ """
2
+ task_runtime/core/notification_priority.py — 终态 → 队列优先级映射(R2)
3
+
4
+ 职责:
5
+ 将 ``TaskStatus`` 映射到 ``QueuePriority``,供编排层在 ``mark_terminal`` 时
6
+ 入队通知;与 orchestrator 中历史 ``_priority_for_status`` 行为一致。
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from .types import QueuePriority, TaskStatus
12
+
13
+
14
+ def notification_priority_for_terminal_status(status: TaskStatus) -> QueuePriority:
15
+ if status == TaskStatus.FAILED:
16
+ return QueuePriority.NOW
17
+ if status == TaskStatus.COMPLETED:
18
+ return QueuePriority.NEXT
19
+ return QueuePriority.LATER
@@ -0,0 +1,136 @@
1
+ """
2
+ task_runtime/core/types.py — Task Runtime 领域类型定义
3
+
4
+ 职责:
5
+ 定义任务调度领域的统一类型,作为 loop / tools / integrations 共享契约:
6
+ 1. 任务基础语义(TaskType / TaskStatus)
7
+ 2. 队列调度语义(QueuePriority)
8
+ 3. 作用域语义(TaskScope,用于 agent_id 隔离)
9
+ 4. 输入与持久化记录语义(TaskSpec / TaskRecord)
10
+ 5. 通知协议语义(TaskNotificationEnvelope)
11
+
12
+ 边界约束:
13
+ - 本文件不依赖 LangGraph、ToolNode 或具体工具实现
14
+ - 保持“纯领域类型”,便于并行开发与后续接入
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ from dataclasses import dataclass, field
20
+ from enum import Enum
21
+ from typing import Any, Optional
22
+ import time
23
+
24
+
25
+ class TaskType(str, Enum):
26
+ LOCAL_AGENT = "local_agent"
27
+ LOCAL_BASH = "local_bash"
28
+ DREAM_TASK = "dream_task"
29
+ REMOTE_AGENT = "remote_agent"
30
+ IN_PROCESS_TEAMMATE = "in_process_teammate"
31
+ CUSTOM = "custom"
32
+
33
+
34
+ class TaskStatus(str, Enum):
35
+ PENDING = "pending"
36
+ RUNNING = "running"
37
+ COMPLETED = "completed"
38
+ FAILED = "failed"
39
+ STOPPED = "stopped"
40
+
41
+
42
+ class QueuePriority(str, Enum):
43
+ NOW = "now"
44
+ NEXT = "next"
45
+ LATER = "later"
46
+
47
+
48
+ class TaskRuntimeEventType(str, Enum):
49
+ STARTED = "started"
50
+ PROGRESS = "progress"
51
+ TERMINAL = "terminal"
52
+
53
+
54
+ @dataclass(frozen=True)
55
+ class TaskScope:
56
+ """Task scope for queue drain isolation.
57
+
58
+ agent_id=None means main-thread scope.
59
+ """
60
+
61
+ agent_id: Optional[str] = None
62
+
63
+
64
+ @dataclass
65
+ class TaskSpec:
66
+ task_type: TaskType
67
+ description: str
68
+ input: dict[str, Any]
69
+ scope: TaskScope
70
+ metadata: dict[str, Any] = field(default_factory=dict)
71
+
72
+
73
+ @dataclass
74
+ class TaskRecord:
75
+ task_id: str
76
+ task_type: TaskType
77
+ status: TaskStatus
78
+ description: str
79
+ scope: TaskScope
80
+ input: dict[str, Any] = field(default_factory=dict)
81
+ metadata: dict[str, Any] = field(default_factory=dict)
82
+ created_at: float = field(default_factory=time.time)
83
+ updated_at: float = field(default_factory=time.time)
84
+ output_file: Optional[str] = None
85
+ terminal_emitted_statuses: set[TaskStatus] = field(default_factory=set)
86
+ notification_consumed: bool = False
87
+ # §10.3 运行中恢复:spawn/run 写入,heartbeat 续租,reclaim 回收
88
+ run_id: Optional[str] = None
89
+ external_ref: Optional[str] = None
90
+ lease_until_ts: Optional[float] = None
91
+ last_heartbeat_ts: Optional[float] = None
92
+ worker_id: Optional[str] = None
93
+
94
+
95
+ @dataclass(frozen=True)
96
+ class TaskNotificationEnvelope:
97
+ command_id: str
98
+ task_id: str
99
+ task_type: TaskType
100
+ status: TaskStatus
101
+ summary: str
102
+ scope: TaskScope
103
+ priority: QueuePriority = QueuePriority.LATER
104
+ output_file: Optional[str] = None
105
+ tool_use_id: Optional[str] = None
106
+ usage: Optional[dict[str, int]] = None
107
+ requires_action: bool = False
108
+ terminal_reason: Optional[str] = None
109
+
110
+
111
+ @dataclass(frozen=True)
112
+ class ReservedNotificationBatch:
113
+ batch_id: str
114
+ scope: TaskScope
115
+ items: list[TaskNotificationEnvelope]
116
+
117
+
118
+ @dataclass(frozen=True)
119
+ class TaskExecutionResult:
120
+ status: TaskStatus
121
+ summary: str
122
+ output_file: Optional[str] = None
123
+ tool_use_id: Optional[str] = None
124
+ usage: Optional[dict[str, int]] = None
125
+
126
+
127
+ @dataclass(frozen=True)
128
+ class TaskRuntimeEvent:
129
+ event_type: TaskRuntimeEventType
130
+ task_id: str
131
+ task_type: TaskType
132
+ status: TaskStatus
133
+ summary: str
134
+ scope: TaskScope
135
+ terminal_reason: Optional[str] = None
136
+ created_at: float = field(default_factory=time.time)
@@ -0,0 +1,33 @@
1
+ from .loop_adapter import LoopInjectionBatch, LoopTaskInjectionAdapter
2
+ from .loop_integration import (
3
+ QueuedCommandProvider,
4
+ decode_provider_batch_id,
5
+ encode_provider_batch_id,
6
+ )
7
+ from .queued_command_provider import (
8
+ InMemoryQueuedCommandProvider,
9
+ QueuedCommandEnvelope,
10
+ )
11
+ from .prefetch_providers import MemoryPrefetchProvider
12
+ from ..skill_prefetch import SkillPrefetchProvider
13
+ from .tool_use_summary_provider import ToolUseSummaryProvider
14
+ from .sqlite_queued_command_provider import SqliteQueuedCommandProvider
15
+ from .provider_factory import ProviderBundle, ProviderFactoryConfig, build_provider_bundle
16
+
17
+ __all__ = [
18
+ "LoopInjectionBatch",
19
+ "LoopTaskInjectionAdapter",
20
+ "QueuedCommandProvider",
21
+ "encode_provider_batch_id",
22
+ "decode_provider_batch_id",
23
+ "InMemoryQueuedCommandProvider",
24
+ "QueuedCommandEnvelope",
25
+ "MemoryPrefetchProvider",
26
+ "SkillPrefetchProvider",
27
+ "ToolUseSummaryProvider",
28
+ "SqliteQueuedCommandProvider",
29
+ "ProviderFactoryConfig",
30
+ "ProviderBundle",
31
+ "build_provider_bundle",
32
+ ]
33
+
@@ -0,0 +1,91 @@
1
+ """
2
+ task_runtime/integrations/loop_adapter.py — Loop 集成适配层
3
+
4
+ 职责:
5
+ TaskRuntime 与 loop 图节点之间的边界层,负责:
6
+ 1. 从 runtime 读取可消费任务通知(按 scope / priority)
7
+ 2. 转换为 loop 可注入的 attachment message 结构
8
+ 3. 在 loop 消费后进行 ack,防止重复注入
9
+
10
+ 边界说明:
11
+ - 仅负责协议映射,不承担任务执行与状态机职责
12
+ - 便于后续在 `post_tools/attachment_injection` 节点直接接线
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ from dataclasses import dataclass
18
+ from typing import Any
19
+
20
+ from ..core.interfaces import TaskRuntime
21
+ from ..core.types import QueuePriority, TaskNotificationEnvelope, TaskScope
22
+
23
+
24
+ @dataclass(frozen=True)
25
+ class LoopInjectionBatch:
26
+ batch_id: str
27
+ command_ids: list[str]
28
+ attachment_messages: list[dict]
29
+
30
+
31
+ def _to_attachment_message(env: TaskNotificationEnvelope) -> dict:
32
+ text = f"[task_notification] task_id={env.task_id} status={env.status.value} summary={env.summary}"
33
+ return {
34
+ "role": "user",
35
+ "content": [{"type": "text", "text": text}],
36
+ "metadata": {
37
+ "task_notification": {
38
+ "command_id": env.command_id,
39
+ "task_id": env.task_id,
40
+ "status": env.status.value,
41
+ "priority": env.priority.value,
42
+ "output_file": env.output_file,
43
+ "terminal_reason": env.terminal_reason,
44
+ }
45
+ },
46
+ }
47
+
48
+
49
+ class LoopTaskInjectionAdapter:
50
+ """Convert queued task notifications into loop-consumable messages."""
51
+
52
+ def __init__(self, runtime: TaskRuntime) -> None:
53
+ self._runtime = runtime
54
+
55
+ def build_batch(
56
+ self,
57
+ scope: TaskScope,
58
+ max_priority: QueuePriority = QueuePriority.NEXT,
59
+ *,
60
+ limit: int = 8,
61
+ ) -> LoopInjectionBatch:
62
+ reserved = self._runtime.reserve_notifications(
63
+ scope=scope,
64
+ max_priority=max_priority,
65
+ limit=limit,
66
+ )
67
+ if not reserved:
68
+ return LoopInjectionBatch(batch_id="", command_ids=[], attachment_messages=[])
69
+ return LoopInjectionBatch(
70
+ batch_id=reserved.batch_id,
71
+ command_ids=[item.command_id for item in reserved.items],
72
+ attachment_messages=[_to_attachment_message(item) for item in reserved.items],
73
+ )
74
+
75
+ def ack_batch(self, batch: LoopInjectionBatch) -> None:
76
+ if batch.batch_id:
77
+ self._runtime.ack_reserved(batch.batch_id)
78
+
79
+ def nack_batch(self, batch: LoopInjectionBatch, *, requeue: bool = True) -> None:
80
+ if batch.batch_id:
81
+ self._runtime.nack_reserved(batch.batch_id, requeue=requeue)
82
+
83
+ def has_pending(
84
+ self, scope: TaskScope, max_priority: QueuePriority = QueuePriority.NEXT
85
+ ) -> bool:
86
+ return self._runtime.has_pending_notifications(scope, max_priority)
87
+
88
+ def ingest_from_messages(self, *, scope: TaskScope, messages: list[Any]) -> int:
89
+ """TaskRuntime 无 messages 桥接;占位以满足 `QueuedCommandProvider` 契约。"""
90
+ return 0
91
+
@@ -0,0 +1,61 @@
1
+ """
2
+ task_runtime/integrations/loop_integration.py — Agent Loop 与 task_runtime 的契约面
3
+
4
+ 职责:
5
+ 1. **QueuedCommandProvider**:`create_loop_agent` 中 `task_event_commit_ack` /
6
+ `task_event_reserve` 节点消费的统一协议(与 `LoopTaskInjectionAdapter` 同形)。
7
+ 2. **批次 id 编解码**:多 provider 链下 `pending_task_batch_id` 使用 `p{index}:{batch_id}`,
8
+ 与 loop 图实现一致,供单测与外部工具复用。
9
+
10
+ 边界:
11
+ - 不包含 LangGraph 节点实现(见 `loop/graph/factory.py`)
12
+ - `TaskRuntime` 本体协议见 `task_runtime.core.interfaces.TaskRuntime`
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ from typing import Any, Protocol
18
+
19
+ from ..core.types import QueuePriority, TaskScope
20
+ from .loop_adapter import LoopInjectionBatch
21
+
22
+
23
+ class QueuedCommandProvider(Protocol):
24
+ """供 Agent Loop `task_event_*` 链调用的 queued-command 来源(task / prefetch / summary 等)。"""
25
+
26
+ def build_batch(
27
+ self,
28
+ scope: TaskScope,
29
+ max_priority: QueuePriority = QueuePriority.NEXT,
30
+ *,
31
+ limit: int = 8,
32
+ ) -> LoopInjectionBatch: ...
33
+
34
+ def ack_batch(self, batch: LoopInjectionBatch) -> None: ...
35
+
36
+ def nack_batch(self, batch: LoopInjectionBatch, *, requeue: bool = True) -> None: ...
37
+
38
+ def has_pending(
39
+ self, scope: TaskScope, max_priority: QueuePriority = QueuePriority.NEXT
40
+ ) -> bool: ...
41
+
42
+ def ingest_from_messages(self, *, scope: TaskScope, messages: list[Any]) -> int:
43
+ """reserve 前由 loop 调用;将当前轮 `messages` 桥接到队列(无则返回 0)。"""
44
+
45
+
46
+ def encode_provider_batch_id(provider_index: int, batch_id: str) -> str:
47
+ """与 `create_loop_agent` 中 `pending_task_batch_id` 编码一致。"""
48
+ return f"p{provider_index}:{batch_id}"
49
+
50
+
51
+ def decode_provider_batch_id(encoded: str) -> tuple[int, str] | None:
52
+ """解码 `encode_provider_batch_id`;非法输入返回 None。"""
53
+ if not isinstance(encoded, str) or ":" not in encoded:
54
+ return None
55
+ prefix, raw_batch_id = encoded.split(":", 1)
56
+ if not prefix.startswith("p"):
57
+ return None
58
+ try:
59
+ return int(prefix[1:]), raw_batch_id
60
+ except ValueError:
61
+ return None
@@ -0,0 +1,108 @@
1
+ """
2
+ task_runtime/integrations/prefetch_providers.py — 预取类 queued-command provider
3
+
4
+ 职责:
5
+ 基于通用 InMemoryQueuedCommandProvider 封装 memory 预取来源:
6
+ 1. MemoryPrefetchProvider:注入 memory 预取结果
7
+
8
+ 边界:
9
+ - 仅负责“把外部结果转为 queued command”
10
+ - 不承担 loop 路由与 task 生命周期管理
11
+ """
12
+ from __future__ import annotations
13
+
14
+ from typing import Any
15
+
16
+ from ..core.types import QueuePriority, TaskScope
17
+ from .loop_adapter import LoopInjectionBatch
18
+ from .queued_command_provider import InMemoryQueuedCommandProvider, QueuedCommandEnvelope
19
+
20
+
21
+ class MemoryPrefetchProvider:
22
+ """将 memory 预取结果转换为 queued commands。"""
23
+
24
+ def __init__(
25
+ self,
26
+ backend: InMemoryQueuedCommandProvider | None = None,
27
+ *,
28
+ max_queue_size: int | None = None,
29
+ ttl_sec: float | None = None,
30
+ ) -> None:
31
+ self._backend = backend or InMemoryQueuedCommandProvider(
32
+ max_queue_size=max_queue_size,
33
+ ttl_sec=ttl_sec,
34
+ )
35
+
36
+ def ingest_memory_items(
37
+ self,
38
+ *,
39
+ scope: TaskScope,
40
+ items: list[dict[str, Any]],
41
+ priority: QueuePriority = QueuePriority.NEXT,
42
+ ) -> int:
43
+ count = 0
44
+ for item in items:
45
+ memory_id = str(item.get("memory_id") or f"mem_{count}")
46
+ summary = str(item.get("summary") or "").strip() or "memory prefetch result"
47
+ self._backend.enqueue(
48
+ QueuedCommandEnvelope(
49
+ command_id=f"mem_{memory_id}",
50
+ source="memory_prefetch",
51
+ summary=summary,
52
+ scope=scope,
53
+ priority=priority,
54
+ payload=item,
55
+ dedup_key=f"memory:{memory_id}",
56
+ )
57
+ )
58
+ count += 1
59
+ return count
60
+
61
+ def ingest_from_context_messages(
62
+ self,
63
+ *,
64
+ scope: TaskScope,
65
+ messages: list,
66
+ priority: QueuePriority = QueuePriority.NEXT,
67
+ limit: int = 8,
68
+ ) -> int:
69
+ """从 loop/context 消息中提取可预取记忆(real-source bridge)。"""
70
+ items: list[dict[str, Any]] = []
71
+ for msg in messages[-limit:]:
72
+ content = getattr(msg, "content", None)
73
+ if isinstance(content, str) and content.strip():
74
+ items.append(
75
+ {
76
+ "memory_id": f"msg_{len(items)}",
77
+ "summary": content.strip()[:120],
78
+ "source": "context_message",
79
+ }
80
+ )
81
+ return self.ingest_memory_items(scope=scope, items=items, priority=priority)
82
+
83
+ def build_batch(
84
+ self,
85
+ scope: TaskScope,
86
+ max_priority: QueuePriority = QueuePriority.NEXT,
87
+ *,
88
+ limit: int = 8,
89
+ ) -> LoopInjectionBatch:
90
+ return self._backend.build_batch(scope, max_priority=max_priority, limit=limit)
91
+
92
+ def ack_batch(self, batch: LoopInjectionBatch) -> None:
93
+ self._backend.ack_batch(batch)
94
+
95
+ def nack_batch(self, batch: LoopInjectionBatch, *, requeue: bool = True) -> None:
96
+ self._backend.nack_batch(batch, requeue=requeue)
97
+
98
+ def has_pending(
99
+ self, scope: TaskScope, max_priority: QueuePriority = QueuePriority.NEXT
100
+ ) -> bool:
101
+ return self._backend.has_pending(scope, max_priority=max_priority)
102
+
103
+ def ingest_from_messages(
104
+ self, *, scope: TaskScope, messages: list
105
+ ) -> int:
106
+ return self.ingest_from_context_messages(scope=scope, messages=messages)
107
+
108
+