AxioRankDocs
Integrations

LlamaIndex

Guard LlamaIndex tools with AxioRank before they run, in TypeScript or Python.

The SDK ships LlamaIndex adapters for both languages. The wrapped tool keeps its name, description, and schema, so it is a drop-in replacement.

npm install @axiorank/sdk

guardTools wraps a tools array so each call's arguments are scored before the tool runs. The adapter is structural (anything with call + metadata qualifies), so it works with FunctionTool, tool(), and custom BaseTool implementations.

import { AxioRank } from "@axiorank/sdk";
import { guardTools } from "@axiorank/sdk/llamaindex";
import { agent } from "@llamaindex/workflow";

const axio = new AxioRank({ apiKey: process.env.AXIORANK_API_KEY! });

const myAgent = agent({
  llm,
  tools: guardTools(myTools, axio, { onDeny: "return" }),
});

Recover or fail

onDeny: "return" returns a short, model-readable refusal the agent can re-plan around. The default throws AxioRankDeniedError instead, failing the step hard.

pip install "axiorank[llamaindex]"

guard_tool wraps a LlamaIndex FunctionTool. Provide client (sync), async_client (async), or both; LlamaIndex derives the direction it needs from whichever you supply.

from axiorank import AxioRank
from axiorank.integrations.llamaindex import guard_tool
from llama_index.core.tools import FunctionTool

axio = AxioRank(api_key="axr_live_...")

tool = FunctionTool.from_defaults(fn=deploy_service)
safe_tool = guard_tool(tool, axio, on_deny="return")
# ...hand safe_tool to your agent as usual.

Recover or fail

on_deny="return" returns a short, model-readable refusal the agent can re-plan around. The default, on_deny="raise", raises AxioRankDeniedError instead.

Next steps

On this page