Skip to content

[AAASM-3536] ✨ (examples): Wire LlamaIndex example to the SDK adapter#152

Merged
Chisanan232 merged 6 commits into
masterfrom
v0.0.1/AAASM-3536/feat/llamaindex_support
Jun 22, 2026
Merged

[AAASM-3536] ✨ (examples): Wire LlamaIndex example to the SDK adapter#152
Chisanan232 merged 6 commits into
masterfrom
v0.0.1/AAASM-3536/feat/llamaindex_support

Conversation

@Chisanan232

Copy link
Copy Markdown
Contributor

What changed

Reconciles the existing python/llamaindex-tool-policy example to use the
native LlamaIndex adapter (agent_assembly.adapters.llamaindex, AAASM-3536)
instead of the manual GovernedToolRunner bridge that predated it. The adapter
patches FunctionTool.call, so registering its hooks governs every tool call
automatically. main.py reverts init_assembly()'s auto-detected no-op patch
first so the offline LocalPolicyEngine is the live interceptor (in production
init_assembly wires the adapter to the gateway and this manual step is
unnecessary). A denied tool returns a [BLOCKED by governance policy]
ToolOutput and its body never executes. The README and smoke tests were
updated to match.

Related ticket

Refs AAASM-3536 (parent Story AAASM-3535)

How to verify

cd python/llamaindex-tool-policy
uv sync --extra dev          # needs agent-assembly with the LlamaIndex adapter
uv run pytest tests/ -v      # 6 passed
uv run python src/main.py    # query_index/summarize_docs ALLOWED, execute_sql BLOCKED

Validated locally against the python-sdk adapter branch: tests 6 passed, and the
demo prints execute_sql … ❌ BLOCKED while the allowed tools run.

Cross-repo gate (honest note)

This example imports agent_assembly.adapters.llamaindex, which ships in the
python-sdk PR (ai-agent-assembly/python-sdk#163) and is not yet on PyPI. The
agent-assembly floor is bumped to >=0.0.1b5 (the release that will contain
the adapter), so verify-python CI for this example will stay red until that
SDK release publishes
. Merge after the SDK adapter is released; the uv.lock
will regenerate on first uv sync against that release.

Checklist

  • PR title follows [AAASM-XXXX] <GitEmoji> (<scope>): <summary>
  • No secrets, API keys, or .env files committed

🤖 Generated with Claude Code

Chisanan232 and others added 3 commits June 22, 2026 14:33
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>
@Chisanan232

Copy link
Copy Markdown
Contributor Author

Claude Code — review result (LlamaIndex example)

⚠️ llamaindex-tool-policy smoke job is red for release-ordering only — the example imports agent_assembly.adapters.llamaindex, which ships in python-sdk #163 (unmerged). The agent bumped the example's agent-assembly floor to >=0.0.1b5, so its verify-python job stays red and uv.lock can't regenerate until that release publishes.

Note: this closes the long-standing gap where python/llamaindex-tool-policy existed as an example with no adapter — it's now wired to the real adapter. Validated locally: 6 tests pass, main.py correctly blocks execute_sql.

Merge order: LAST — after python-sdk #163 merges + b5 release. Full cross-repo review on AAASM-3535.

Chisanan232 and others added 3 commits June 22, 2026 16:22
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>
@Chisanan232 Chisanan232 merged commit e3b6cd4 into master Jun 22, 2026
17 checks passed
@Chisanan232 Chisanan232 deleted the v0.0.1/AAASM-3536/feat/llamaindex_support branch June 22, 2026 09:06
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant