Documentation

Everything you need to build with Ejentum. From quickstart guides to advanced patterns.

Integrations

Ejentum ships official packages for 13 agent frameworks (TypeScript and Python) plus an MCP server and editor extensions, so the harness becomes native tools your agent calls. Or skip the SDK entirely: it's a single POST endpoint returning JSON, so anything that can make an HTTP request works.

Choose your path: Official packages · MCP server · No code (n8n) · Multi-agent no-code (Heym) · Claude (Agent SDK) · Agentic IDEs · Make.com · Without a package (raw HTTP)

For endpoint details, see the API Reference. For real injection payloads, see Examples.

The Injection Principle

Where you inject matters as much as what you inject.

1. Inject BEFORE the task, not after. The injection must be the first structured content the model processes. LLMs attend most strongly to content at the beginning of context.

2. Inject into the SYSTEM message, not the user message. The system message sets the model's operational mode. Injecting into the user message treats the injection as data to reason about, not as a constraint to follow.

3. Keep the injection SEPARATE from your instructions. The [REASONING CONTEXT]...[END REASONING CONTEXT] delimiters create a distinct attention block. Do not merge the injection into natural language instructions.

4. Re-inject per turn in multi-turn agents. Injections degrade over long contexts. Call the API for each new task step and inject fresh. Injections act as persistent attention anchors, but they lose effectiveness as task-specific tokens accumulate over extended chains. Re-injection maintains the effect.


MCP server

The fastest path. One install, works across Claude Desktop, Cursor, Windsurf, Claude Code, n8n's MCP Client node, and any other MCP-compatible client. The four harnesses appear as eight tools (a dynamic and an adaptive variant each) your agent can call.

Two install paths for the same eight tools. Hosted HTTPS (HTTP-MCP clients): https://api.ejentum.com/mcp with Authorization: Bearer YOUR_EJENTUM_API_KEY. No install, no subprocess. Stdio (subprocess-spawning clients): the ejentum-mcp npm package via npx -y ejentum-mcp. Source on GitHub (MIT). Also listed on Glama, mcp.so, and the Official MCP Registry.

Hosted endpoint (recommended for n8n MCP Client and any HTTP-MCP agent)

Point your client at https://api.ejentum.com/mcp. Set the Authorization header to Bearer <YOUR_EJENTUM_API_KEY>. No local install, no subprocess to manage, automatic updates as we ship new operations to the backend.

Stdio install (Claude Desktop, Cursor, Windsurf, Claude Code, Cline, Continue)

Add the ejentum-mcp npm package to your client's MCP config:

{
  "mcpServers": {
    "ejentum": {
      "command": "npx",
      "args": ["-y", "ejentum-mcp"],
      "env": { "EJENTUM_API_KEY": "your_key" }
    }
  }
}

Tools

Four dynamic tools (all tiers) and four adaptive tools (Go or Super tier). Each takes one query argument.

ToolVariantUse for
reasoningDynamicMulti-step analysis, planning, diagnostics, cross-domain synthesis
codeDynamicCode generation, refactoring, review, debugging
anti-deceptionDynamicSycophancy pressure, hallucination risk, manipulation pressure
memoryDynamicPerception sharpening, drift detection, cross-turn pattern recognition
adaptive-reasoningAdaptiveSame triggers as reasoning, rewritten to your task's specifics
adaptive-codeAdaptiveSame triggers as code, rewritten to your language and files
adaptive-anti-deceptionAdaptiveSame triggers as anti-deception, rewritten to the pressure at play
adaptive-memoryAdaptiveSame triggers as memory, rewritten to the observation you formed

The MCP server is a thin wrapper over the same harness API the rest of this guide describes. For richer autonomous routing per task, install the skill files alongside the MCP server: the skill files give Claude system-level context about when to call each harness, while the MCP server fires reliably on explicit invocation. Full per-client install steps are in the MCP Server Guide.


Official packages

Already on a framework? Install the shim and the harness becomes native tools your agent calls: no HTTP plumbing, no manual injection. Every package is MIT-licensed, versioned alongside the API, with its repo under github.com/ejentum. Set EJENTUM_API_KEY (your ej_... key) in the environment; the tools default to https://api.ejentum.com/harness/.

TypeScript / JavaScript

Vercel AI SDKnpm install ejentum-ai · github.com/ejentum/ejentum-ai

import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
import { createEjentumTools } from "ejentum-ai";

const { text } = await generateText({
  model: openai("gpt-4o"),
  tools: createEjentumTools(),
  prompt: "...",
  maxSteps: 5,
});

Mastranpm install ejentum-mastra · github.com/ejentum/ejentum-mastra

import { Agent } from "@mastra/core/agent";
import { createEjentumTools } from "ejentum-mastra";

const architect = new Agent({
  name: "Senior Architect",
  instructions: "Push back on sunk-cost framings.",
  model: "anthropic/claude-sonnet-4-6",
  tools: createEjentumTools(),
});

LangGraph.js / LangChain.jsnpm install ejentum-langgraph · github.com/ejentum/ejentum-langgraph

import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { ChatAnthropic } from "@langchain/anthropic";
import { createEjentumTools } from "ejentum-langgraph";

const agent = createReactAgent({
  llm: new ChatAnthropic({ model: "claude-sonnet-4-6" }),
  tools: createEjentumTools(),
});

Genkitnpm install ejentum-genkit · github.com/ejentum/ejentum-genkit

import { genkit } from "genkit";
import { gemini20Flash, googleAI } from "@genkit-ai/googleai";
import { createEjentumTools } from "ejentum-genkit";

const ai = genkit({ plugins: [googleAI()], model: gemini20Flash });
const response = await ai.generate({ prompt: "...", tools: createEjentumTools(ai) });

n8n — community node n8n-nodes-ejentum · github.com/ejentum/n8n-nodes-ejentum

Install via n8n → Settings → Community Nodes → n8n-nodes-ejentum. Add the Ejentum node, set the Ejentum API credential, pick an operation, and feed {{ $json.injection }} into the next LLM node's system prompt. Full walkthrough: n8n guide.

MCP servernpx -y ejentum-mcp · github.com/ejentum/ejentum-mcp

The eight tools over MCP for any MCP-compatible client. See the MCP section above and the MCP guide.

Python

CrewAIpip install crewai-ejentum · github.com/ejentum/crewai-ejentum

from crewai import Agent
from crewai_ejentum import EjentumHarnessTool

architect = Agent(
    role="Senior architect",
    goal="Evaluate technical decisions honestly",
    backstory="Pragmatic; pushes back on sunk-cost framings.",
    tools=[EjentumHarnessTool()],
)

LangChainpip install langchain-ejentum · github.com/ejentum/langchain-ejentum

from langchain.chat_models import init_chat_model
from langgraph.prebuilt import create_react_agent
from langchain_ejentum import EjentumTools

model = init_chat_model("claude-sonnet-4-6", model_provider="anthropic")
agent = create_react_agent(model, EjentumTools().get_tools())

Agnopip install agno-ejentum · github.com/ejentum/agno-ejentum

from agno.agent import Agent
from agno.models.anthropic import Claude
from agno_ejentum import EjentumTools

architect = Agent(
    name="Senior architect",
    model=Claude(id="claude-sonnet-4-6"),
    tools=[EjentumTools()],
)

LlamaIndexpip install llama-index-tools-ejentum · github.com/ejentum/llama-index-tools-ejentum

from llama_index.tools.ejentum import EjentumToolSpec

tools = EjentumToolSpec().to_tool_list()

Pydantic AIpip install pydantic-ai-ejentum · github.com/ejentum/pydantic-ai-ejentum

from pydantic_ai import Agent
from pydantic_ai_ejentum import EjentumToolset

agent = Agent("anthropic:claude-sonnet-4-6", toolsets=[EjentumToolset()])
result = agent.run_sync("...")

smolagentspip install smolagents-ejentum · github.com/ejentum/smolagents-ejentum

from smolagents import CodeAgent, InferenceClientModel
from smolagents_ejentum import ejentum_tools

agent = CodeAgent(tools=ejentum_tools(), model=InferenceClientModel(model_id="meta-llama/Llama-3.3-70B-Instruct"))
agent.run("...")

Lettapip install letta-ejentum · github.com/ejentum/letta-ejentum

from letta_client import Letta
from letta_ejentum import register_ejentum_tools

client = Letta(api_key=LETTA_API_KEY)
tools = register_ejentum_tools(client)
agent = client.agents.create(
    model="anthropic/claude-sonnet-4-6",
    embedding="openai/text-embedding-3-small",
    tool_ids=[t.id for t in tools],
)

Set EJENTUM_API_KEY in the Letta server's environment, not your shell.

AutoGenpip install autogen-ejentum · github.com/ejentum/autogen-ejentum

from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ejentum import ejentum_tools

