Skip to content
Merged
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Python SDK for **AI Agent Assembly** — a governance-native runtime for AI agen

## Why use it

- **Framework adapters** for LangChain, LangGraph, CrewAI, OpenAI Agents, Pydantic AI, Google ADK, Haystack, Smolagents, Agno, and MCP servers — drop in, no SDK rewrites required.
- **Framework adapters** for LangChain, LangGraph, CrewAI, OpenAI Agents, Pydantic AI, Google ADK, Haystack, Smolagents, Agno, LlamaIndex, and MCP servers — drop in, no SDK rewrites required.
- **Pre-execution policy enforcement** via the `FrameworkAdapter` ABC — block disallowed tool calls before they hit the LLM.
- **Audit trail** — every tool call, prompt, and policy decision is emitted to the gateway with full agent lineage (parent / root / team).
- **Native PyO3 fast path** (optional) — drop into a Rust runtime client when you need sub-millisecond policy checks.
Expand All @@ -38,6 +38,7 @@ are expected to work but are not continuously tested.
| CrewAI | `crewai` | `>=0.1.0` | `1.14.x` |
| Google ADK | `google.adk` | `>=1.0.0,<2.0` | `1.x` line |
| Haystack | `haystack` | `>=2.0.0,<3.0` | `2.30.x` |
| LlamaIndex | `llama_index.core` | `>=0.10.0` | `0.14.x` |
| MCP | `mcp` | `>=1.0.0` | `1.27.x` |
| OpenAI Agents | `agents` | `>=0.1.0` | `0.17.x` |
| Smolagents | `smolagents` | `>=1.0.0,<2.0.0` | `1.26.x` |
Expand Down
6 changes: 6 additions & 0 deletions agent_assembly/adapters/llamaindex/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""LlamaIndex adapter package."""

from agent_assembly.adapters.llamaindex.adapter import LlamaIndexAdapter
from agent_assembly.adapters.llamaindex.patch import LlamaIndexPatch

__all__ = ["LlamaIndexAdapter", "LlamaIndexPatch"]
47 changes: 47 additions & 0 deletions agent_assembly/adapters/llamaindex/adapter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""LlamaIndex framework adapter."""

from __future__ import annotations

from agent_assembly.adapters.base import FrameworkAdapter, GovernanceInterceptor
from agent_assembly.adapters.llamaindex.patch import LlamaIndexPatch


class LlamaIndexAdapter(FrameworkAdapter):
"""Adapter for LlamaIndex framework governance hook installation.

Wires the SDK-layer pre-execution allow/deny + audit hook onto the
LlamaIndex tool-execution path (``FunctionTool.call`` / ``acall``). The
framework package is imported as ``llama_index.core``; the patch targets the
concrete tool methods the agent loop actually invokes (the base methods are
abstract).
"""

def __init__(self, *, process_agent_id: str | None = None) -> None:
self._process_agent_id = process_agent_id
self._patch: LlamaIndexPatch | None = None

@property
def process_agent_id(self) -> str | None:
return self._process_agent_id

@process_agent_id.setter
def process_agent_id(self, value: str | None) -> None:
self._process_agent_id = value

def get_framework_name(self) -> str:
return "llama_index.core"

def get_supported_versions(self) -> list[str]:
return [">=0.10.0"]

def register_hooks(self, interceptor: GovernanceInterceptor) -> None:
self._patch = LlamaIndexPatch(
interceptor,
process_agent_id=self._process_agent_id,
)
self._patch.apply()

def unregister_hooks(self) -> None:
if self._patch is not None:
self._patch.revert()
self._patch = None
Loading
Loading