Skip to content

Commit a8b78d4

Browse files
Chisanan232claude
andcommitted
🔒 (custom-tool-policy): Correct policy.py docstring on production wiring
The module docstring claimed `ctx.client` is "the gateway-backed interceptor; use it in place of LocalPolicyEngine". `ctx.client` has no `check_tool_start`, so that wiring disables governance (fail-open). Document why LocalPolicyEngine exists (an in-process stand-in implementing the check_tool_start contract) and that production governance comes from a framework adapter wired by init_assembly(), not from ctx.client. Refs AAASM-4836. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 60a4fd2 commit a8b78d4

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

python/custom-tool-policy/src/policy.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
This example has no framework dependency — only ``agent-assembly``.
44
The policy engine simulates governance with a simple allow/deny rule set.
55
6-
In production:
7-
with init_assembly(gateway_url="http://localhost:8080", agent_id="my-agent") as ctx:
8-
# ctx.client is the gateway-backed interceptor; use it in place of
9-
# LocalPolicyEngine below.
6+
``LocalPolicyEngine`` implements the ``check_tool_start`` contract (the public
7+
``GovernanceInterceptor`` protocol in ``agent_assembly.adapters``) in-process so
8+
the demo runs fully offline. It is a stand-in for the gateway, NOT the
9+
production wiring: ``ctx.client`` is a bare ``GatewayClient`` with no
10+
``check_tool_start`` method, so passing it to ``governed()`` makes
11+
``AssemblyCallbackHandler.on_tool_start`` find no check, return without raising,
12+
and allow every tool — governance silently disabled (fail-open). In production
13+
you do not wrap callables against ``ctx.client``; instead run tools through a
14+
supported framework adapter and let ``init_assembly()`` wire the real
15+
gateway-backed interceptor into it. See this example's README "Production mode"
16+
section.
1017
"""
1118
from __future__ import annotations
1219

0 commit comments

Comments
 (0)