agent = AssistantAgent(
    name="reviewer",
    model_client=OpenAIChatCompletionClient(model="gpt-4o"),
    tools=ejentum_tools(),
)

Editors and platforms

Zed — extension "Ejentum" · github.com/ejentum/zed-ejentum-mcp

Install from the Zed extensions panel, then set your key in settings:

{
  "context_servers": {
    "ejentum-mcp": { "settings": { "ejentum_api_key": "YOUR_KEY_HERE" } }
  }
}

Cursor / Windsurf / Cline — rules files in ejentum-mcp/editors. Drop the .cursorrules / .windsurfrules / .clinerules into your project root and add the ejentum-mcp MCP server in the editor's settings; the rules teach the editor when to call each tool.

AutoGen Studio — import the gallery from ejentum-mcp/integrations/autogen-studio: Gallery → Create → Import from URL, then set EJENTUM_API_KEY.

Open WebUI — paste the single-file tool from ejentum-mcp/integrations/openwebui: Workspace → Tools → +, then set the api_key Valve.


n8n

The fastest path to testing Ejentum without writing code.

Full walkthrough with screenshots: n8n: Drop Ejentum Into Any AI Agent. Start there if you're a no-code builder.

Pattern

Add an AI Agent node to your workflow. Connect an HTTP Request Tool node to the agent's Tools input. The agent calls the Ejentum API as a tool during execution.

Steps

  1. Add an AI Agent node (Tools Agent type)
  2. Add an HTTP Request Tool node and connect it to the agent's Tools input
  3. Configure the HTTP Request Tool:
    • Method: POST
    • URL: https://api.ejentum.com/harness/
    • Authentication: Header Auth with your API key
    • Body: {"query": "{task_description}", "mode": "reasoning"}
  4. The agent receives the injection in the tool response and uses it to guide its reasoning

The API returns a pre-rendered string. No field assembly needed.

Want to verify it on your data? The n8n eval workflow A/B tests the harness against an identical-retrieval baseline using four cross-lab blind judges. Import, swap the KB for yours, run.


Heym

