Skip to content

LlamaIndex

angelatgithub edited this page Sep 19, 2026 · 1 revision

LlamaIndex — llamaindex-algenta

Outcome-aware list[llama_index.core.tools.FunctionTool] wrapping your engine's MCP tool surface via llama-index-tools-mcp's real BasicMCPClient — with a typed ExecutionReceipt as ToolOutput.raw_output (not a stringified blob) and named-gate AlgentaToolDenied denials.

PyPI

Install

pip install llamaindex-algenta
pip install "llamaindex-algenta" "llama-index-workflows<2.24"  # see note below — needed for FunctionAgent today

Depends on llama-index-core + llama-index-tools-mcp + a pinned mcp<2.0.0 (works around a real, currently-live upstream bug in llama-index-tools-mcp 0.5.0); deliberately no algenta-sdk dependency.

Quickstart

import asyncio
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI  # pip install llama-index-llms-openai
from llamaindex_algenta import create_algenta_tools

async def main() -> None:
    tools = await create_algenta_tools(base_url="http://localhost:8000/mcp", profile="observe")
    agent = FunctionAgent(tools=tools, llm=OpenAI(model="gpt-5"))
    print(await agent.run(user_msg="what should we do?"))

asyncio.run(main())

create_algenta_tools is async def, matching McpToolSpec.to_tool_list_async()'s real primary interface. profile="observe" is the default.

Profiles

All four, per the contract: observe (default) · govern · execute · full (opt-in). Filtering is client-side (the raw MCP list_tools() has no server-side name filter) — a disallowed tool is never turned into a FunctionTool at all.

Notes

  • llama-index-workflows<2.24 workaround: a fresh install today resolves llama-index-workflows==2.24.0, with which every FunctionAgent.run() fails (TypeError: unhashable type: 'FunctionAgent'). The package deliberately does not pin this — it never imports workflows, and a ceiling on a dependency it doesn't own would block resolution later. Install the working pair yourself until llama-index-core fixes it.
  • Denial propagation: AlgentaToolDenied propagates unmodified from a bare tool.acall(), but a real FunctionAgent catches all exceptions into ToolOutput(is_error=True) — inspect the ToolCallResult, don't wrap agent.run() in try/except. Documented honestly in the package README.
  • Tests: real FastMCP stub server, all three gates plus the success path, through both a direct acall and a real FunctionAgent.run() — uv run pytest llamaindex-algenta -v.

Full reference: package README (execution outcome mapping, the mcp<2.0.0 pin evidence, receipt citations).

Clone this wiki locally