agent-control repo. If you want to publish a standalone evaluator as a separate wheel, see Custom Evaluators.
For a working reference, see the Galileo Luna-2.
Quick Start
Pick an evaluator name. Everything else derives from this:Example: evaluator =From the repo root:toxicity
- Package module:
agent_control_evaluators.toxicity- Entry point:
toxicity- Evaluator class:
ToxicityEvaluator
Writing the Evaluator
Config — extendEvaluatorConfig with your evaluator’s settings:
Evaluator and decorate with @register_evaluator:
Register the Entry Point
Add the entry point toevaluators/builtin/pyproject.toml:
toxicity) must exactly match metadata.name in the evaluator class.
Exports in toxicity/__init__.py:
Testing
Write tests using Given/When/Then style. Cover at least three cases:- Null input — returns
matched=False, no error - Normal evaluation — returns correct
matchedbased on threshold - Infrastructure failure — returns
matched=Falsewitherrorset (fail-open)
Rules to Know
Error handling — Theerror field is only for infrastructure failures (network errors, API 500s, missing credentials). If your evaluator ran and produced a judgment, that’s matched=True or matched=False — not an error. When error is set, matched must be False (fail-open).
Thread safety — Evaluator instances are cached and reused across concurrent requests. Never store request-scoped state on self. Use local variables in evaluate().
Performance — Pre-compile patterns in __init__(). Use asyncio.to_thread() for CPU-bound work. Respect timeout_ms for external calls.