Plugins

EntroPy is extensible at three points: metrics, adapters, and exporters. Plugins register themselves on import, so third-party packages can add functionality without touching core code.

Custom metrics

Decorate a class that implements compute(self, batch):

from entropy import metric

@metric("my_metric")
class MyMetric:
    def compute(self, batch):
        # batch has outputs / events / behaviors / successes / costs ...
        return sum(batch.costs) / len(batch.costs)

Once imported, "my_metric" is available to Suite(metrics=[...]). Use default("my_metric") inside the module to include it in the canonical set.

Custom adapters

from entropy import adapter, Adapter, AgentRun

@adapter("myfw")
class MyAdapter(Adapter):
    def match(self, agent):
        return type(agent).__name__ == "MyFrameworkAgent"
    def wrap(self, agent):
        def call(inp):
            return AgentRun(run_id="", input=inp, output=agent(inp))
        return call

Custom exporters

from entropy import exporter

@exporter("latex")
def to_latex(results, path):
    text = "\n".join(f"{k} & {v:.4f} \\\\" for k, v in results.items())
    open(path, "w").write(text)
    return path

Discovery (entry points)

Third-party packages register a entropy.plugins entry point in their pyproject.toml:

[project.entry-points."entropy.plugins"]
my_plugin = "my_pkg.plugin"

EntroPy discovers and imports them on demand:

from entropy import discover
print(discover())   # names of loaded plugin modules

Built-in metric plugins

EntroPy ships a large registry of metric plugins. List them, see the defaults, and pick a subset to compute:

from entropy.metrics import default_metrics, _REGISTRY

print(sorted(_REGISTRY))        # every registered metric plugin
print(default_metrics())        # the canonical set computed by Suite

from entropy import Suite
Suite(seed=42, metrics=["loop_detection", "cost_stability",
                        "reliability_score"]).run(agent, ds, trials=50)

Each metric is a @metric-decorated class implementing compute(self, batch). Behavioral metrics (e.g. behavioral_entropy, loop_detection, goal_stability) measure action/trajectory diversity, while execution metrics (e.g. success_rate, cost, latency) measure outcomes.

Adapter & exporter plugins

Adapters for LangChain, LangGraph, OpenAI, CrewAI, PydanticAI, AutoGen, Google ADK, MCP and custom agents each live in their own module under entropy/integrations/ and are reachable via from_* helpers or find_adapter — see Framework Adapters for runnable code per framework. Custom exporters register the same way as metrics above.