Skip to main content

AutoGen tools for the Ejentum Reasoning Harness. Four agent-callable async functions (harness_reasoning, harness_code, harness_anti_deception, harness_memory) returned by ejentum_tools(api_key=...). Each call retrieves a task-matched cognitive operation engineered in two layers: a natural-language procedure plus an executable reasoning topology.

Project description

autogen-ejentum

AutoGen tools for the Ejentum Reasoning Harness. ejentum_tools() returns four async tool closures (harness_reasoning, harness_code, harness_anti_deception, harness_memory) that AutoGen's AssistantAgent calls before generating.

Each operation in the Ejentum library (679 of them, organized across four harnesses) is engineered in two layers:

  • a natural-language procedure the model can read, naming the steps to take and the failure pattern to refuse, and
  • an executable reasoning topology: a graph-shaped plan over those steps. The plan names explicit decision points where the model branches, parallel branches that run and rejoin, bounded loops that run until convergence, named meta-cognitive moments where the model is asked to stop, look at its own working, and re-enter at a specific step, plus escape paths for when the prescribed plan stops fitting the task at hand.

The natural-language layer tells the model what to do. The topology layer pins down how those steps connect: where to decide, where to loop, where to stop and look at itself. Together they act as a persistent attention anchor that survives long context windows and multi-turn execution chains, which is precisely where a model's own reasoning template typically decays.

Installation

pip install autogen-ejentum

If you don't already have AutoGen installed:

pip install autogen-agentchat autogen-ext[openai] autogen-ejentum

Configuration

Get an Ejentum API key at https://ejentum.com/pricing (free and paid tiers) and set it in your environment:

export EJENTUM_API_KEY="zpka_..."

Usage

import asyncio

from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.ui import Console
from autogen_ext.models.openai import OpenAIChatCompletionClient

from autogen_ejentum import ejentum_tools


async def main() -> None:
    model_client = OpenAIChatCompletionClient(model="gpt-4o")

    agent = AssistantAgent(
        name="reviewer",
        model_client=model_client,
        tools=ejentum_tools(),  # reads EJENTUM_API_KEY from env
        system_message=(
            "You are a senior engineer. When a prompt pressures you to "
            "validate a decision before evidence, call "
            "harness_anti_deception with a 1-2 sentence framing of the "
            "integrity dynamic at play, then write."
        ),
    )

    await Console(agent.run_stream(
        task=(
            "We've spent three months on the GraphQL gateway. It's mostly "
            "done. Should we keep going or pivot to REST?"
        ),
    ))


asyncio.run(main())

The agent reads each closure's name + Google-style docstring and routes to the matching harness_* tool. AutoGen handles JSON schema generation; you don't write one.

Explicit API key

tools = ejentum_tools(api_key="zpka_...")

Wrap as a BaseTool (if you prefer)

from autogen_core.tools import FunctionTool
from autogen_ejentum import ejentum_tools

tools = [FunctionTool(fn, description=fn.__doc__) for fn in ejentum_tools()]

The four tools

Closure Best for Library size
harness_reasoning Analytical, diagnostic, planning, multi-step tasks spanning abstraction, time, causality, simulation, spatial, and metacognition 311 operations
harness_code Code generation, refactoring, review, and debugging across the software-engineering layer 128 operations
harness_anti_deception Prompts that pressure the agent to validate, certify, or soften an honest assessment 139 operations
harness_memory Sharpening an observation already formed about cross-turn drift. Filter-oriented, not write-oriented. Format query as "I noticed X. This might mean Y. Sharpen: Z." 101 operations

What an injection looks like

A real reasoning mode response on the query investigate why our nightly ETL job has started failing intermittently over the past two weeks; nothing in the code or schema has changed:

[NEGATIVE GATE]
The server's response time was accepted as average, despite a suspicious
rhythm break in its timing pattern.

[PROCEDURE]
Step 1: Establish baseline timing profiles by extracting historical
durations and intervals for each event type. Step 2: Compare each observed
timing against its baseline and compute deviation magnitude. Step 3:
Classify anomalies as too fast, too slow, too early, or too late, and rank
by severity. ... Step 5: If deviation exceeds two standard deviations,
probe root cause by tracing upstream dependencies. ...

[REASONING TOPOLOGY]
S1:durations -> FIXED_POINT[baselines] -> N{dismiss_timing_deviations_
without_investigation} -> for_each: S2:compare -> S3:deviation ->
G1{>2sigma?} --yes-> S4:classify -> S5:probe_cause -> FLAG -> continue --no->
S6:validate -> continue -> all_checked -> OUT:anomaly_report

[TARGET PATTERN]
Establish timing baselines by extracting historical response intervals.
Compare current server response time to this baseline. ...

[FALSIFICATION TEST]
If no event timing is flagged as suspiciously fast or slow relative to
baseline, temporal anomaly detection was not active.

Amplify: timing baseline comparison; anomaly classification; security
context elevation
Suppress: average timing acceptance; outlier normalization

The agent reads both the natural-language [PROCEDURE] and the graph-logic [REASONING TOPOLOGY] before generating its user-facing answer. The bracketed labels are instructions to the agent, not content to display.

API reference

from autogen_ejentum import ejentum_tools

ejentum_tools(
    api_key: str | None = None,
    api_url: str = "https://ejentum-main-ab125c3.zuplo.app/logicv1/",
    timeout_seconds: float = 10.0,
) -> list[Callable[[str], Awaitable[str]]]

The four returned callables are async functions with __name__ set to harness_reasoning, harness_code, harness_anti_deception, harness_memory. Each accepts a single query: str argument. Errors are returned as human-readable strings (no exceptions cross the tool boundary, so an agent step never crashes the run).

MCP alternative. This package wraps the Logic API REST gateway with async httpx. AutoGen also has MCP server support; the same four harness tools are hosted at https://api.ejentum.com/mcp with Bearer auth. The PyPI package skips MCP setup and keeps the dep weight tiny.

Compatibility

  • Python 3.10+
  • autogen-core>=0.4.0
  • httpx>=0.27.0

Works with AutoGen v0.4+ (the Microsoft + Berkeley async refactor). Not tested against the legacy pyautogen (v0.2.x); the older one uses register_for_llm / register_for_execution decorators rather than AssistantAgent(tools=[...]).

Resources

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

autogen_ejentum-0.1.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

autogen_ejentum-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file autogen_ejentum-0.1.0.tar.gz.

File metadata

  • Download URL: autogen_ejentum-0.1.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for autogen_ejentum-0.1.0.tar.gz
Algorithm Hash digest
SHA256 909df3a8c5793b844a1cd292cbada5bcb23a64bc98ecfae458f28af0f659edda
MD5 dc70eac8494352935b0ac3d24de69ee4
BLAKE2b-256 9e076ab09e82b77e8c1f385dcad09dad1f84d463302a9be0fa8ea4f66c841d3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for autogen_ejentum-0.1.0.tar.gz:

Publisher: release.yml on ejentum/autogen-ejentum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file autogen_ejentum-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: autogen_ejentum-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for autogen_ejentum-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2e39b19d0bac6d0d263a80bdae2939cc9afc077ffd7b57ff6683f8857c623cf
MD5 40b0b0a3bf65ca059fd1ca251b692f4d
BLAKE2b-256 860fa421f14dfb773315747d5b050d45c6fd1d7b5e9cf4a2221fa8d30b94d730

See more details on using hashes here.

Provenance

The following attestation bundles were made for autogen_ejentum-0.1.0-py3-none-any.whl:

Publisher: release.yml on ejentum/autogen-ejentum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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