langchain-agentx-python 2.5.3__py3-none-any.whl → 2.5.4__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.
- langchain_agentx/__init__.py +1 -1
- langchain_agentx/loop/stream/loop_driver.py +6 -0
- langchain_agentx/workflow/execution.py +35 -6
- {langchain_agentx_python-2.5.3.dist-info → langchain_agentx_python-2.5.4.dist-info}/METADATA +1 -1
- {langchain_agentx_python-2.5.3.dist-info → langchain_agentx_python-2.5.4.dist-info}/RECORD +8 -8
- {langchain_agentx_python-2.5.3.dist-info → langchain_agentx_python-2.5.4.dist-info}/LICENSE +0 -0
- {langchain_agentx_python-2.5.3.dist-info → langchain_agentx_python-2.5.4.dist-info}/WHEEL +0 -0
- {langchain_agentx_python-2.5.3.dist-info → langchain_agentx_python-2.5.4.dist-info}/top_level.txt +0 -0
langchain_agentx/__init__.py
CHANGED
|
@@ -119,6 +119,12 @@ class LoopStreamDriver:
|
|
|
119
119
|
finally:
|
|
120
120
|
unregister_agent_loop(agent_loop)
|
|
121
121
|
self._log_stream_closeout_summary()
|
|
122
|
+
# 与 closeout 摘要分离:generator 即将退出时打点(Doc-36 C-DRV-1)。
|
|
123
|
+
logger.info(
|
|
124
|
+
"loop_stream_driver_exited: graph_completed=%s raw_events_consumed=%s",
|
|
125
|
+
self.result.graph_completed,
|
|
126
|
+
self.result.raw_events_consumed,
|
|
127
|
+
)
|
|
122
128
|
|
|
123
129
|
async def _stream_single_drain(
|
|
124
130
|
self,
|
|
@@ -20,6 +20,7 @@ workflow/execution.py — Workflow 到 loop graph 的执行边界 SSOT
|
|
|
20
20
|
from __future__ import annotations
|
|
21
21
|
|
|
22
22
|
import asyncio
|
|
23
|
+
import logging
|
|
23
24
|
from collections.abc import AsyncIterator, Iterable
|
|
24
25
|
from dataclasses import dataclass
|
|
25
26
|
from typing import Any, ClassVar
|
|
@@ -34,6 +35,8 @@ from ..observability.events.finish_outcome import (
|
|
|
34
35
|
)
|
|
35
36
|
from .runtime import WorkflowAgentRuntime, WorkflowGraphFactory
|
|
36
37
|
|
|
38
|
+
logger = logging.getLogger(__name__)
|
|
39
|
+
|
|
37
40
|
|
|
38
41
|
class DuplicateSpecTaskKeyError(ValueError):
|
|
39
42
|
"""同一 workflow 内 spec task_key 重复。"""
|
|
@@ -367,13 +370,18 @@ class WorkflowAgentLoopExecutor:
|
|
|
367
370
|
assert_loop_owner_binding(context)
|
|
368
371
|
self._link_trace(invocation.session_id, context.workflow_id)
|
|
369
372
|
driver = LoopStreamDriver()
|
|
370
|
-
|
|
373
|
+
agen = self._stream_loop_driver_events(
|
|
371
374
|
driver,
|
|
372
375
|
invocation,
|
|
373
376
|
context=context,
|
|
374
377
|
version=version,
|
|
375
|
-
)
|
|
376
|
-
|
|
378
|
+
)
|
|
379
|
+
try:
|
|
380
|
+
async for event in agen:
|
|
381
|
+
yield event
|
|
382
|
+
finally:
|
|
383
|
+
# 与 run_invocation drain 对称:外部 cancel / 提前 break 也回收 _producer。
|
|
384
|
+
await agen.aclose()
|
|
377
385
|
|
|
378
386
|
def _link_trace(self, session_id: str, workflow_id: str) -> None:
|
|
379
387
|
if self._trace_collector is not None:
|
|
@@ -403,13 +411,18 @@ class WorkflowAgentLoopExecutor:
|
|
|
403
411
|
version: str = "v2",
|
|
404
412
|
) -> None:
|
|
405
413
|
"""W4:存在 RunContext 时将 loop drain 注册为 child task,便于 cancel_tree。"""
|
|
406
|
-
|
|
414
|
+
agen = self._stream_loop_driver_events(
|
|
407
415
|
driver,
|
|
408
416
|
invocation,
|
|
409
417
|
context=context,
|
|
410
418
|
version=version,
|
|
411
|
-
)
|
|
412
|
-
|
|
419
|
+
)
|
|
420
|
+
try:
|
|
421
|
+
async for _ in agen:
|
|
422
|
+
pass
|
|
423
|
+
finally:
|
|
424
|
+
# 取消路径下 async for 未必可靠触发 aclose;显式回收 _producer(Doc-36)。
|
|
425
|
+
await agen.aclose()
|
|
413
426
|
|
|
414
427
|
async def _stream_loop_driver_events(
|
|
415
428
|
self,
|
|
@@ -431,8 +444,11 @@ class WorkflowAgentLoopExecutor:
|
|
|
431
444
|
return
|
|
432
445
|
|
|
433
446
|
queue: asyncio.Queue[dict[str, Any] | None] = asyncio.Queue()
|
|
447
|
+
session_id = invocation.session_id
|
|
448
|
+
workflow_id = context.workflow_id
|
|
434
449
|
|
|
435
450
|
async def _producer() -> None:
|
|
451
|
+
exit_reason = "completed"
|
|
436
452
|
try:
|
|
437
453
|
async for event in self._iter_loop_driver_events(
|
|
438
454
|
driver,
|
|
@@ -441,8 +457,21 @@ class WorkflowAgentLoopExecutor:
|
|
|
441
457
|
version=version,
|
|
442
458
|
):
|
|
443
459
|
await queue.put(event)
|
|
460
|
+
except asyncio.CancelledError:
|
|
461
|
+
exit_reason = "cancelled"
|
|
462
|
+
raise
|
|
463
|
+
except BaseException:
|
|
464
|
+
exit_reason = "error"
|
|
465
|
+
raise
|
|
444
466
|
finally:
|
|
445
467
|
await queue.put(None)
|
|
468
|
+
# 与 Loop stream closeout 分离:证明 producer 真正退出(Doc-36 C-EXEC-1)。
|
|
469
|
+
logger.info(
|
|
470
|
+
"workflow_loop_producer_exited: session_id=%s workflow_id=%s reason=%s",
|
|
471
|
+
session_id,
|
|
472
|
+
workflow_id,
|
|
473
|
+
exit_reason,
|
|
474
|
+
)
|
|
446
475
|
|
|
447
476
|
task = asyncio.create_task(_producer())
|
|
448
477
|
# W4:挂到 cancel authority(outermost),避免 Parallelization nested
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
langchain_agentx/__init__.py,sha256=
|
|
1
|
+
langchain_agentx/__init__.py,sha256=txTBcgXr7Xw-oHfjbzY2qrH5IiKHJZLiQ3euISHsx4A,2014
|
|
2
2
|
langchain_agentx/command/__init__.py,sha256=Ej260S5uFQcmEtGZQG_NH7BYjHoStrpBLtGUsBTxyZk,631
|
|
3
3
|
langchain_agentx/command/allowed_tools.py,sha256=TVA0VM8rm98H-QbLK_GRiX5RhEAZFxKawliMi4kk96A,3359
|
|
4
4
|
langchain_agentx/command/context.py,sha256=DIGOGPBw5UGDBm0WNNJlKx1h_9rCRmcdROv4DT61Qug,731
|
|
@@ -137,7 +137,7 @@ langchain_agentx/loop/runtime/context_factory.py,sha256=KWD0ojHxhE3PgG-TBrY6KsBD
|
|
|
137
137
|
langchain_agentx/loop/runtime/subagent_execution_paths.py,sha256=Bgyiom48uta1FZcnIE7fIxyrD-VFCRsw7s8IxIxmLb4,4033
|
|
138
138
|
langchain_agentx/loop/stream/graph_driver.py,sha256=qMZHEw3wJ19Tfbz31-VPLy8Mt6e90xKougIjAoaEFCE,3935
|
|
139
139
|
langchain_agentx/loop/stream/helpers.py,sha256=b2sqtwrAa5ic5B5AzNqItU8pmDHw13iGs3hBiShSIZk,1390
|
|
140
|
-
langchain_agentx/loop/stream/loop_driver.py,sha256=
|
|
140
|
+
langchain_agentx/loop/stream/loop_driver.py,sha256=lJj5jPo7jpffNlC_VI35ZL9nf50lhPRyKJK0UVrEP6g,25675
|
|
141
141
|
langchain_agentx/loop/stream/result.py,sha256=xQb9r1cxGCQpoAZ0gNo71CjhSE3eYOiYp5KnoOBzBF8,1131
|
|
142
142
|
langchain_agentx/loop/stream/synthetic_events.py,sha256=Z3JT3iTuB9UQOoQXUprAYvaFV0vXEAuf5iqXYH9YSyI,2175
|
|
143
143
|
langchain_agentx/loop/stream/transcript_gate.py,sha256=4AH3O0l8OrY_GQdqf-TOKOVS3selPLUC0jYLWQUTfkg,4690
|
|
@@ -835,7 +835,7 @@ langchain_agentx/workflow/catalog_registry.py,sha256=tYUny5FkHwQU-RRUxOdxaJhiRV_
|
|
|
835
835
|
langchain_agentx/workflow/dag.py,sha256=Y1IR1IwnM79Xuev6HZnOvAE3Q23MRnA9lu4vg2Cie48,4469
|
|
836
836
|
langchain_agentx/workflow/display_enricher.py,sha256=2HJ4xJI8H4hwBoWHAi6D_LwE-dcbZD_pafnS7DMDYZ4,6147
|
|
837
837
|
langchain_agentx/workflow/display_resolver.py,sha256=hEaljqprjubG82zeqLOEeQ32AMAxaZwvwaLq3v-yt3c,10119
|
|
838
|
-
langchain_agentx/workflow/execution.py,sha256=
|
|
838
|
+
langchain_agentx/workflow/execution.py,sha256=1_-c_UFT0mKU9D8uHnwup9FBWveoWA0Vm7WRYKg5Nw4,20261
|
|
839
839
|
langchain_agentx/workflow/loop_factory.py,sha256=hCShf_gDnesW2A9JspaUY3upp3NCIguII_wRiXnSIUM,3954
|
|
840
840
|
langchain_agentx/workflow/memory_drain_registry.py,sha256=Xm_ytbB-BbRIu3-h-KhptsCsmmueOiNZePUuG1hk8zk,1681
|
|
841
841
|
langchain_agentx/workflow/memory_session_policy.py,sha256=2FI0ZbAA6MnxJexnLYLadQpiqipPQwVnUrTWgl55A74,3333
|
|
@@ -894,8 +894,8 @@ langchain_agentx/workspace/root_grant_manager.py,sha256=W3gy8HTevbERbXqIgRcjzOXO
|
|
|
894
894
|
langchain_agentx/workspace/tool_boundary.py,sha256=UDwX6swpSLsx9HNkYuuRRiV5o7ZZG_Bru2Yn0c5kNX8,5724
|
|
895
895
|
langchain_agentx/workspace/validators.py,sha256=tQt-6TOcL8Fw7Ig5ebA9S7vGWh1rby920eFW6x8Tk9E,1439
|
|
896
896
|
langchain_agentx/workspace/view.py,sha256=PGasqTaqhlD03SXXazHuw4RHfV681AIdlsYqL70pEjc,4774
|
|
897
|
-
langchain_agentx_python-2.5.
|
|
898
|
-
langchain_agentx_python-2.5.
|
|
899
|
-
langchain_agentx_python-2.5.
|
|
900
|
-
langchain_agentx_python-2.5.
|
|
901
|
-
langchain_agentx_python-2.5.
|
|
897
|
+
langchain_agentx_python-2.5.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
898
|
+
langchain_agentx_python-2.5.4.dist-info/METADATA,sha256=LnClHQwGDqXb8fW2qWJYmQlFL04ZHEeGym0Yz2AhQ4w,23971
|
|
899
|
+
langchain_agentx_python-2.5.4.dist-info/WHEEL,sha256=51RkbunBAw4BWsgaQWTpPhg4Diwp3c9P5iaLk67Hdtg,92
|
|
900
|
+
langchain_agentx_python-2.5.4.dist-info/top_level.txt,sha256=Ge284pniNt8xea0OLk2o9o32GqVpDhOYk20fwE-0xxA,17
|
|
901
|
+
langchain_agentx_python-2.5.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{langchain_agentx_python-2.5.3.dist-info → langchain_agentx_python-2.5.4.dist-info}/top_level.txt
RENAMED
|
File without changes
|