[AAASM-3536] ✨ (examples): Wire LlamaIndex example to the SDK adapter#152
Conversation
Replace the manual GovernedToolRunner bridge with the real agent_assembly.adapters.llamaindex adapter: register_hooks patches FunctionTool.call so every tool call is governed automatically. main.py reverts init_assembly's auto-detected no-op patch first so the offline LocalPolicyEngine is the live interceptor; a denied tool returns a [BLOCKED by governance policy] ToolOutput and its body never runs. Refs AAASM-3536 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drive the native adapter through real FunctionTool.call: an allowed tool runs, a denied tool's body never executes (blocked ToolOutput), and revert restores ungoverned behavior. Refs AAASM-3536 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update the README to describe the native adapter (no manual wrapper) and bump the agent-assembly floor to >=0.0.1b5, the release that ships the LlamaIndex adapter (AAASM-3536). Refs AAASM-3536 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude Code — review result (LlamaIndex example)
Note: this closes the long-standing gap where Merge order: LAST — after python-sdk #163 merges + b5 release. Full cross-repo review on AAASM-3535. |
Pin the SDK to python-sdk master via [tool.uv.sources] so the example builds against the merged LlamaIndex adapter ahead of the 0.0.1b5 PyPI publish. Revert to the PyPI pin once that release ships. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add blank line after src/tools.py module docstring (ruff format) and give _run_governed_call's kwargs a precise dict[str, str] annotation so mypy --strict no longer flags a bare generic. The only remaining mypy error is the expected unresolved import of agent_assembly.adapters.llamaindex (adapter not yet on SDK master). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ruff + mypy --strict clean Bump uv.lock to the python-sdk master tip (ae2d557) that ships agent_assembly.adapters.llamaindex; the prior pin (7181dc6) predated the merged adapter so the import failed. Tests were already fully annotated with no ANN suppressions; ruff, mypy --strict, and pytest are clean over src and tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|



What changed
Reconciles the existing
python/llamaindex-tool-policyexample to use thenative LlamaIndex adapter (
agent_assembly.adapters.llamaindex, AAASM-3536)instead of the manual
GovernedToolRunnerbridge that predated it. The adapterpatches
FunctionTool.call, so registering its hooks governs every tool callautomatically.
main.pyrevertsinit_assembly()'s auto-detected no-op patchfirst so the offline
LocalPolicyEngineis the live interceptor (in productioninit_assemblywires the adapter to the gateway and this manual step isunnecessary). A denied tool returns a
[BLOCKED by governance policy]ToolOutputand its body never executes. The README and smoke tests wereupdated to match.
Related ticket
Refs AAASM-3536 (parent Story AAASM-3535)
How to verify
Validated locally against the python-sdk adapter branch: tests 6 passed, and the
demo prints
execute_sql … ❌ BLOCKEDwhile the allowed tools run.Cross-repo gate (honest note)
This example imports
agent_assembly.adapters.llamaindex, which ships in thepython-sdk PR (ai-agent-assembly/python-sdk#163) and is not yet on PyPI. The
agent-assemblyfloor is bumped to>=0.0.1b5(the release that will containthe adapter), so
verify-pythonCI for this example will stay red until thatSDK release publishes. Merge after the SDK adapter is released; the
uv.lockwill regenerate on first
uv syncagainst that release.Checklist
[AAASM-XXXX] <GitEmoji> (<scope>): <summary>.envfiles committed🤖 Generated with Claude Code