LlamaIndex Integration
CapFence wraps LlamaIndex tools with deterministic gate enforcement.
Installation
pip install capfenceWrapping a tool
from capfence.framework.llamaindex import CapFenceLlamaIndexTool
class QueryTool:
name = "query_db"
description = "Query the customer database"
def call(self, query: str) -> dict:
return {"rows": []}
safe_query = CapFenceLlamaIndexTool(
tool=QueryTool(),
agent_id="llama-agent",
capability="database.read",
policy_path="policies/db.yaml",
)Calling the tool
safe_query.call({"query": "select 1"})