Skip to content

[AAASM-3536] ✨ (adapters): Add LlamaIndex framework adapter#163

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

[AAASM-3536] ✨ (adapters): Add LlamaIndex framework adapter#163
Chisanan232 merged 8 commits into
masterfrom
v0.0.1/AAASM-3536/feat/llamaindex_support

Conversation

@Chisanan232

Copy link
Copy Markdown
Contributor

Description

Adds full LlamaIndex framework support to the Python SDK. A new
agent_assembly.adapters.llamaindex adapter installs SDK-layer pre-execution
allow/deny and audit hooks by patching the concrete LlamaIndex tool-execution
methods: FunctionTool.call (sync) and FunctionTool.acall (async). The
modern agent stack (FunctionAgent / ReActAgent via AgentWorkflow) awaits
tool.acall(...); the legacy/sync path calls tool.call(...). Both are hooked
so a denied tool's underlying function never executes. On a deny verdict the
adapter returns a ToolOutput(is_error=True) so the agent loop receives a
well-formed result instead of crashing. The adapter is registered as a builtin
in the registry and advertises get_supported_versions() == [">=0.10.0"].

Decision normalization (fail-closed under enforce, AAASM-3107) is reused from
the shared CrewAI patch rather than re-implemented.

Type of Change

  • ✨ New feature

Breaking Changes

  • No

Related Issues

  • Related JIRA ticket: AAASM-3536 (parent Story AAASM-3535)

Testing

  • Unit tests added/updated

The tests prove genuine governance, not a no-op (the AAASM-3528 lesson):

  • Deny path asserts the tool function body never runs — verified against both a
    fake module and a real FunctionTool (via importorskip), sync and async.
  • Allow path asserts the body runs and the result is recorded.
  • A negative-control test demonstrates the deny assertions fail if the patch
    is reverted to a transparent pass-through.
  • Manually confirmed: neutering the deny branch to a no-op makes both deny tests
    FAIL (tool body executes); restoring the patch makes them pass.
  • llama-index-core added to the test dependency group so the real-package
    governance tests run in CI rather than skipping.
  • Full suite: 593 passed, 13 skipped (environmental); mypy clean on the adapter;
    ruff + pre-commit clean on changed files.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (README + docs/compatibility/frameworks.md)
  • All tests passing

Refs AAASM-3536

🤖 Generated with Claude Code

Chisanan232 and others added 5 commits June 22, 2026 14:17
Wrap the concrete FunctionTool.call / acall execution hooks so a denied
tool's underlying function never runs, an allowed one runs and is recorded,
and deny returns a ToolOutput(is_error=True). Reuses the shared CrewAI
decision-normalization (fail-closed under enforce, AAASM-3107).

Refs AAASM-3536

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add the builtin adapter and its priority slot so init_assembly()
auto-detects and hooks LlamaIndex whenever it is importable.

Refs AAASM-3536

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Prove a denied tool's body never runs (fake-module + real FunctionTool via
importorskip) and an allowed tool runs and is recorded. Includes a
negative-control test so the deny assertions fail if the patch is reverted
to a no-op pass-through.

Refs AAASM-3536

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Dev/test-only (not a runtime dependency). Installing it lets the
importorskip-guarded LlamaIndex governance tests run in CI against a real
FunctionTool instead of silently skipping.

Refs AAASM-3536

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add the LlamaIndex row to the README and frameworks.md compatibility tables
and a hook-point note explaining the FunctionTool.call / acall patch.

Refs AAASM-3536

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.52381% with 22 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
agent_assembly/adapters/llamaindex/patch.py 87.91% 22 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Chisanan232

Copy link
Copy Markdown
Contributor Author

Claude Code — review result

✅ Real CI green (SonarCloud not blocking).

  • Adapter: hooks the concrete llama_index.core.tools.FunctionTool.call (sync) + .acall (async) — BaseTool.call/acall are abstract, so the patch targets FunctionTool. Correctly handles LlamaIndex's @dispatcher.span instrumentation by invoking the original via the descriptor protocol and capturing it from the class __dict__. Registered, get_supported_versions() = >=0.10.0.
  • Governance proven: deny verified against both a fake module and a real FunctionTool (sync + async); negative control confirmed (manually neutering the deny branch makes both deny tests fail). ✔
  • Shared files: trivial keep-all overlap with siblings (distinct registry key llama_index.core).

Ready to merge. Merge before examples #152 + a python-sdk release. Full cross-repo review on AAASM-3535.

Chisanan232 and others added 3 commits June 22, 2026 15:47
Resolve registry + README + frameworks.md overlaps after py #160
(Haystack) merged: keep both frameworks' entries/imports/builtins/rows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…eat/llamaindex_support

# Conflicts:
#	README.md
#	agent_assembly/adapters/registry.py
#	pyproject.toml
…eat/llamaindex_support

# Conflicts:
#	README.md
#	agent_assembly/adapters/registry.py
#	docs/compatibility/frameworks.md
#	pyproject.toml
#	uv.lock
@sonarqubecloud

Copy link
Copy Markdown

@Chisanan232 Chisanan232 merged commit ae2d557 into master Jun 22, 2026
26 checks passed
@Chisanan232 Chisanan232 deleted the v0.0.1/AAASM-3536/feat/llamaindex_support branch June 22, 2026 08:46
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