createEngine, and the engine runs all of them in parallel under a shared timeout budget. Fail-fast (the default) aborts remaining gates the moment one fails, keeping evaluation latency low.
All built-in gates
Composing gates
Pass agates array to createEngine. The engine validates that every gate has a unique name and a run function, then returns an Engine object whose evaluate method you call for each agent output.
EvaluationResult:
Timeout budget
Thetimeout option (default 50 ms) is a wall-clock budget shared across all gates. When the budget expires, the engine fires an AbortController signal. Gates that check signal.aborted before doing expensive work return immediately; any gate that is still running when the timer fires has its result recorded as passed: false with reason: "pecta:aborted: pecta:timeout".
Fail-fast behavior
WhenfailFast is true (the default), the engine aborts the shared AbortController the instant a gate returns passed: false. Gates that have not yet returned will see signal.aborted === true. The engine still waits for every Promise to settle, but aborted gates complete almost immediately. Total evaluation latency is therefore dominated by the first failing gate, not the full gate set.
Set failFast: false if you want verdicts from every gate regardless of earlier failures — useful for auditing or debugging.
A gate that returns
skipped: true is treated as passing. The tmaxGuard RTB gate uses this to opt out of evaluation when the OpenRTB deadline is already exhausted.