Self-hosted, AI-native automation platform from heym.run with canvas node tools (any node wired into an agent's Tool input) and a native MCP client (consume external MCP servers via stdio, SSE, or Streamable HTTP). Two integration paths: HTTP-as-tool (full mode control, including the adaptive modes) or ejentum-mcp via the agent's MCP Connections (no canvas-side wiring; the eight tools appear natively).

Full dual-path walkthrough: Heym: Drop Ejentum Into an Agent. Path A (HTTP) and Path B (MCP), single agent across both, with a closing example that scales the pattern to a 4-agent adversarial code review team.

Path A: HTTP node as canvas tool

  1. Create a credential: type Bearer, name EjentumLogicApi, value = your raw API key (no Bearer prefix; Heym sends it as Authorization: Bearer <token>).
  2. Add an HTTP node with label = ejentumLogic and a curl field:
    curl -X POST "https://api.ejentum.com/harness/" \
      -H "Authorization: $credentials.EjentumLogicApi" \
      -H "Content-Type: application/json" \
      -d '{"query": "test", "mode": "reasoning"}'
  3. Click the bot icon next to the curl field (this stores agentProvidedFields: ["curl"]). Drag a tool-edge from the HTTP node's tool-output to the Agent's tool-input.
  4. In the Agent's systemInstruction, paste the cURL contract and instruct the agent to call the harness BEFORE non-trivial tasks. Agent picks the mode itself per call.

Path B: ejentum-mcp via the agent's MCP Connections

  1. On the Agent node, scroll to MCP Connections and click + Add MCP:
    • Transport: stdio
    • Command: npx
    • Args (JSON array): ["-y", "ejentum-mcp"]
    • Env (JSON object): {"EJENTUM_API_KEY": "your_key"}
    • Label: ejentum
  2. Click Fetch tools. The eight tools list inline. The agent now has them as native tools, no cURL contract needed.

For a multi-agent application of Path A (4 agents, 3 harnesses, cross-lab models), one-click import the adversarial code review template from Heym's templates gallery.


Without an official package (raw HTTP)

No package for your stack? The harness is one POST. Define a helper once and inject its result into your agent's first-position context:

import requests

EJENTUM_URL = "https://api.ejentum.com/harness/"
EJENTUM_KEY = "YOUR_API_KEY"

def get_injection(task: str, mode: str = "reasoning") -> str:
    try:
        r = requests.post(
            EJENTUM_URL,
            headers={"Authorization": f"Bearer {EJENTUM_KEY}", "Content-Type": "application/json"},
            json={"query": task, "mode": mode},
            timeout=5,
        )
        r.raise_for_status()
        injection = r.json()[0][mode]
        return f"[REASONING CONTEXT]\n{injection}\n[END REASONING CONTEXT]"
    except Exception:
        return ""  # graceful degradation: the agent continues on native reasoning

Prepend get_injection(task) to whatever first-position context your framework exposes (a system message, an agent backstory, or instructions). For LangChain, CrewAI, Agno, LlamaIndex, Pydantic AI, smolagents, Letta, and AutoGen, the official packages above do this wiring for you.


Claude Code / Agent SDK

Via tool_use

tools = [{
    "name": "get_ejentum_injection",
    "description": "Retrieve a cognitive ability for the current task",
    "input_schema": {
        "type": "object",
        "properties": {
            "query": {"type": "string", "description": "Task description"},
            "mode": {"type": "string", "enum": ["reasoning", "code", "anti-deception", "memory", "adaptive-reasoning", "adaptive-code", "adaptive-anti-deception", "adaptive-memory"], "default": "reasoning"}
        },
        "required": ["query"]
    }
}]

When Claude decides to use this tool, make the POST request to the Ejentum API and return the injection as the tool result.


Agentic IDEs (Cursor, Windsurf, Antigravity, Codex)

All major agentic IDEs support custom HTTP tools natively. No wrapper needed.

  1. Add a custom tool definition pointing to the Ejentum POST endpoint
  2. The IDE's agent calls the tool when it needs reasoning augmentation
  3. The injection is placed into the agent's context automatically

This works identically across Cursor, Windsurf, Google Antigravity, and OpenAI Codex. Each IDE has its own tool configuration format, but the HTTP request is always the same: POST to /harness/ with your query and API key.


Make.com

  1. HTTP Module: POST to the Ejentum endpoint with your query
  2. Text Aggregator: Format the response into the injection template
  3. AI Module: Paste the formatted text into the system message input

Universal Pattern

Any framework. Any language. Three steps:

1. POST  https://api.ejentum.com/harness/
   Body: {"query": "your task", "mode": "reasoning"}
   Auth: Bearer YOUR_API_KEY

2. PARSE  response[0][mode]  (key matches mode name)

3. INJECT  into system message before task prompt

Advanced Patterns

Task-Adaptive Injection

Different steps in a multi-step agent need different reasoning. Don't use one injection for the whole pipeline.

tasks = [
    {"description": "Identify why production failed", "agent": analyst},
    {"description": "Estimate recovery timeline", "agent": planner},
    {"description": "Draft incident report", "agent": writer}
]

for task in tasks:
    injection = get_injection(task["description"])
    task["agent"].backstory = f"{task['agent'].base_backstory}\n\n{injection}"

The first task activates Causal reasoning. The second activates Temporal. The third activates Abstraction. One static injection would have forced all three agents into the same reasoning mode.

Feedback Loop: Re-inject on Failure

If the agent's output fails validation, re-query with the failure description.

result = agent.run(task)

if not validate(result):
    correction = get_injection(
        f"Agent failed: {validation_error}. Retry with corrective reasoning."
    )
    result = agent.run(task, system_override=correction)

This often triggers a Metacognitive ability (self-monitoring, contradiction detection) that was not selected on the first pass.

Graceful Degradation

Always wrap the API call with a timeout and fallback. Your agent must function if the API is unreachable.

def get_injection_safe(query: str, mode: str = "reasoning") -> str:
    try:
        r = requests.post(EJENTUM_URL, json={"query": query, "mode": mode},
                         headers={"Authorization": f"Bearer {EJENTUM_KEY}"}, timeout=2)
        r.raise_for_status()
        payload = r.json()[0].get(mode, "")
        return f"[REASONING CONTEXT]\n{payload}\n[END REASONING CONTEXT]" if payload else ""
    except Exception:
        return ""  # Agent continues with native capability

Production Checklist

Before deploying:

  • Wrap all API calls with timeout (2 seconds) and fallback
  • Inject into system message, not user message
  • Inject BEFORE task instructions, not after
  • Test with representative queries from your actual pipeline (50+ tasks)
  • Compare output quality with and without injection
  • Re-inject per turn in multi-turn agents
  • For task-specific depth on hard tasks: use the adaptive mode, not multiple single calls
  • Log responses to debug ability routing
  • Graceful degradation: agent functions if API is unreachable

See also: Use Cases for industry-specific integration patterns. Builder's Playbook for real-world workflow examples.