Skip to main content

LlamaIndex tool spec for the Ejentum Reasoning Harness. Wraps the hosted Ejentum MCP server and exposes eight cognitive harness tools as LlamaIndex FunctionTool objects: four dynamic (reasoning, code, anti-deception, memory) plus four adaptive variants (adaptive-reasoning, adaptive-code, adaptive-anti-deception, adaptive-memory) that pre-fit the cognitive operation to the caller's task via an adapter LLM.

Project description

llama-index-tools-ejentum

LlamaIndex tool spec that subclasses McpToolSpec and points at the hosted Ejentum MCP server. Exposes the eight cognitive-harness tools as LlamaIndex FunctionTool objects ready for any LlamaIndex agent or query engine.

Use the harness before the agent generates on complex, multi-step, or multi-constraint tasks where the model's default reasoning template would miss a constraint, take a shortcut, or drift across turns. Each call returns a cognitive operation: a structured procedure (numbered steps with a failure pattern to refuse and a falsification test) paired with an executable reasoning topology (a DAG of those steps with decision gates, parallel branches, bounded loops, and meta-cognitive exit nodes). The agent reads both layers before producing its response.

Four dynamic tools (reasoning, code, anti-deception, memory) are available on all tiers including the 30-day free trial. Four adaptive tools (adaptive-reasoning, adaptive-code, adaptive-anti-deception, adaptive-memory) additionally run an adapter LLM that rewrites the matched operation with task-specific identifiers; they require the Go or Super tier.

Tool names exposed to the LLM are whatever the upstream MCP server advertises (canonical hyphenated strings: reasoning, code, anti-deception, memory, adaptive-reasoning, adaptive-code, adaptive-anti-deception, adaptive-memory). This shim does not rename them.

Install

pip install llama-index-tools-ejentum

Configuration

export EJENTUM_API_KEY="ej_..."

Or pass api_key= to EjentumToolSpec(...). Get a key at ejentum.com/pricing.

Usage

Minimal

from llama_index.tools.ejentum import EjentumToolSpec

spec = EjentumToolSpec()
tools = spec.to_tool_list()

Subset of modes

spec = EjentumToolSpec(modes=["reasoning", "code", "adaptive-reasoning", "adaptive-code"])
tools = spec.to_tool_list()

Valid mode names (use canonical hyphenated form): reasoning, code, anti-deception, memory, adaptive-reasoning, adaptive-code, adaptive-anti-deception, adaptive-memory.

With a ReActAgent

from llama_index.core.agent import ReActAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.ejentum import EjentumToolSpec

tools = EjentumToolSpec().to_tool_list()
agent = ReActAgent.from_tools(tools, llm=OpenAI(model="gpt-4o-mini"))

response = await agent.achat(
    "Why might our microservice return 503s only under specific load patterns?"
)

Tool inventory

Dynamic (all tiers)

Tool Library size
reasoning 311
code 128
anti-deception 139
memory 101

Adaptive (Go or Super tier)

Tool
adaptive-reasoning
adaptive-code
adaptive-anti-deception
adaptive-memory

Each tool takes a single query: str argument. Returns the injection as a string.

API reference

EjentumToolSpec(
    api_key: str | None = None,
    modes: list[str] | None = None,
    api_url: str = "https://api.ejentum.com/mcp",
    timeout: int = 30,
)
Field Default Description
api_key None If unset, read from EJENTUM_API_KEY. Raises ValueError at construction if neither is set.
modes None Optional subset of harness modes to expose. Defaults to all eight.
api_url https://api.ejentum.com/mcp Override for self-hosted MCP gateway.
timeout 30 HTTP timeout in seconds for the underlying MCP client.

The class is a thin subclass of llama_index.tools.mcp.McpToolSpec, pre-configured with the hosted Ejentum endpoint and Bearer authentication.

Wire contract

This shim talks to the MCP endpoint (/mcp), not the direct-REST endpoint (/harness/). For the direct-REST contract used by every other Ejentum shim, see the ejentum-mcp README; for the MCP-over-streamable-HTTP contract, see the MCP specification.

Field structure of an injection and a canonical dynamic-vs-adaptive comparison on the same query are documented in the ejentum-mcp README.

The underlying MCP server

The same MCP server is available on three additional surfaces:

  • Stdio via npx -y ejentum-mcp
  • Hosted Streamable HTTP at https://api.ejentum.com/mcp
  • Listed on the Official MCP Registry as io.github.ejentum/ejentum-mcp

Compatibility

  • Python 3.10+
  • llama-index-core>=0.13.0,<0.15
  • llama-index-tools-mcp>=0.4.1,<0.5

License

MIT

Measured effects

The Ejentum harness is benchmarked publicly under CC BY 4.0 at github.com/ejentum/benchmarks:

  • ELEPHANT sycophancy: 5.8% composite on GPT-4o (40 real Reddit scenarios)
  • LiveCodeBench Hard: 85.7% to 100% on Claude Opus (28 competitive programming tasks)
  • Memory retention: 50% fewer stale facts served (20-turn implicit state changes)
  • Plus per-harness numbers across BBH/CausalBench/MuSR, ARC-AGI-3, SciCode, and perception tasks

Methodology, scenarios, run scripts, and raw outputs are all in-repo.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_tools_ejentum-0.2.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_tools_ejentum-0.2.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_ejentum-0.2.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_tools_ejentum-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a1e16217a434a8c01d5db9e154be3ab6681a479a27d69e89cf82fae9930b4743
MD5 82dc74b9df6cc317cea39b847bc892f6
BLAKE2b-256 9cbb0e137663cac8fdaf53a190a500c1e074f34532d57f3b20c2401dbae66c15

See more details on using hashes here.

File details

Details for the file llama_index_tools_ejentum-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_tools_ejentum-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2672f95739210ca454e0ff68871daa305d32a1f54aeab040da8b3d38e48e91d6
MD5 46f9ea0bbbb0cb2e4ac8f9b6ec33cf61
BLAKE2b-256 529d3eb566502b8e311c6f4be8976e2067bdf92493c4a0fb2d39f4f0098937c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page