langchain-agentx-python 1.2.0__py3-none-any.whl → 1.2.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.
@@ -11,7 +11,7 @@ from langchain_agentx import create_loop_agent
11
11
  ```
12
12
  """
13
13
 
14
- __version__ = "1.2.0"
14
+ __version__ = "1.2.1"
15
15
 
16
16
  from .loop import ( # noqa: F401
17
17
  create_loop_agent,
@@ -69,7 +69,6 @@ from .models import (
69
69
  ToolResultEnvelope,
70
70
  )
71
71
  from .permission_orchestrator import aevaluate_permission, evaluate_permission
72
- from .policy import ensure_default_policy_engine
73
72
  from .override import enrich_blocked_deny_envelope
74
73
  from .denial_tracking_bridge import (
75
74
  attach_denial_tracking_meta,
@@ -730,7 +729,6 @@ class ToolExecutorPipeline:
730
729
  )
731
730
 
732
731
  # Step 4: check_permissions(PermissionOrchestrator 单入口)
733
- ensure_default_policy_engine(tool)
734
732
  auth = evaluate_permission(tool, parsed_data, ctx, headless=self._headless)
735
733
  if auth.behavior == "deny":
736
734
  logger.warning("tool permission denied tool=%s policy_id=%s", tool.name, auth.policy_id)
@@ -922,7 +920,6 @@ class ToolExecutorPipeline:
922
920
  )
923
921
 
924
922
  # Step 4: check_permissions(PermissionOrchestrator 单入口)
925
- ensure_default_policy_engine(tool)
926
923
  auth = await aevaluate_permission(tool, parsed_data, ctx, headless=self._headless)
927
924
 
928
925
  if auth.behavior == "deny":
@@ -23,6 +23,7 @@ import os
23
23
  import pathlib
24
24
  import sys
25
25
  import tempfile
26
+ from typing import Any
26
27
 
27
28
  from pydantic import BaseModel
28
29
 
@@ -46,6 +47,18 @@ from langchain_agentx.tool_runtime.registry import RuntimeToolRegistry
46
47
  from langchain_agentx.tool_runtime.session_store import AgentSessionStore
47
48
  from langchain_agentx.tool_runtime.state_bridge import ToolStateBridge
48
49
 
50
+ from tests._common.tool_policy_assembly import mirror_loader_policy_on_tool
51
+
52
+
53
+ def _pipeline_run(
54
+ pipeline: ToolExecutorPipeline,
55
+ tool: RuntimeTool,
56
+ raw_input: dict[str, Any],
57
+ ctx: ToolExecutionContext,
58
+ ) -> ToolResultEnvelope:
59
+ mirror_loader_policy_on_tool(tool, ctx)
60
+ return pipeline.run(tool=tool, raw_input=raw_input, ctx=ctx)
61
+
49
62
  # ---------------------------------------------------------------------------
50
63
  # 最小工具定义(所有测试共用)
51
64
  # ---------------------------------------------------------------------------
@@ -118,7 +131,7 @@ def test_normal_flow() -> None:
118
131
  _section("Test 1: 正常工具流转")
119
132
  pipeline = ToolExecutorPipeline()
120
133
  ctx = _make_ctx()
121
- env = pipeline.run(tool=EchoTool(), raw_input={"message": "hello runtime"}, ctx=ctx)
134
+ env = _pipeline_run(pipeline, EchoTool(), {"message": "hello runtime"}, ctx)
122
135
  assert env.status == "ok", f"got {env.status}"
123
136
  assert "hello runtime" in env.summary
124
137
  _pass(f"status=ok, summary={env.summary!r}")
@@ -129,7 +142,7 @@ def test_adapter_output() -> None:
129
142
  pipeline = ToolExecutorPipeline()
130
143
  adapter = LangChainAdapter()
131
144
  ctx = _make_ctx()
132
- env = pipeline.run(tool=EchoTool(), raw_input={"message": "hello"}, ctx=ctx)
145
+ env = _pipeline_run(pipeline, EchoTool(), {"message": "hello"}, ctx)
133
146
  output = adapter.envelope_to_tool_output(env)
134
147
  assert "hello" in output
135
148
  _pass(f"output={output!r}")
@@ -147,7 +160,7 @@ def test_validate_input_short_circuit() -> None:
147
160
 
148
161
  pipeline = ToolExecutorPipeline()
149
162
  ctx = _make_ctx()
150
- env = pipeline.run(tool=StrictEcho(), raw_input={"message": "too long message"}, ctx=ctx)
163
+ env = _pipeline_run(pipeline, StrictEcho(), {"message": "too long message"}, ctx)
151
164
  assert env.status == "error"
152
165
  assert "too long" in env.summary
153
166
  _pass(f"status=error, summary={env.summary!r}")
@@ -168,7 +181,7 @@ def test_check_permissions_blocked() -> None:
168
181
 
169
182
  pipeline = ToolExecutorPipeline()
170
183
  ctx = _make_ctx()
171
- env = pipeline.run(tool=DeniedEcho(), raw_input={"message": "hi"}, ctx=ctx)
184
+ env = _pipeline_run(pipeline, DeniedEcho(), {"message": "hi"}, ctx)
172
185
  assert env.status == "blocked"
173
186
  assert "denied_echo" in env.summary
174
187
  _pass(f"status=blocked, summary prefix={env.summary[:60]!r}...")
@@ -183,7 +196,7 @@ def test_output_manager_truncation() -> None:
183
196
 
184
197
  pipeline = ToolExecutorPipeline()
185
198
  ctx = _make_ctx()
186
- env = pipeline.run(tool=TinyEcho(), raw_input={"message": "hello runtime 1234"}, ctx=ctx)
199
+ env = _pipeline_run(pipeline, TinyEcho(), {"message": "hello runtime 1234"}, ctx)
187
200
  assert env.truncated is True
188
201
  assert env.overflow_file is not None
189
202
  assert os.path.exists(env.overflow_file)
@@ -207,7 +220,7 @@ def test_registry_and_policy_no_path_field() -> None:
207
220
  assert lc_tools[0].name == "echo"
208
221
 
209
222
  ctx = _make_ctx()
210
- env = pipeline.run(tool=registry.get("echo"), raw_input={"message": "ok"}, ctx=ctx)
223
+ env = _pipeline_run(pipeline, registry.get("echo"), {"message": "ok"}, ctx)
211
224
  assert env.status == "ok"
212
225
  _pass("registry.register + to_langchain_tools OK, policy allow (no path field)")
213
226
 
@@ -248,7 +261,7 @@ def test_exception_captured_as_error_envelope() -> None:
248
261
 
249
262
  pipeline = ToolExecutorPipeline()
250
263
  ctx = _make_ctx()
251
- env = pipeline.run(tool=BrokenEcho(), raw_input={"message": "hi"}, ctx=ctx)
264
+ env = _pipeline_run(pipeline, BrokenEcho(), {"message": "hi"}, ctx)
252
265
  assert env.status == "error"
253
266
  assert "went wrong" in env.summary
254
267
  assert env.meta is not None and "traceback" in env.meta
@@ -260,7 +273,7 @@ def test_schema_parse_failure() -> None:
260
273
  pipeline = ToolExecutorPipeline()
261
274
  ctx = _make_ctx()
262
275
  # 传入错误类型(缺少必填 message 字段)
263
- env = pipeline.run(tool=EchoTool(), raw_input={}, ctx=ctx)
276
+ env = _pipeline_run(pipeline, EchoTool(), {}, ctx)
264
277
  assert env.status == "error"
265
278
  assert "schema" in env.summary.lower() or "message" in env.summary.lower()
266
279
  _pass(f"status=error on missing field: {env.summary!r}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain-agentx-python
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: LangChain/LangGraph-based agent utilities for CodeBaseX.
5
5
  Author-email: GoodMood2008 <GoodMood2008@users.noreply.github.com>
6
6
  License: Apache License
@@ -1,4 +1,4 @@
1
- langchain_agentx/__init__.py,sha256=eShUyRBarEtTSEEDpas-_32s-g_j774Nm6m5Ie-mAEY,1678
1
+ langchain_agentx/__init__.py,sha256=2slxrsn6pOSUn5oww3M4IxJKjH6UFPL1vfKusoiXytI,1678
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
@@ -371,7 +371,7 @@ langchain_agentx/tool_runtime/permission_rules.py,sha256=ev6-Hm3N8YtbJO3SLGpoGMU
371
371
  langchain_agentx/tool_runtime/permission_settings_loader.py,sha256=Xu6dso0ghh4pb7Puf8nj20nXxjGeQvL4kIGycavwG_o,5624
372
372
  langchain_agentx/tool_runtime/permission_settings_sync.py,sha256=g6TvjWwa7D0kw5rDznPsoMv7xylESPOyWA2vZW4HDm0,4590
373
373
  langchain_agentx/tool_runtime/permission_snapshot.py,sha256=xFoi9fIcZjSw_zrIoyglneM-vJsDOLCEjiVoazr5Ack,1947
374
- langchain_agentx/tool_runtime/pipeline.py,sha256=GA77Cf_Q4o5Dfr-1VTS2r7rlbInWelIR4cMmkgBBXiw,53020
374
+ langchain_agentx/tool_runtime/pipeline.py,sha256=KiWYJJicYHlt2cVrVKQe0dnewLcrMXsKwGZ-Vsqk9pY,52885
375
375
  langchain_agentx/tool_runtime/policy.py,sha256=V0cd1GGxxxlLdReYWNEWu4L0hTIy2RCUhLF5NJ9WVhA,25975
376
376
  langchain_agentx/tool_runtime/policy_decorator.py,sha256=30tseo18ALkUINnRTZP8leTluQwkd0wPwiFCkj7A9d0,2334
377
377
  langchain_agentx/tool_runtime/process_loader.py,sha256=1YMn6ntnpdbIHJbO7wF1xuz7gNKYxK0UJAOxq96dZX4,6166
@@ -382,7 +382,7 @@ langchain_agentx/tool_runtime/registry.py,sha256=MsWqpbK4yx5pY7fi7DjspSlTbdoPwYt
382
382
  langchain_agentx/tool_runtime/session_hints.py,sha256=TyoNdSw5GsE5AvYDPHJKsrto9YXZtbAdihI8YKHdRxA,3004
383
383
  langchain_agentx/tool_runtime/session_store.py,sha256=o03ydnOzOo7HcUsu6F6AwoLgNFuRo1JpUodAl8Sx33Y,14262
384
384
  langchain_agentx/tool_runtime/shell_error.py,sha256=gi2i0sc4qHcUiLD5B2yk-wIvyVaOpLFKyf4ZnnKmAuE,2198
385
- langchain_agentx/tool_runtime/smoke_test_runtime.py,sha256=7cv8Dqha6XsqPLJhOZVTK-jxxfrHq-FuV5nixzrR8IQ,11534
385
+ langchain_agentx/tool_runtime/smoke_test_runtime.py,sha256=vOdoYdFwsWjq8k7rHD7hkgtgM5noGr9a6Wn1hHZ7354,11846
386
386
  langchain_agentx/tool_runtime/state_bridge.py,sha256=8F7jG8Uk4EVJaAB8rwKpNmbWrNZtIHYJO5RFBiwSRhs,6011
387
387
  langchain_agentx/tool_runtime/tool_message_status.py,sha256=ECJLsIEvUY5NyivZS17Zd8dDk3PfQC1lkJjgmOZXUck,2067
388
388
  langchain_agentx/tool_runtime/tool_name_constants.py,sha256=JXwKOn1ZjULgD7k3-1DEUmaGYJcw_NrQcCTQjqVSDBk,1769
@@ -651,8 +651,8 @@ langchain_agentx/workspace/root_grant_manager.py,sha256=W3gy8HTevbERbXqIgRcjzOXO
651
651
  langchain_agentx/workspace/tool_boundary.py,sha256=UDwX6swpSLsx9HNkYuuRRiV5o7ZZG_Bru2Yn0c5kNX8,5724
652
652
  langchain_agentx/workspace/validators.py,sha256=tQt-6TOcL8Fw7Ig5ebA9S7vGWh1rby920eFW6x8Tk9E,1439
653
653
  langchain_agentx/workspace/view.py,sha256=Ip02CZNI-ZjF5k0OYT3q7RUR_auMEw83VJ6rQsaBcYU,4588
654
- langchain_agentx_python-1.2.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
655
- langchain_agentx_python-1.2.0.dist-info/METADATA,sha256=IN82e5NR5TnofjYdnjcpl4kcww4N-TVy7kKECC4uFRg,24846
656
- langchain_agentx_python-1.2.0.dist-info/WHEEL,sha256=51RkbunBAw4BWsgaQWTpPhg4Diwp3c9P5iaLk67Hdtg,92
657
- langchain_agentx_python-1.2.0.dist-info/top_level.txt,sha256=Ge284pniNt8xea0OLk2o9o32GqVpDhOYk20fwE-0xxA,17
658
- langchain_agentx_python-1.2.0.dist-info/RECORD,,
654
+ langchain_agentx_python-1.2.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
655
+ langchain_agentx_python-1.2.1.dist-info/METADATA,sha256=I_uJTiEUapAJ5QTOeOb9Jf40fZPpKNQ4D8zOzO96HMw,24846
656
+ langchain_agentx_python-1.2.1.dist-info/WHEEL,sha256=51RkbunBAw4BWsgaQWTpPhg4Diwp3c9P5iaLk67Hdtg,92
657
+ langchain_agentx_python-1.2.1.dist-info/top_level.txt,sha256=Ge284pniNt8xea0OLk2o9o32GqVpDhOYk20fwE-0xxA,17
658
+ langchain_agentx_python-1.2.1.dist-info/RECORD,,