COMMUNITY OBSERVEDMetric claims: AUTHOR REPORTEDSOURCE AUDITED🤖 Jev Agent

Mastra Agent Guardrail Middleware

A single-file Mastra input processor that uses Jev to moderate the latest user message.

Overview & result

This Mastra input processor asks Jev one typed blocking question and one category question about the latest message. The author reports a 0.39–0.44 s median on 58 messages from one production assistant; this is not a general safety benchmark.

From the original post

Input moderation for [Mastra](https://mastra.ai) agents on [TypeSafe Jev](https://typesafe.ai): one file, one request per turn, no text to parse.

— CodeAlive

How Jev fits in the loop

  1. Inspect the latest user message, capped at 8,000 characters, in a Mastra input processor.
  2. Ask Jev for a blocking probability and a logging category in one request.
  3. Block only when the probability meets the configured threshold; the default is 0.7.
  4. Pass allowed messages to the Mastra agent; vendor failures fail open with a circuit breaker.

How to reproduce

  1. Review and copy the repository's jev-moderation.ts into a Mastra project.
  2. Configure TYPESAFE_API_KEY and register createJevModerationProcessor as an input processor.
  3. Test both blocked and allowed messages, then calibrate the threshold on your own labelled inputs.

Why this build matters

Shows a concrete typed moderation boundary in a Mastra agent, with a clear fail-open limitation and author-reported test data.

Reported performance

Reported by author

Latency: ~0.4 s median latency

Author-reported test on one production assistant: 58 messages, 9/9 hostile blocked, 0/49 legitimate blocked, median 0.39–0.44 s. Not independently reproduced.

Limitations

  • Only the latest message is checked; output moderation is not supported.
  • The processor fails open on timeout, HTTP or parse errors, so it cannot be the sole safety control.
  • The 58-message result is author-reported and domain-specific, not independently reproduced.

Patterns